Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2007-12-02 11:20:14
- simsim
- Member
- Registered: 2006-05-06
- Posts: 70
Where to get locale files?
Hello,
I’ve been harvesting the web for more than 4 hours in order to find locale files for Arabic language under Linux to no avail.
My host doesn’t seem to understand what locales are all about so I thought of just sending them the files so as to install it on the server. Could someone tell me where they should be put in a typical LAMP implementation?
TIA.
Offline
Re: Where to get locale files?
locale files for everything installed on the server or just specific programs?
I always assumed they were installed by default and you could just use them by setting the correct locale in your login script (.bashrc), although for a webserver that’s probably done for the webserver user (dedicated) or in PHP.
Offline
#3 2007-12-04 01:04:41
- simsim
- Member
- Registered: 2006-05-06
- Posts: 70
Re: Where to get locale files?
It seems that this topic is far more complicated than it appears.
I’m referring to locale files that reside inside usr/share/locale or usr/share/locales in typical UNIX boxes. They are those files that are called by the PHP setlocale() function in order to format time/date, numbers, monetary & measurements strings & numbers in local languages’ specific formats.
A simple shell command locale -a would list all the available locales. However, I don’t know how to force Textpattern to get use of these files. I tried to use for example <txp:posted format="%A, %d %B %Y" lang="de_AT.utf8" /> but it didn’t work although I’m sure the locale is installed on the server.
I tried so hard to google about using .bashrc to set locales on a user’s account to no avail. Information about this topic is so cluttered & disorganized unfortunately.
Last edited by simsim (2007-12-04 01:06:22)
Offline
Re: Where to get locale files?
<txp:posted format="%A, %d %B %Y" lang="de_AT.utf8" /> should work for setting the locale for that posted format, and if it ain’t working then you have something wrong in your locales etc. But where do you need other locale than setted from Textpattern’s preferences?
Cheers!
Offline
#5 2007-12-04 04:04:06
- simsim
- Member
- Registered: 2006-05-06
- Posts: 70
Re: Where to get locale files?
Gocom wrote:
But where do you need other locale than setted from Textpattern’s preferences?
Textpattern has a limited set of pre-identified locales:
//-------------------------------------------------------------
// function name is misleading but remains for legacy reasons
// this actually sets the locale
function getlocale($lang) {
global $locale;
if (empty($locale))
$locale = @setlocale(LC_TIME, '0');
// Locale identifiers vary from system to system. The
// following code will attempt to discover which identifiers
// are available. We'll need to expand these lists to
// improve support.
// ISO identifiers: http://www.w3.org/WAI/ER/IG/ert/iso639.htm
// Windows: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_language_strings.asp
$guesses = array(
'ar-dz' => array('ar_DZ.UTF-8', 'ar_DZ', 'ara', 'ar', 'arabic', 'ar_DZ.ISO_8859-6'),
'bg-bg' => array('bg_BG.UTF-8', 'bg_BG', 'bg', 'bul', 'bulgarian', 'bg_BG.ISO8859-5'),
'ca-es' => array('ca_ES.UTF-8', 'ca_ES', 'cat', 'ca', 'catalan', 'ca_ES.ISO_8859-1'),
'cs-cz' => array('cs_CZ.UTF-8', 'cs_CZ', 'ces', 'cze', 'cs', 'csy', 'czech', 'cs_CZ.cs_CZ.ISO_8859-2'),
'da-dk' => array('da_DK.UTF-8', 'da_DK'),
'de-de' => array('de_DE.UTF-8', 'de_DE', 'de', 'deu', 'german', 'de_DE.ISO_8859-1'),
'en-gb' => array('en_GB.UTF-8', 'en_GB', 'en_UK', 'eng', 'en', 'english-uk', 'english', 'en_GB.ISO_8859-1','C'),
'en-us' => array('en_US.UTF-8', 'en_US', 'english-us', 'en_US.ISO_8859-1'),
'es-es' => array('es_ES.UTF-8', 'es_ES', 'esp', 'spanish', 'es_ES.ISO_8859-1'),
'et-ee' => array('et_EE.UTF-8', 'et_EE'),
'el-gr' => array('el_GR.UTF-8', 'el_GR', 'el', 'gre', 'greek', 'el_GR.ISO_8859-7'),
'fr-fr' => array('fr_FR.UTF-8', 'fr_FR', 'fra', 'fre', 'fr', 'french', 'fr_FR.ISO_8859-1'),
'fi-fi' => array('fi_FI.UTF-8', 'fi_FI', 'fin', 'fi', 'finnish', 'fi_FI.ISO_8859-1'),
'he_il' => array('he_IL.UTF-8', 'he_IL', 'heb', 'he', 'hebrew', 'he_IL.ISO_8859-8'),
'hu_hu' => array('hu_HU.UTF-8', 'hu_HU', 'hun', 'hu', 'hungarian', 'hu_HU.ISO8859-2'),
'id-id' => array('id_ID.UTF-8', 'id_ID', 'id', 'ind', 'indonesian','id_ID.ISO_8859-1'),
'is-is' => array('is_IS.UTF-8', 'is_IS'),
'it-it' => array('it_IT.UTF-8', 'it_IT', 'it', 'ita', 'italian', 'it_IT.ISO_8859-1'),
'ja-jp' => array('ja_JP.UTF-8', 'ja_JP', 'ja', 'jpn', 'japanese', 'ja_JP.ISO_8859-1'),
'lv-lv' => array('lv_LV.UTF-8', 'lv_LV'),
'no-no' => array('no_NO.UTF-8', 'no_NO', 'no', 'nor', 'norwegian', 'no_NO.ISO_8859-1'),
'nl-nl' => array('nl_NL.UTF-8', 'nl_NL', 'dut', 'nla', 'nl', 'nld', 'dutch', 'nl_NL.ISO_8859-1'),
'pl-pl' => array('pl_PL.UTF-8', 'pl_PL'),
'pt-pt' => array('pt_PT.UTF-8', 'pt_PT', 'por', 'portuguese', 'pt_PT.ISO_8859-1'),
'ro-ro' => array('ro_RO.UTF-8', 'ro_RO', 'ron', 'rum', 'ro', 'romanian', 'ro_RO.ISO8859-2'),
'ru-ru' => array('ru_RU.UTF-8', 'ru_RU', 'ru', 'rus', 'russian', 'ru_RU.ISO8859-5'),
'sk-sk' => array('sk_SK.UTF-8', 'sk_SK', 'sk', 'slo', 'slk', 'sky', 'slovak', 'sk_SK.ISO_8859-1'),
'sv-se' => array('sv_SE.UTF-8', 'sv_SE', 'sv', 'swe', 'sve', 'swedish', 'sv_SE.ISO_8859-1'),
'th-th' => array('th_TH.UTF-8', 'th_TH', 'th', 'tha', 'thai', 'th_TH.ISO_8859-11'),
'uk-ua' => array('uk_UA.UTF-8', 'uk_UA'),
'zh-cn' => array('zh_CN.UTF-8', 'zh_CN'),
'zh-tw' => array('zh_TW.UTF-8', 'zh_TW'),
);
There is a whole lot than these listed above. Also I’ve noticed that some Linux flavors have the extension for Unicode locales as utf8 not utf-8, so this may cause TXP not to recognize locales on some systems albeit they’re available. :)
Offline
Re: Where to get locale files?
Isn’t nl_NL.utf8 the same thing as nl_NL.UTF-8?
`locale -a` shows the former, `locale-gen` shows the latter.
[edit: googling a bit reveals that the UTF-8 notation is the correct one, the other one is sometimes used for historic reasons, as I understand it]
If your preferred locale is missing, please request it in the development subforum. As I understand it, we only list locales for which we have translations, so if you can provide the required translation strings as well, that would increase chances of having your locale included dramatically.
Offline
#7 2007-12-04 12:45:29
- simsim
- Member
- Registered: 2006-05-06
- Posts: 70
Re: Where to get locale files?
Stranegly, when I chose ar-dz as a locale it does work although the server I’m on doesn’t contain any Arabic locale files (conformed by the host with a locale -a command)!
Does TXP acquire locale values from other places than the server? e.g. form end user’s OS?
ruud wrote:
If your preferred locale is missing, please request it in the development subforum. As I understand it, we only list locales for which we have translations, so if you can provide the required translation strings as well, that would increase chances of having your locale included dramatically.
Surely I was going to do so; I’m just waiting to finish up a project I’m taking up right now. :)
Offline
#8 2007-12-04 21:55:15
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Where to get locale files?
Stranegly, when I chose ar-dz as a locale it does work…
So what’s the problem? :)
Does TXP acquire locale values from other places than the server? e.g. form end user’s OS?
No, that’s impossible.
…we only list locales for which we have translations, so if you can provide the required translation strings as well…
Surely I was going to do so; I’m just waiting to finish up a project I’m taking up right now.
We already have Arabic, so we don’t need it to be translated again. Unless you’re speaking of a different dialect or something.
Offline
#9 2007-12-05 06:35:12
- simsim
- Member
- Registered: 2006-05-06
- Posts: 70
Re: Where to get locale files?
Mary wrote:
So what’s the problem? :)
Because there were not any Arabic locales installed on the server!
No, that’s impossible.
Refer to the above :)
We already have Arabic, so we don’t need it to be translated again. Unless you’re speaking of a different dialect or something.
For locales it does differ, but for language phrases & strings you’re right it doesn’t. I don’t know how you would implement locale differences though.
Anyway the Arabic translation packaged with TXP needs lots of improvements & updating, so I will actually provide translation only as locales are generally come bundled with the OS in compiled binary format & are uneditable.
Offline
#10 2007-12-05 07:13:57
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Where to get locale files?
Let’s try that again: But if it works, why does it matter?
Offline
#11 2007-12-05 09:38:16
- simsim
- Member
- Registered: 2006-05-06
- Posts: 70
Re: Where to get locale files?
If you mean why does it matter to have different locales, then it actually doesn’t work in that sense. For example users of locale sa (i.e. Saudi Arabia) use a very different format for dates that is not shared by any other Arabic locale. including the ar-dz supported by TXP.
Otherwise, I wasn’t complaining in the first place.
Last edited by simsim (2007-12-05 09:38:39)
Offline
#12 2007-12-06 05:30:41
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Where to get locale files?
I see.
Anyway, we’d technically still have to have a second set of strings for another Arabic locale (ar-sa). If you wanted to make corrections to ar-dz, you’re welcome to do so.
Offline
Pages: 1