Page 4 of 5
Re: Multilanguage CMSMS MLE versione 1.1.2
Posted: Thu Sep 20, 2007 8:38 pm
by alby
andreTTi wrote:
Hi alby and thank you for your great work!
Thank you
andreTTi wrote:
I have installed cmsms mle 1.1.2 and so far it works great except for one small thing. For some reason firefox chooses english as default language although I have configured swedish as default. (With Opera and IE6 it's working and swedish is default)
I tried to follow your instructions as closely as possible but maybe I got somehing wrong..
This is my config_lang.php:
define('DEFAULT_LANG', 'sv_SE');
$hls = array(
'en_US' => array(
'block'=>'en',
'flag'=>'',
),
'sv_SE' => array(
'block'=>'sv',
'flag'=>'',
'locale'=>'sv_SE',
),
Actually i'm not sure about 'locale'=>'sv_SE' ? Is this correct? If not, where can I find the correct locale?
In Unix and shell account or create a php file with this command:
locale -a
Code: Select all
<?php
$output = shell_exec('locale -a');
echo $output;
?>
and check your locale strings, for Windows check in above Replies
I add this option for avoid locale problem on servers.
I think, for next release, the possibility of force DEFAULT_LANG in config_lang.php:
$force_default_lang = true/false; // Default: false
andreTTi wrote:
In config.php locale is left empty. ($config['locale'] = '';)
In Site Admin->Global Settings, "Default language for the frontend:" = "No default selected"
Ok
andreTTi wrote:
What do you mean by "current language (in this way CMSMS load current locale language for ALL modules)"?
In normal mode CMSMS modules load en_US languages (load other language with lang params only)
andreTTi wrote:
In firefox a cookie named "mle" is set to "en_US" when I go to my frontpage. In Opera it is set to "sv_SE" as it should. Default language is set to Swedish in both firefox and opera.
What are your languages in Firefox (Tools > Options > Advanced > General > Languages)?
Alby
Re: Multilanguage CMSMS MLE versione 1.1.2
Posted: Fri Sep 21, 2007 8:29 am
by andreTTi
Thank you for the quick reply!
alby wrote:
In Unix and shell account or create a php file with this command: locale -a
I got the following replies:
Code: Select all
sv_SE
sv_SE.iso88591
sv_SE.iso885915
sv_SE.utf8
swedish
So I guess 'locale'=>'sv_SE' should be ok then?
alby wrote:
I think, for next release, the possibility of force DEFAULT_LANG in config_lang.php:
$force_default_lang = true/false; // Default: false
That would be great!
alby wrote:
andreTTi wrote:
In config.php locale is left empty. ($config['locale'] = '';)
Ok
That was supposed to be:
Don't worry, I'm not flirting with you!
alby wrote:
What are your languages in Firefox (Tools > Options > Advanced > General > Languages)?
My languages in firefox is in the following order:
- Svenska [sv] (swedish)
- Engelska/Förenta staterna [en-us] (US english)
- Engelska [en] (english)
I guess this is a bug in firefox since it working with opera and IE6..
Andreas
Re: Multilanguage CMSMS MLE versione 1.1.2
Posted: Fri Sep 21, 2007 9:18 am
by alby
andreTTi wrote:
I got the following replies:
Code: Select all
sv_SE
sv_SE.iso88591
sv_SE.iso885915
sv_SE.utf8
swedish
So I guess 'locale'=>'sv_SE' should be ok then?
Yes, but (maybe

) sv_SE.utf8 is better (if you use all utf8)
andreTTi wrote:
My languages in firefox is in the following order:
- Svenska [sv] (swedish)
- Engelska/Förenta staterna [en-us] (US english)
- Engelska [en] (english)
Ok, browser script check match in your language order with locale: sv_SE, en_US
sv not match with sv_SE or en_US
en-us (same to en_US)
match with en_US
IF YOU DELETE [en-us] languages, script continue with:
en not match with sv_SE or en_US
after browser script re-check match in your language order with parent-locale: sv, en
sv
match with sv
This script is a modify version of
www.php.net script
I don't know if modify
I see for locale:
fi Finnish
fi_FI Finnish Finland
sv Swedish
sv_FI Swedish Finland
sv_SE Swedish Sweden
What are languages in Swedish Finland (if exist) Firefox?
Alby
Re: Multilanguage CMSMS MLE versione 1.1.2
Posted: Fri Sep 21, 2007 2:57 pm
by andreTTi
alby wrote:
Ok, browser script check match in your language order with locale: sv_SE, en_US
sv not match with sv_SE or en_US
en-us (same to en_US) match with en_US
IF YOU DELETE [en-us] languages, script continue with:
en not match with sv_SE or en_US
after browser script re-check match in your language order with parent-locale: sv, en
sv match with sv
I'm not sure if I understand this correctly but should'nt
sv take precedence over
en_US 
I'm mean since it's the "parentlocale" of
sv_SE. Anyway, I have modified the function "language_user_setting" in function.mle.php to do so.
Here is the modified version:
Code: Select all
function language_user_setting( $hls )
{
$browser_langs = array();
// Check if we have $_SERVER['HTTP_ACCEPT_LANGUAGE'] set and
// it no longer breaks if you only have one language set :)
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$browser_accept = explode(",", $_SERVER['HTTP_ACCEPT_LANGUAGE']);
// Go through all language preference specs
for ($i = 0; $i < count($browser_accept); $i++) {
// The language part is either a code or a code with a quality
// We cannot do anything with a * code, so it is skipped
// If the quality is missing, it is assumed to be 1 according to the RFC
if (preg_match("!([a-z-]+)(;q=([0-9\\.]+))?!", trim($browser_accept[$i]), $found)) {
$quality = (isset($found[3]) ? (float) $found[3] : 1.0);
$browser_langs[] = array($found[1], $quality);
}
unset($found);
}
}
// Order the codes by quality
usort($browser_langs, "language_accept_order");
$t_hls = transform_language_arr($hls);
foreach($browser_langs as $browser_lang)
{
$language = trim($browser_lang[0]);
if (strlen($language) == 2)
{
$language = strtolower($language);
if (in_array($language, array_keys($t_hls))) return $t_hls["$language"];
}
else
{
// Check if $language in config
$language = strtolower(substr($language, 0, 2)) .'_'. strtoupper(substr($language, 3, 2));
if (in_array($language, array_keys($hls))) return $language;
}
}
return DEFAULT_LANG;
}
This seems to work for me anyway. I don't know if this breaks something else, so use at own risk!
Thanks again for your help Alby!
Andreas
Re: Multilanguage CMSMS MLE versione 1.1.2
Posted: Fri Sep 21, 2007 3:52 pm
by alby
andreTTi wrote:
I'm not sure if I understand this correctly but should'nt
sv take precedence over
en_US 
I'm mean since it's the "parentlocale" of
sv_SE. Anyway, I have modified the function "language_user_setting" in function.mle.php to do so.
The problem is:
If you have a site with: en_GB, en_AU, en_US what languages if first?
TODO: I would want is to connect the plugin geolocate
Alby
Re: Multilanguage CMSMS MLE versione 1.1.2
Posted: Sat Sep 22, 2007 1:16 pm
by andreTTi
alby wrote:
The problem is:
If you have a site with: en_GB, en_AU, en_US what languages if first?
No problem, for example if the browser is configured with
en_AU, that language will be choosen. If the browser is configured with only the generic
en, I guess the result would be a bit random (the first one in the list will probably be choosen). But in this case, is'nt it up to the browser to report correct locale in the first place?
I think this behavior is more correct than the original solution which selected an entire different language. (but of course I could be wrong. Maybe I don't have enough insight in how this is supposed to work?)
On a sidenote, how hard would it be to adapt news module and album module to be multilingual?
Andreas
Re: Multilanguage CMSMS MLE versione 1.1.2
Posted: Sat Sep 22, 2007 7:36 pm
by alby
andreTTi wrote:
On a sidenote, how hard would it be to adapt news module and album module to be multilingual?
For News module I use this method:
Create plus category:
Home-en_US, Home-it_IT, Home-fr_FR
In template call module:
{news category="Home-$lang"}
For Album I must still try
Alby
Re: Multilanguage CMSMS MLE version 1.1.2
Posted: Sat Sep 22, 2007 7:37 pm
by alby
I have upgrade to CMSMS
1.1.3.1 
I started a new topic for this version
ONLY
Alby
Re: Multilanguage CMSMS MLE version 1.1.2
Posted: Sun Sep 23, 2007 7:39 pm
by lapinkulta
I'm trying to set up a site in german and hungarian and got mod_rewrite working thanks to the tips here. However, I would prefer to have the URLs like
www.domain.com/hu/... and
www.domain.com/de/.... instead of
www.domain.com/hu_HU/... and
www.domain.com/de_DE/...
I know I can change in config_lang.php from hu_HU to hu, but I feel I'm not using the correct language selection than anymore. Hope you understand what I mean.
Thank you.
lapinkulta
Re: Multilanguage CMSMS MLE version 1.1.2
Posted: Sun Sep 23, 2007 8:10 pm
by alby
lapinkulta wrote:
I'm trying to set up a site in german and hungarian and got mod_rewrite working thanks to the tips here. However, I would prefer to have the URLs like
www.domain.com/hu/... and
www.domain.com/de/.... instead of
www.domain.com/hu_HU/... and
www.domain.com/de_DE/...
I know I can change in config_lang.php from hu_HU to hu, but I feel I'm not using the correct language selection than anymore. Hope you understand what I mean.
Try to use
locale in config_lang.php
'hu' => array (
'block'=>'hu',
'flag'=>'',
'locale'=>'hu_HU',
),
Alby
Re: Multilanguage CMSMS MLE version 1.1.2
Posted: Sun Sep 23, 2007 9:10 pm
by lapinkulta
now that has also a meaning to me

grazie alby
Re: Multilanguage CMSMS MLE version 1.1.2
Posted: Mon Sep 24, 2007 10:05 am
by alby
lapinkulta wrote:
now that has also a meaning to me

grazie alby
I have tried to have the maximum flexibility
Alby
Re: Multilanguage CMSMS MLE version 1.1.2
Posted: Wed Nov 14, 2007 1:20 pm
by ottyscom
Hello
At the moment all the Lings will show follwing:
http://www.otschuster.com/index.php?page=home&hl=es_ES
I would like tho show withe only es (not es_ES) ist that posible? How can i make it?
Another Problem. The Module Album for Photogallery will not show in multilanguage. How can i make it multilanguage for your MLE Edition?
Thank you for your help
Otty
Re: Multilanguage CMSMS MLE version 1.1.2
Posted: Wed Nov 14, 2007 2:09 pm
by alby
Try in config_lang.php with:
'es
_ES' = array(
......
'locale' => 'es_ES',
);
ottyscom wrote:
Another Problem. The Module Album for Photogallery will not show in multilanguage. How can i make it multilanguage for your MLE Edition?
Album (comments) and many other modules are monolingual only.
Workaround (if there is that option) is set param lang="$lang" in calling module.
Alby
Re: Multilanguage CMSMS MLE version 1.1.2
Posted: Thu Nov 15, 2007 12:52 pm
by ottyscom
Ok Thank You,
But i have a big Problem about this.
When my website is visited from a browser or computer at the first the server will show an error:
NOT FOUND
The Server encountered an internal error or missconfiguration and was unable to complete your request
Corioosly when i visit the webpage for my browsers on my computer the website will shoen corectly without erro messages.
Who is the Problem? How can i solvent it?
Thank You