Table of locales: Difference between revisions
Helen Foster (talk | contribs) m (category edit, formatting) |
Mary Cooch (talk | contribs) (WIP MDLSITE-6728) |
||
(23 intermediate revisions by 11 users not shown) | |||
Line 1: | Line 1: | ||
{{Language}} | |||
==Introduction== | ==Introduction== | ||
'''Definition:''' (from [http://en.wikipedia.org/wiki/Locale Wikipedia]) Locale is a set of parameters that defines the user's language, country and any special variant preferences that the user wants to see in their user interface. Usually a locale identifier consists of at least a language identifier and a region identifier. | '''Definition:''' (from [http://en.wikipedia.org/wiki/Locale Wikipedia]) Locale is a set of parameters that defines the user's language, country and any special variant preferences that the user wants to see in their user interface. Usually a locale identifier consists of at least a language identifier and a region identifier. | ||
Actually, the one and only place where Moodle requires some locales to be installed on the machine is when handling date translation (according to [https://tracker.moodle.org/browse/MDL-31622 this information]). | |||
Currently such locales are named differently under Unix-based and Win32-based platforms so we need to have them defined separately to allow Moodle to use them as necessary. For each '''lang package''' available for Moodle, we must specify the '''locale''' value (Unix locale) and the ''localewin''' value (Win32 locale). Both those strings should be (no mandatory) defined inside each Moodle 1.6 and upwards langpack to be able to display locale strings properly. | Currently such locales are named differently under Unix-based and Win32-based platforms so we need to have them defined separately to allow Moodle to use them as necessary. For each '''lang package''' available for Moodle, we must specify the '''locale''' value (Unix locale) and the ''localewin''' value (Win32 locale). Both those strings should be (no mandatory) defined inside each Moodle 1.6 and upwards langpack to be able to display locale strings properly. | ||
Line 12: | Line 14: | ||
While the '''.charset''' part seems to work properly under Unix, it seems that is not working under Win32 (at least from PHP), and strings returned from some PHP functions aren't in the charset specified but in some sort of default charset. Let's call it '''localewincharset'''. This forces us to convert from this charset to the current_charset() being used by the user. | While the '''.charset''' part seems to work properly under Unix, it seems that is not working under Win32 (at least from PHP), and strings returned from some PHP functions aren't in the charset specified but in some sort of default charset. Let's call it '''localewincharset'''. This forces us to convert from this charset to the current_charset() being used by the user. | ||
==Support in operating systems== | |||
Just in case you freshly installed some new locales and they don't seem to work don't forget to restart your webserver. | |||
===openSUSE=== | |||
* SUSE linux 10.1 contains all necessary locales in default installation | |||
===Ubuntu based=== | |||
The default installation contains only limited number of locales. You can generate all locales on server from command line: | |||
sudo apt install locales-all && sudo locale-gen | |||
===Debian based=== | |||
The default installation contains only a limited number of locales. You can generate the locales you need on your server from the command line. Login as root and execute: | |||
dpkg-reconfigure locales | |||
choose the ones you need and press OK, next select the default locale for your server and press OK. | |||
===RHEL/CentOS=== | |||
Since RHEL/CentOS 8 you may need install additional language supports manually by dnf/yum ([https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_basic_system_settings/using-langpacks_configuring-basic-system-settings more info]): | |||
dnf install langpacks-<locale_code> | |||
or, for saving disk space: | |||
dnf install glibc-langpack-<locale_code> | |||
or, for all languages: | |||
dnf install glibc-all-langpacks | |||
Then check that the locale appeared on the system: | |||
localectl list-locales | |||
===MoodleBox=== | |||
You can add locales by typing in the MoodleBox console: | |||
sudo dpkg-reconfigure locales | |||
===FreeBSD=== | |||
All 5.x and later versions should already contain a large number of supported locales with utf-8 charset. | |||
===MacOS=== | |||
Mac OS support for many locales is very poor. There is no easy way to add new locales to a Mac OS. | |||
You can find the installed locales by issuing the following command in a Mac: | |||
locale -a | |||
Some people have attempted digital surgery to install a needed Mac locale, by copying an existing locale into a new file. You should really edit the newly copied file in order to make the changes needed from the source file in order to adapt to your real local settings (like currency). See [https://stackoverflow.com/questions/9991603/add-a-locale-in-mac-osx this site] and [https://lh.2xlibre.net/locales/ this one] and [https://lh.2xlibre.net/locale/es_MX/glibc/ this one too]. | |||
===MS Windows=== | |||
There is no way to add new locales, see following table for list of supported locales. | |||
==Table== | ==Table== | ||
So, for each 1.6 Moodle language pack, we'll describe below this columns: | So, for each 1.6 Moodle language pack, we'll describe below this columns: | ||
* '''package_name:''' name of the language pack as | * '''package_name:''' name of the language pack as shown in https://download.moodle.org/langpack/4.0/ | ||
* '''lang_name:''' name of the language as | * '''lang_name:''' name of the language as shown in https://download.moodle.org/langpack/4.0/ | ||
* '''locale:''' locale string to be used under Unix platforms. This will be stored in each language '''langconfig.php''' file. | * '''locale:''' locale string to be used under Unix platforms. This will be stored in each language '''langconfig.php''' file. | ||
* '''localewin:''' locale string to be used under Win32 platforms. This will be stored in each language '''langconfig.php''' file. | * '''localewin:''' locale string to be used under Win32 platforms. This will be stored in each language '''langconfig.php''' file. | ||
Line 33: | Line 83: | ||
<td>af_utf8</td> | <td>af_utf8</td> | ||
<td>Afrikaans</td> | <td>Afrikaans</td> | ||
<td> | <td>af_ZA.UTF-8</td> | ||
<td> | <td>Afrikaans_South Africa.1252</td> | ||
<td>WINDOWS-1252</td></tr> | <td>WINDOWS-1252</td></tr> | ||
<tr> | <tr> | ||
<td>sq_utf8</td> | <td>sq_utf8</td> | ||
<td>Albanian</td> | <td>Albanian</td> | ||
<td> | <td>sq_AL.UTF-8</td> | ||
<td>Albanian_Albania.1250</td> | <td>Albanian_Albania.1250</td> | ||
<td>WINDOWS-1250</td></tr> | <td>WINDOWS-1250</td></tr> | ||
Line 45: | Line 95: | ||
<td>ar_utf8</td> | <td>ar_utf8</td> | ||
<td>Arabic</td> | <td>Arabic</td> | ||
<td> | <td>ar_SA.UTF-8</td> | ||
<td> | <td>Arabic_Saudi Arabia.1256</td> | ||
<td>WINDOWS-1256</td></tr> | <td>WINDOWS-1256</td></tr> | ||
<tr> | <tr> | ||
<td>eu_utf8</td> | <td>eu_utf8</td> | ||
<td>Basque</td> | <td>Basque</td> | ||
<td> | <td>eu_ES.UTF-8</td> | ||
<td>Basque_Spain.1252</td> | <td>Basque_Spain.1252</td> | ||
<td>WINDOWS-1252</td></tr> | <td>WINDOWS-1252</td></tr> | ||
Line 57: | Line 107: | ||
<td>be_utf8</td> | <td>be_utf8</td> | ||
<td>Belarusian</td> | <td>Belarusian</td> | ||
<td> | <td>be_BY.UTF-8</td> | ||
<td>Belarusian_Belarus.1251</td> | <td>Belarusian_Belarus.1251</td> | ||
<td>WINDOWS-1251</td></tr> | <td>WINDOWS-1251</td></tr> | ||
Line 63: | Line 113: | ||
<td>bs_utf8</td> | <td>bs_utf8</td> | ||
<td>Bosnian</td> | <td>Bosnian</td> | ||
<td> | <td>bs_BA.UTF-8</td> | ||
<td> | <td>Bosnian (Latin)</td> | ||
<td>WINDOWS-1250</td></tr> | <td>WINDOWS-1250</td></tr> | ||
<tr> | <tr> | ||
<td>bg_utf8</td> | <td>bg_utf8</td> | ||
<td>Bulgarian</td> | <td>Bulgarian</td> | ||
<td> | <td>bg_BG.UTF-8</td> | ||
<td>Bulgarian_Bulgaria.1251</td> | <td>Bulgarian_Bulgaria.1251</td> | ||
<td>WINDOWS-1251</td></tr> | <td>WINDOWS-1251</td></tr> | ||
Line 135: | Line 185: | ||
<td>fa_utf8</td> | <td>fa_utf8</td> | ||
<td>Farsi</td> | <td>Farsi</td> | ||
<td> | <td>fa_IR.UTF-8</td> | ||
<td>Farsi_Iran.1256</td> | <td>Farsi_Iran.1256</td> | ||
<td>WINDOWS-1256</td></tr> | <td>WINDOWS-1256</td></tr> | ||
Line 141: | Line 191: | ||
<td>fil_utf8</td> | <td>fil_utf8</td> | ||
<td>Filipino</td> | <td>Filipino</td> | ||
<td> | <td>fil_PH.UTF-8</td> | ||
<td><span style="color:red">Filipino_Philippines.1252</span></td> | <td><span style="color:red">Filipino_Philippines.1252</span></td> | ||
<td><span style="color:red">WINDOWS-1252</span></td></tr> | <td><span style="color:red">WINDOWS-1252</span></td></tr> | ||
Line 153: | Line 203: | ||
<td>fr_utf8</td> | <td>fr_utf8</td> | ||
<td>French</td> | <td>French</td> | ||
<td>fr_FR.UTF-8</td> | <td>fr_FR.UTF-8 ''or''<br />fr_CH.UTF-8 ''or''<br />fr_BE.UTF-8</td> | ||
<td>French_France.1252</td> | <td>French_France.1252</td> | ||
<td>WINDOWS-1252</td></tr> | <td>WINDOWS-1252</td></tr> | ||
Line 160: | Line 210: | ||
<td>French (Canada)</td> | <td>French (Canada)</td> | ||
<td>fr_CA.UTF-8</td> | <td>fr_CA.UTF-8</td> | ||
<td> | <td>French_Canada.1252</td> | ||
<td>-parent fr_utf8 used-</td></tr> | <td>-parent fr_utf8 used-</td></tr> | ||
<tr> | <tr> | ||
Line 171: | Line 221: | ||
<td>gl_utf8</td> | <td>gl_utf8</td> | ||
<td>Gallego</td> | <td>Gallego</td> | ||
<td> | <td>gl_ES.UTF-8</td> | ||
<td>Galician_Spain.1252</td> | <td>Galician_Spain.1252</td> | ||
<td>WINDOWS-1252</td></tr> | <td>WINDOWS-1252</td></tr> | ||
Line 177: | Line 227: | ||
<td>ka_utf8</td> | <td>ka_utf8</td> | ||
<td>Georgian</td> | <td>Georgian</td> | ||
<td | <td>ka_GE.UTF-8</td> | ||
<td><span style="color:red">Georgian_Georgia.65001</span></td> | <td><span style="color:red">Georgian_Georgia.65001</span></td> | ||
<td>-empty string-</td></tr> | <td>-empty string-</td></tr> | ||
Line 183: | Line 233: | ||
<td>de_utf8</td> | <td>de_utf8</td> | ||
<td>German</td> | <td>German</td> | ||
<td> | <td>de_DE.UTF-8</td> | ||
<td>German_Germany.1252</td> | <td>German_Germany.1252</td> | ||
<td>WINDOWS-1252</td></tr> | <td>WINDOWS-1252</td></tr> | ||
Line 195: | Line 245: | ||
<td>el_utf8</td> | <td>el_utf8</td> | ||
<td>Greek</td> | <td>Greek</td> | ||
<td> | <td>el_GR.UTF-8</td> | ||
<td>Greek_Greece.1253</td> | <td>Greek_Greece.1253</td> | ||
<td>WINDOWS-1253</td></tr> | <td>WINDOWS-1253</td></tr> | ||
<tr> | |||
<td>gu_utf8</td> | |||
<td>Gujarati</td> | |||
<td>gu.UTF-8</td> | |||
<td>Gujarati_India.0</td> | |||
<td> </td></tr> | |||
<tr> | <tr> | ||
<td>he_utf8</td> | <td>he_utf8</td> | ||
<td>Hebrew</td> | <td>Hebrew</td> | ||
<td> | <td>he_IL.utf8</td> | ||
<td>Hebrew_Israel.1255</td> | <td>Hebrew_Israel.1255</td> | ||
<td>WINDOWS-1255</td></tr> | <td>WINDOWS-1255</td></tr> | ||
Line 207: | Line 263: | ||
<td>hi_utf8</td> | <td>hi_utf8</td> | ||
<td>Hindi</td> | <td>Hindi</td> | ||
<td> | <td>hi_IN.UTF-8</td> | ||
<td><span style="color:red">Hindi.65001</span></td> | <td><span style="color:red">Hindi.65001</span></td> | ||
<td>-empty string-</td></tr> | <td>-empty string-</td></tr> | ||
Line 216: | Line 272: | ||
<td>Hungarian_Hungary.1250</td> | <td>Hungarian_Hungary.1250</td> | ||
<td>WINDOWS-1250</td></tr> | <td>WINDOWS-1250</td></tr> | ||
<tr> | |||
<td>is_utf8</td> | |||
<td>Icelandic</td> | |||
<td>is_IS.UTF-8</td> | |||
<td>Icelandic_Iceland.1252</td> | |||
<td>WINDOWS-1252</td></tr> | |||
<tr> | <tr> | ||
<td>id_utf8</td> | <td>id_utf8</td> | ||
Line 237: | Line 299: | ||
<td>kn_utf8</td> | <td>kn_utf8</td> | ||
<td>Kannada</td> | <td>Kannada</td> | ||
<td> | <td>kn_IN.UTF-8</td> | ||
<td><span style="color:red">Kannada.65001</span></td> | <td><span style="color:red">Kannada.65001</span></td> | ||
<td>-empty string-</td></tr> | <td>-empty string-</td></tr> | ||
Line 243: | Line 305: | ||
<td>km_utf8</td> | <td>km_utf8</td> | ||
<td>Khmer</td> | <td>Khmer</td> | ||
<td> | <td>km_KH.UTF-8</td> | ||
<td><span style="color:red">Khmer.65001</span></td> | <td><span style="color:red">Khmer.65001</span></td> | ||
<td>-empty string-</td></tr> | <td>-empty string-</td></tr> | ||
Line 252: | Line 314: | ||
<td>Korean_Korea.949</td> | <td>Korean_Korea.949</td> | ||
<td>EUC-KR</td></tr> | <td>EUC-KR</td></tr> | ||
<tr> | |||
<td>lo_utf8</td> | |||
<td>Lao</td> | |||
<td>lo_LA.UTF-8</td> | |||
<td>Lao_Laos.UTF-8</td> | |||
<td>WINDOWS-1257</td></tr> | |||
<tr> | <tr> | ||
<td>lt_utf8</td> | <td>lt_utf8</td> | ||
Line 267: | Line 335: | ||
<td>ml_utf8</td> | <td>ml_utf8</td> | ||
<td>Malayalam</td> | <td>Malayalam</td> | ||
<td> | <td>ml_IN.UTF-8</td> | ||
<td><span style="color:red">Malayalam_India.x-iscii-ma</span></td> | <td><span style="color:red">Malayalam_India.x-iscii-ma</span></td> | ||
<td><span style="color:red">x-iscii-ma</span></td></tr> | <td><span style="color:red">x-iscii-ma</span></td></tr> | ||
Line 273: | Line 341: | ||
<td>ms_utf8</td> | <td>ms_utf8</td> | ||
<td>Malaysian</td> | <td>Malaysian</td> | ||
<td> | <td>ms_MY.UTF-8</td> | ||
<td> | <td>Malay_malaysia.1252</td> | ||
<td | <td>WINDOWS-1252</td></tr> | ||
<tr> | <tr> | ||
<td>mi_tn_utf8</td> | <td>mi_tn_utf8</td> | ||
<td>Maori (Ngai Tahu)</td> | <td>Maori (Ngai Tahu)</td> | ||
<td> | <td>mi_NZ.UTF-8</td> | ||
<td><span style="color:red">Maori.1252</span></td> | <td><span style="color:red">Maori.1252</span></td> | ||
<td><span style="color:red">WINDOWS-1252</span></td></tr> | <td><span style="color:red">WINDOWS-1252</span></td></tr> | ||
<tr> | |||
<td>mi_wwow_utf8</td> | |||
<td>Maori (Waikoto Uni)</td> | |||
<td>mi_NZ.UTF-8</td> | |||
<td><span style="color:red">Maori.1252</span></td> | |||
<td><span style="color:red">WINDOWS-1252</span></td></tr> | |||
<tr> | |||
<td>mn_utf8</td> | |||
<td>Mongolian</td> | |||
<td>mn.UTF-8</td> | |||
<td>Cyrillic_Mongolian.1251</td> | |||
<td></tr> | |||
<tr> | <tr> | ||
<td>no_utf8</td> | <td>no_utf8</td> | ||
Line 289: | Line 369: | ||
<td>WINDOWS-1252</td></tr> | <td>WINDOWS-1252</td></tr> | ||
<tr> | <tr> | ||
<td> | <td>no_gr_utf8</td> | ||
<td>Norwegian (Primary)</td> | <td>Norwegian (Primary)</td> | ||
<td>no_NO.UTF-8</td> | <td>no_NO.UTF-8</td> | ||
Line 330: | Line 410: | ||
<td>Russian_Russia.1251</td> | <td>Russian_Russia.1251</td> | ||
<td>WINDOWS-1251</td></tr> | <td>WINDOWS-1251</td></tr> | ||
<tr> | |||
<td>sm_utf8</td> | |||
<td>Samoan</td> | |||
<td>mi_NZ.UTF-8</td> | |||
<td>Maori.1252</td> | |||
<td>WINDOWS-1252</td></tr> | |||
<tr> | <tr> | ||
<td>sr_utf8</td> | <td>sr_utf8</td> | ||
<td>Serbian</td> | <td>Serbian</td> | ||
<td><span style="color:red"> | <td>sr_CS.UTF-8</td> | ||
<td>Bosnian(Cyrillic), <span style="color:red">Serbian (Cyrillic)</span></td> | |||
<td>WINDOWS-1251</td></tr> | <td>WINDOWS-1251</td></tr> | ||
<tr> | <tr> | ||
Line 345: | Line 431: | ||
<td>sl_utf8</td> | <td>sl_utf8</td> | ||
<td>Slovenian</td> | <td>Slovenian</td> | ||
<td> | <td>sl_SI.UTF-8</td> | ||
<td>Slovenian_Slovenia.1250</td> | <td>Slovenian_Slovenia.1250</td> | ||
<td>WINDOWS-1250</td></tr> | <td>WINDOWS-1250</td></tr> | ||
Line 351: | Line 437: | ||
<td>so_utf8</td> | <td>so_utf8</td> | ||
<td>Somali</td> | <td>Somali</td> | ||
<td> | <td>so_SO.UTF-8</td> | ||
<td><span style="color:red">not found!</span></td> | <td><span style="color:red">not found!</span></td> | ||
<td><span style="color:red">not found!</span></td></tr> | <td><span style="color:red">not found!</span></td></tr> | ||
Line 360: | Line 446: | ||
<td>Spanish_Spain.1252</td> | <td>Spanish_Spain.1252</td> | ||
<td>WINDOWS-1252</td></tr> | <td>WINDOWS-1252</td></tr> | ||
<tr> | <tr> | ||
<td>sv_utf8</td> | <td>sv_utf8</td> | ||
Line 378: | Line 458: | ||
<td><span style="color:red">not found!</span></td> | <td><span style="color:red">not found!</span></td> | ||
<td><span style="color:red">not found!</span></td></tr> | <td><span style="color:red">not found!</span></td></tr> | ||
<tr> | |||
<td>ta_utf8</td> | |||
<td>Tamil</td> | |||
<td>ta_IN.UTF-8</td> | |||
<td>English_Australia.1252</td> | |||
<td></td></tr> | |||
<tr> | <tr> | ||
<td>th_utf8</td> | <td>th_utf8</td> | ||
<td>Thai</td> | <td>Thai</td> | ||
<td> | <td>th_TH.UTF-8</td> | ||
<td>Thai_Thailand.874</td> | <td>Thai_Thailand.874</td> | ||
<td>WINDOWS-874</td></tr> | <td>WINDOWS-874</td></tr> | ||
<tr> | |||
<td>to_utf8</td> | |||
<td>Tongan</td> | |||
<td>mi_NZ.UTF-8'</td> | |||
<td>Maori.1252</td> | |||
<td>WINDOWS-1252</td></tr> | |||
<tr> | <tr> | ||
<td>tr_utf8</td> | <td>tr_utf8</td> | ||
Line 399: | Line 491: | ||
<td>vi_utf8</td> | <td>vi_utf8</td> | ||
<td>Vietnamese</td> | <td>Vietnamese</td> | ||
<td> | <td>vi_VN.UTF-8</td> | ||
<td>Vietnamese_Viet Nam.1258</td> | <td>Vietnamese_Viet Nam.1258</td> | ||
<td>WINDOWS-1258</td></tr> | <td>WINDOWS-1258</td></tr> | ||
Line 410: | Line 502: | ||
=== Windows=== | === Windows=== | ||
* Win32 Language names: http://msdn.microsoft.com | * Win32 Language names: http://msdn.microsoft.com/en-us/library/dd318693.aspx | ||
* Win32 Country names: http://msdn.microsoft.com | * Win32 Country names: http://msdn.microsoft.com/en-us/library/cdax410z.aspx | ||
* Win32 Codepage codes: http://www.microsoft.com/globaldev/reference/wincp.mspx | * Win32 Codepage codes: http://www.microsoft.com/globaldev/reference/wincp.mspx | ||
* Win32 NLS Reference: http://msdn.microsoft.com/es-es/goglobal/bb896001.aspx | |||
* Languages and codepages: http://www.science.co.il/Language/Locale-Codes.asp | * Languages and codepages: http://www.science.co.il/Language/Locale-Codes.asp | ||
* More languages and codepages: http://code.cside.com/3rdpage/windows/ | * More languages and codepages: http://code.cside.com/3rdpage/windows/ | ||
Line 423: | Line 516: | ||
* Unix Country names: http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html | * Unix Country names: http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html | ||
* Unix Charset codes: http://www.w3.org/International/O-charset-list.html | * Unix Charset codes: http://www.w3.org/International/O-charset-list.html | ||
* More locales: http://search.cpan.org/~drolsky/DateTime-Locale-0.42/lib/DateTime/Locale/Catalog.pm | |||
===Other Information=== | ===Other Information=== | ||
* [[List of locales supported on Moodle community servers]] | |||
* Locale Name Guide: http://openi18n.org/docs/text/LocNameGuide-V10.txt | * Locale Name Guide: http://openi18n.org/docs/text/LocNameGuide-V10.txt | ||
* FAQ about ISO 639: http://www.loc.gov/standards/iso639-2/faq.html | * FAQ about ISO 639: http://www.loc.gov/standards/iso639-2/faq.html | ||
Line 431: | Line 525: | ||
* Weekdays and Months: http://www.domesticat.net/misc/monthsdays.php | * Weekdays and Months: http://www.domesticat.net/misc/monthsdays.php | ||
[[Category:Language]] | [[Category:Language]] | ||
[[Category:UTF-8]] | [[Category:UTF-8]] |
Latest revision as of 12:47, 29 July 2022
Introduction
Definition: (from Wikipedia) Locale is a set of parameters that defines the user's language, country and any special variant preferences that the user wants to see in their user interface. Usually a locale identifier consists of at least a language identifier and a region identifier.
Actually, the one and only place where Moodle requires some locales to be installed on the machine is when handling date translation (according to this information).
Currently such locales are named differently under Unix-based and Win32-based platforms so we need to have them defined separately to allow Moodle to use them as necessary. For each lang package' available for Moodle, we must specify the locale value (Unix locale) and the localewin value (Win32 locale). Both those strings should be (no mandatory) defined inside each Moodle 1.6 and upwards langpack to be able to display locale strings properly.
The general syntax for locales is:
language[_country][.charset]
(with information under brackets being optional)
While the .charset part seems to work properly under Unix, it seems that is not working under Win32 (at least from PHP), and strings returned from some PHP functions aren't in the charset specified but in some sort of default charset. Let's call it localewincharset. This forces us to convert from this charset to the current_charset() being used by the user.
Support in operating systems
Just in case you freshly installed some new locales and they don't seem to work don't forget to restart your webserver.
openSUSE
- SUSE linux 10.1 contains all necessary locales in default installation
Ubuntu based
The default installation contains only limited number of locales. You can generate all locales on server from command line:
sudo apt install locales-all && sudo locale-gen
Debian based
The default installation contains only a limited number of locales. You can generate the locales you need on your server from the command line. Login as root and execute:
dpkg-reconfigure locales
choose the ones you need and press OK, next select the default locale for your server and press OK.
RHEL/CentOS
Since RHEL/CentOS 8 you may need install additional language supports manually by dnf/yum (more info):
dnf install langpacks-<locale_code>
or, for saving disk space:
dnf install glibc-langpack-<locale_code>
or, for all languages:
dnf install glibc-all-langpacks
Then check that the locale appeared on the system:
localectl list-locales
MoodleBox
You can add locales by typing in the MoodleBox console:
sudo dpkg-reconfigure locales
FreeBSD
All 5.x and later versions should already contain a large number of supported locales with utf-8 charset.
MacOS
Mac OS support for many locales is very poor. There is no easy way to add new locales to a Mac OS.
You can find the installed locales by issuing the following command in a Mac:
locale -a
Some people have attempted digital surgery to install a needed Mac locale, by copying an existing locale into a new file. You should really edit the newly copied file in order to make the changes needed from the source file in order to adapt to your real local settings (like currency). See this site and this one and this one too.
MS Windows
There is no way to add new locales, see following table for list of supported locales.
Table
So, for each 1.6 Moodle language pack, we'll describe below this columns:
- package_name: name of the language pack as shown in https://download.moodle.org/langpack/4.0/
- lang_name: name of the language as shown in https://download.moodle.org/langpack/4.0/
- locale: locale string to be used under Unix platforms. This will be stored in each language langconfig.php file.
- localewin: locale string to be used under Win32 platforms. This will be stored in each language langconfig.php file.
- localewincharset: charset in which PHP is retrieving information from locale-dependent functions (strftime...). This will allow us to convert such strings to the final charset properly. This will be stored in each language langconfig.php file.
package_name | lang_name | locale | localewin | localewincharset |
---|---|---|---|---|
af_utf8 | Afrikaans | af_ZA.UTF-8 | Afrikaans_South Africa.1252 | WINDOWS-1252 |
sq_utf8 | Albanian | sq_AL.UTF-8 | Albanian_Albania.1250 | WINDOWS-1250 |
ar_utf8 | Arabic | ar_SA.UTF-8 | Arabic_Saudi Arabia.1256 | WINDOWS-1256 |
eu_utf8 | Basque | eu_ES.UTF-8 | Basque_Spain.1252 | WINDOWS-1252 |
be_utf8 | Belarusian | be_BY.UTF-8 | Belarusian_Belarus.1251 | WINDOWS-1251 |
bs_utf8 | Bosnian | bs_BA.UTF-8 | Bosnian (Latin) | WINDOWS-1250 |
bg_utf8 | Bulgarian | bg_BG.UTF-8 | Bulgarian_Bulgaria.1251 | WINDOWS-1251 |
ca_utf8 | Catalan | ca_ES.UTF-8 | Catalan_Spain.1252 | WINDOWS-1252 |
hr_utf8 | Croatian | hr_HR.UTF-8 | Croatian_Croatia.1250 | WINDOWS-1250 |
zh_cn_utf8 | Chinese (Simplified) | zh_CN.UTF-8 | Chinese_China.936 | CP936 |
zh_tw_utf8 | Chinese (Traditional) | zh_TW.UTF-8 | Chinese_Taiwan.950 | CP950 |
cs_utf8 | Czech | cs_CZ.UTF-8 | Czech_Czech Republic.1250 | WINDOWS-1250 |
da_utf8 | Danish | da_DK.UTF-8 | Danish_Denmark.1252 | WINDOWS-1252 |
nl_utf8 | Dutch | nl_NL.UTF-8 | Dutch_Netherlands.1252 | WINDOWS-1252 |
en_utf8 | English | en.UTF-8 | English_Australia.1252 | -empty string- |
en_us_utf8 | English (US) | -parent en_utf8 used- | -parent en_utf8 used- | -parent en_utf8 used- |
et_utf8 | Estonian | et_EE.UTF-8 | Estonian_Estonia.1257 | WINDOWS-1257 |
fa_utf8 | Farsi | fa_IR.UTF-8 | Farsi_Iran.1256 | WINDOWS-1256 |
fil_utf8 | Filipino | fil_PH.UTF-8 | Filipino_Philippines.1252 | WINDOWS-1252 |
fi_utf8 | Finnish | fi_FI.UTF-8 | Finnish_Finland.1252 | WINDOWS-1252 |
fr_utf8 | French | fr_FR.UTF-8 or fr_CH.UTF-8 or fr_BE.UTF-8 |
French_France.1252 | WINDOWS-1252 |
fr_ca_utf8 | French (Canada) | fr_CA.UTF-8 | French_Canada.1252 | -parent fr_utf8 used- |
ga_utf8 | Gaelic | ga.UTF-8 | Gaelic; Scottish Gaelic | WINDOWS-1252 |
gl_utf8 | Gallego | gl_ES.UTF-8 | Galician_Spain.1252 | WINDOWS-1252 |
ka_utf8 | Georgian | ka_GE.UTF-8 | Georgian_Georgia.65001 | -empty string- |
de_utf8 | German | de_DE.UTF-8 | German_Germany.1252 | WINDOWS-1252 |
de_du_utf8 | German (Personal) | de_DE.UTF-8 | -parent de_utf8 used- | -parent de_utf8 used- |
el_utf8 | Greek | el_GR.UTF-8 | Greek_Greece.1253 | WINDOWS-1253 |
gu_utf8 | Gujarati | gu.UTF-8 | Gujarati_India.0 | |
he_utf8 | Hebrew | he_IL.utf8 | Hebrew_Israel.1255 | WINDOWS-1255 |
hi_utf8 | Hindi | hi_IN.UTF-8 | Hindi.65001 | -empty string- |
hu_utf8 | Hungarian | hu.UTF-8 | Hungarian_Hungary.1250 | WINDOWS-1250 |
is_utf8 | Icelandic | is_IS.UTF-8 | Icelandic_Iceland.1252 | WINDOWS-1252 |
id_utf8 | Indonesian | id_ID.UTF-8 | Indonesian_indonesia.1252 | WINDOWS-1252 |
it_utf8 | Italian | it_IT.UTF-8 | Italian_Italy.1252 | WINDOWS-1252 |
ja_utf8 | Japanese | ja_JP.UTF-8 | Japanese_Japan.932 | CP932 |
kn_utf8 | Kannada | kn_IN.UTF-8 | Kannada.65001 | -empty string- |
km_utf8 | Khmer | km_KH.UTF-8 | Khmer.65001 | -empty string- |
ko_utf8 | Korean | ko_KR.UTF-8 | Korean_Korea.949 | EUC-KR |
lo_utf8 | Lao | lo_LA.UTF-8 | Lao_Laos.UTF-8 | WINDOWS-1257 |
lt_utf8 | Lithuanian | lt_LT.UTF-8 | Lithuanian_Lithuania.1257 | WINDOWS-1257 |
lv_utf8 | Latvian | lat.UTF-8 | Latvian_Latvia.1257 | WINDOWS-1257 |
ml_utf8 | Malayalam | ml_IN.UTF-8 | Malayalam_India.x-iscii-ma | x-iscii-ma |
ms_utf8 | Malaysian | ms_MY.UTF-8 | Malay_malaysia.1252 | WINDOWS-1252 |
mi_tn_utf8 | Maori (Ngai Tahu) | mi_NZ.UTF-8 | Maori.1252 | WINDOWS-1252 |
mi_wwow_utf8 | Maori (Waikoto Uni) | mi_NZ.UTF-8 | Maori.1252 | WINDOWS-1252 |
mn_utf8 | Mongolian | mn.UTF-8 | Cyrillic_Mongolian.1251 | |
no_utf8 | Norwegian | no_NO.UTF-8 | Norwegian_Norway.1252 | WINDOWS-1252 |
no_gr_utf8 | Norwegian (Primary) | no_NO.UTF-8 | -parent no_utf8 used- | -parent no_utf8 used- |
nn_utf8 | Nynorsk | nn_NO.UTF-8 | Norwegian-Nynorsk_Norway.1252 | WINDOWS-1252 |
pl_utf8 | Polish | pl.UTF-8 | Polish_Poland.1250 | WINDOWS-1250 |
pt_utf8 | Portuguese | pt_PT.UTF-8 | Portuguese_Portugal.1252 | WINDOWS-1252 |
pt_br_utf8 | Portuguese (Brazil) | pt_BR.UTF-8 | Portuguese_Brazil.1252 | WINDOWS-1252 |
ro_utf8 | Romanian | ro_RO.UTF-8 | Romanian_Romania.1250 | WINDOWS-1250 |
ru_utf8 | Russian | ru_RU.UTF-8 | Russian_Russia.1251 | WINDOWS-1251 |
sm_utf8 | Samoan | mi_NZ.UTF-8 | Maori.1252 | WINDOWS-1252 |
sr_utf8 | Serbian | sr_CS.UTF-8 | Bosnian(Cyrillic), Serbian (Cyrillic) | WINDOWS-1251 |
sk_utf8 | Slovak | sk_SK.UTF-8 | Slovak_Slovakia.1250 | WINDOWS-1250 |
sl_utf8 | Slovenian | sl_SI.UTF-8 | Slovenian_Slovenia.1250 | WINDOWS-1250 |
so_utf8 | Somali | so_SO.UTF-8 | not found! | not found! |
es_utf8 | Spanish (International) | es_ES.UTF-8 | Spanish_Spain.1252 | WINDOWS-1252 |
sv_utf8 | Swedish | sv_SE.UTF-8 | Swedish_Sweden.1252 | WINDOWS-1252 |
tl_utf8 | Tagalog | tl.UTF-8 | not found! | not found! |
ta_utf8 | Tamil | ta_IN.UTF-8 | English_Australia.1252 | |
th_utf8 | Thai | th_TH.UTF-8 | Thai_Thailand.874 | WINDOWS-874 |
to_utf8 | Tongan | mi_NZ.UTF-8' | Maori.1252 | WINDOWS-1252 |
tr_utf8 | Turkish | tr_TR.UTF-8 | Turkish_Turkey.1254 | WINDOWS-1254 |
uk_utf8 | Ukrainian | uk_UA.UTF-8 | Ukrainian_Ukraine.1251 | WINDOWS-1251 |
vi_utf8 | Vietnamese | vi_VN.UTF-8 | Vietnamese_Viet Nam.1258 | WINDOWS-1258 |
Note: Some locales for windows in red could be incorrect (technically or geographically but they are the only way I've found to show dates properly in my XP box). Also some other coloured cells must be revised because they are not working.
References
Windows
- Win32 Language names: http://msdn.microsoft.com/en-us/library/dd318693.aspx
- Win32 Country names: http://msdn.microsoft.com/en-us/library/cdax410z.aspx
- Win32 Codepage codes: http://www.microsoft.com/globaldev/reference/wincp.mspx
- Win32 NLS Reference: http://msdn.microsoft.com/es-es/goglobal/bb896001.aspx
- Languages and codepages: http://www.science.co.il/Language/Locale-Codes.asp
- More languages and codepages: http://code.cside.com/3rdpage/windows/
- Languages and locales: http://www.livio.net/main/charset.asp
- Table of language identifiers: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_238z.asp
Unix
- Unix Language names: http://www.loc.gov/standards/iso639-2/englangn.html (639-2 is used only if 639-1 doesn't exist, see the "Locale Name Guide" below).
- Unix Country names: http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html
- Unix Charset codes: http://www.w3.org/International/O-charset-list.html
- More locales: http://search.cpan.org/~drolsky/DateTime-Locale-0.42/lib/DateTime/Locale/Catalog.pm
Other Information
- List of locales supported on Moodle community servers
- Locale Name Guide: http://openi18n.org/docs/text/LocNameGuide-V10.txt
- FAQ about ISO 639: http://www.loc.gov/standards/iso639-2/faq.html
- One initiative from Unicode: http://www.unicode.org/cldr/index.html
- Weekdays and Months: http://www.domesticat.net/misc/monthsdays.php