Content-Language

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
cmb
Posts: 11445
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Content-Language

Postby cmb » Mon Aug 20, 2012 10:49 am

Hello Community,

since CMSimple_XH 1.5 the <meta http-equiv="Content-Language"> is omitted from the (X)HTML ouput, because this is obsolete for HTML5. But IMO it's important to specify the content language for the document as recommended by the W3C. This could be done by sending a Content-Language header with the appropriate language tag. Shall we do so?

Please note, that there might be a problem for some languages, as only the 2 letter ISO 639-1 language code is not enough to distinguish them. This is currently the case for traditional vs. simplified Chinese: both have the same ISO 639-1 language code ("zh"), and it's recommended to use zh-Hant resp. zh-Hans. How should we handle this? Any ideas?

Christoph
Christoph M. Becker –Plugins for CMSimple_XH, but not for CMSimple 4+

Tata
Posts: 2359
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Content-Language

Postby Tata » Mon Aug 20, 2012 1:37 pm

Maybe better some kind of script with:

Code: Select all

if ($content_language =  zh-Hant || $content_language_code =  zh-Hans) $content_language_code = ISO 639-1
?
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

cmb
Posts: 11445
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: Content-Language

Postby cmb » Mon Aug 20, 2012 2:14 pm

Hi Tata,

but from where should $content_language_code be taken in the first place? Traditionally the current language is set in $sl, and this is just the name of the copy of the 2lang/ folder. Changing $sl on the fly won't work, as $sl saves other purposes too (e.g. the language files of the plugins are named $sl.php). And I'd rather avoid any hardcoded mappings from $sl to the language tag in the core. A possible solution would be to introduce

Code: Select all

$tx['language']['current']="";
which had to be configured by the user manually.

But this might still not solve the issue with some JS libraries (e.g. tinyMCE, CKeditor, etc.), which use $sl for the localization. These plugins would have to be rewritten to look for $tx['language']['current'] first.

Another possibility would be to allow the 2lang/ folder to contain more than 2 letters (which is on the roadmap to 1.6 as idea), so one may use zh-Hant/ and zh-Hans/, which is probably the simplest solution. But that also would need some plugins to be modified, as some are setting the language like so:

Code: Select all

$lang = strlen($sl) == 2 ? $sl : $cf['language']['default'] 


Christoph
Christoph M. Becker –Plugins for CMSimple_XH, but not for CMSimple 4+

Tata
Posts: 2359
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Content-Language

Postby Tata » Mon Aug 20, 2012 6:08 pm

As almost always, you are right :-). It was just an idea.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.


Return to “Open Development”

Who is online

Users browsing this forum: No registered users and 1 guest