1

I have some troubles with locale codes in CakePHP 1.3 (but also applicable for 2.0)

I am using the 3 letter codes for the languages but some codes are not available. For example I would like to setup aus for Australia. As the documentation says

The three-character locale codes conform to the ISO 639-2 standard, although if you create regional locales (en_US, en_GB, etc.) cake will use them if appropriate.

And aus exists in ISO 639-2 but does not work with CakePHP. It saves the i18n record but when displaying the content it takes the english version. Just the same happens when putting code that is not available in the ISO standard. Also I have tried with the location based code en_AU and the result is the same.

Am I able to make any code to work, no matter if it is according the ISO standard. This is because in the site administrator has access to the languages in the site and I would like to allow him to use any combination of letters to use as a code for the language.

Also how to get setup code for Australia

4

1 回答 1

1

您需要告诉 cake 您使用什么语言进行翻译。您可以使用通用的 3 字母代码(如 eng)或更多特定于位置的代码(如 en-US)。

在你的情况下:

Configure::write('Config.language', 'en-au')

注意破折号(https://github.com/cakephp/cakephp/blob/2.3/lib/Cake/I18n/L10n.php)。

然后该文件夹将是“en_au”/APP/Locale/

于 2013-01-12T14:22:55.737 回答