2007-09-15 02:21:51 +02:00
|
|
|
|
<?php
|
2011-11-26 14:34:11 +01:00
|
|
|
|
require_once 'Zend/Translate.php';
|
|
|
|
|
require_once 'i18nRailsYamlAdapter.php';
|
2012-04-15 16:46:30 +02:00
|
|
|
|
require_once 'i18nSSLegacyAdapter.php';
|
2011-11-26 14:34:11 +01:00
|
|
|
|
|
2007-09-15 02:21:51 +02:00
|
|
|
|
/**
|
2007-10-21 21:31:30 +02:00
|
|
|
|
* Base-class for storage and retrieval of translated entities.
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2011-03-22 09:30:34 +01:00
|
|
|
|
* Please see the 'translatable' module for managing translations of database-content.
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2010-10-15 03:27:01 +02:00
|
|
|
|
* <b>Usage</b>
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2010-10-15 03:27:01 +02:00
|
|
|
|
* PHP:
|
2008-11-06 03:50:14 +01:00
|
|
|
|
* <code>
|
|
|
|
|
* _t('MyNamespace.MYENTITY', 'My default natural language value');
|
2012-04-14 00:16:22 +02:00
|
|
|
|
* _t('MyNamespace.MYENTITY', 'My default natural language value', 'My explanatory context');
|
2008-11-06 03:50:14 +01:00
|
|
|
|
* sprintf(_t('MyNamespace.MYENTITY', 'Counting %s things'), 42);
|
|
|
|
|
* </code>
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2010-10-15 03:27:01 +02:00
|
|
|
|
* Templates:
|
2008-11-06 03:50:14 +01:00
|
|
|
|
* <code>
|
2015-07-22 14:51:34 +02:00
|
|
|
|
* <%t MyNamespace.MYENTITY 'My default natural language value' %>
|
|
|
|
|
* <%t MyNamespace.MYENTITY 'Counting %s things' s=$ThingsCount %>
|
|
|
|
|
* <%t MyNamespace.MYENTITY 'Counting {count} things' count=$ThingsCount %>
|
2008-11-06 03:50:14 +01:00
|
|
|
|
* </code>
|
|
|
|
|
*
|
2012-03-24 04:38:57 +01:00
|
|
|
|
* Javascript (see framework/javascript/i18n.js):
|
2008-11-06 03:50:14 +01:00
|
|
|
|
* <code>
|
|
|
|
|
* ss.i18n._t('MyEntity.MyNamespace','My default natural language value');
|
|
|
|
|
* </code>
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2007-10-21 21:31:30 +02:00
|
|
|
|
* File-based i18n-translations always have a "locale" (e.g. 'en_US').
|
2011-03-22 09:30:34 +01:00
|
|
|
|
* Common language names (e.g. 'en') are mainly used in the 'translatable' module
|
2007-10-21 21:31:30 +02:00
|
|
|
|
* database-entities.
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2010-10-15 03:27:01 +02:00
|
|
|
|
* <b>Text Collection</b>
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2007-10-21 21:31:30 +02:00
|
|
|
|
* Features a "textcollector-mode" that parses all files with a certain extension
|
|
|
|
|
* (currently *.php and *.ss) for new translatable strings. Textcollector will write
|
|
|
|
|
* updated string-tables to their respective folders inside the module, and automatically
|
|
|
|
|
* namespace entities to the classes/templates they are found in (e.g. $lang['en_US']['AssetAdmin']['UPLOADFILES']).
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2007-10-21 21:31:30 +02:00
|
|
|
|
* Caution: Does not apply any character-set conversion, it is assumed that all content
|
|
|
|
|
* is stored and represented in UTF-8 (Unicode). Please make sure your files are created with the correct
|
|
|
|
|
* character-set, and your HTML-templates render UTF-8.
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2008-10-10 19:36:31 +02:00
|
|
|
|
* Caution: The language file has to be stored in the same module path as the "filename namespaces"
|
|
|
|
|
* on the entities. So an entity stored in $lang['en_US']['AssetAdmin']['DETAILSTAB'] has to
|
|
|
|
|
* in the language file cms/lang/en_US.php, as the referenced file (AssetAdmin.php) is stored
|
|
|
|
|
* in the "cms" module.
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2010-10-15 03:27:01 +02:00
|
|
|
|
* <b>Locales</b>
|
2007-09-15 02:21:51 +02:00
|
|
|
|
*
|
2014-08-04 22:26:22 +02:00
|
|
|
|
* For the i18n class, a "locale" consists of a language code plus a region code separated by an underscore,
|
2009-04-30 04:51:17 +02:00
|
|
|
|
* for example "de_AT" for German language ("de") in the region Austria ("AT").
|
|
|
|
|
* See http://www.w3.org/International/articles/language-tags/ for a detailed description.
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2010-10-15 03:27:01 +02:00
|
|
|
|
* @see http://doc.silverstripe.org/i18n
|
2008-10-03 02:47:35 +02:00
|
|
|
|
* @see http://www.w3.org/TR/i18n-html-tech-lang
|
|
|
|
|
*
|
2007-09-15 02:21:51 +02:00
|
|
|
|
* @author Bernat Foj Capell <bernat@silverstripe.com>
|
2012-04-12 08:02:46 +02:00
|
|
|
|
* @package framework
|
2008-02-25 03:10:37 +01:00
|
|
|
|
* @subpackage misc
|
2007-09-15 02:21:51 +02:00
|
|
|
|
*/
|
2017-11-30 18:49:46 +01:00
|
|
|
|
class i18n extends SS_Object implements TemplateGlobalProvider, Flushable {
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2007-09-15 02:21:51 +02:00
|
|
|
|
/**
|
2007-10-21 02:50:31 +02:00
|
|
|
|
* This static variable is used to store the current defined locale.
|
2007-09-15 02:21:51 +02:00
|
|
|
|
*/
|
2007-10-21 02:50:31 +02:00
|
|
|
|
protected static $current_locale = '';
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2007-09-26 00:14:48 +02:00
|
|
|
|
/**
|
2013-03-21 19:48:54 +01:00
|
|
|
|
* @config
|
2007-09-26 00:14:48 +02:00
|
|
|
|
* @var string
|
|
|
|
|
*/
|
2013-03-21 19:48:54 +01:00
|
|
|
|
private static $default_locale = 'en_US';
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2009-03-10 23:08:52 +01:00
|
|
|
|
/**
|
2013-03-21 19:48:54 +01:00
|
|
|
|
* @config
|
2009-03-10 23:08:52 +01:00
|
|
|
|
* @var boolean
|
|
|
|
|
*/
|
2013-03-21 19:48:54 +01:00
|
|
|
|
private static $js_i18n = true;
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2010-10-15 05:23:02 +02:00
|
|
|
|
/**
|
2013-03-21 19:48:54 +01:00
|
|
|
|
* @config
|
2010-10-15 05:23:02 +02:00
|
|
|
|
* @var string
|
|
|
|
|
*/
|
2014-02-11 12:12:37 +01:00
|
|
|
|
private static $date_format = 'yyyy-MM-dd';
|
2014-08-15 08:53:05 +02:00
|
|
|
|
|
2010-10-15 05:23:02 +02:00
|
|
|
|
/**
|
2013-03-21 19:48:54 +01:00
|
|
|
|
* @config
|
2010-10-15 05:23:02 +02:00
|
|
|
|
* @var string
|
|
|
|
|
*/
|
2014-02-11 12:12:37 +01:00
|
|
|
|
private static $time_format = 'H:mm';
|
2014-08-15 08:53:05 +02:00
|
|
|
|
|
2011-11-26 14:34:11 +01:00
|
|
|
|
/**
|
|
|
|
|
* @var array Array of priority keys to instances of Zend_Translate, mapped by name.
|
|
|
|
|
*/
|
|
|
|
|
protected static $translators;
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2014-08-16 02:51:17 +02:00
|
|
|
|
/**
|
|
|
|
|
* Triggered early in the request when someone requests a flush.
|
|
|
|
|
*/
|
|
|
|
|
public static function flush() {
|
2014-10-15 12:25:02 +02:00
|
|
|
|
$cache = self::get_cache();
|
|
|
|
|
$backend = $cache->getBackend();
|
|
|
|
|
|
|
|
|
|
if(
|
|
|
|
|
$backend instanceof Zend_Cache_Backend_ExtendedInterface
|
|
|
|
|
&& ($capabilities = $backend->getCapabilities())
|
|
|
|
|
&& $capabilities['tags']
|
|
|
|
|
) {
|
|
|
|
|
$cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, $cache->getTags());
|
|
|
|
|
} else {
|
|
|
|
|
$cache->clean(Zend_Cache::CLEANING_MODE_ALL);
|
|
|
|
|
}
|
2014-08-16 02:51:17 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return an instance of the cache used for i18n data.
|
|
|
|
|
* @return Zend_Cache
|
|
|
|
|
*/
|
|
|
|
|
public static function get_cache() {
|
2018-06-01 01:05:03 +02:00
|
|
|
|
return SS_Cache::factory(
|
|
|
|
|
'i18n',
|
|
|
|
|
'Output',
|
|
|
|
|
array(
|
|
|
|
|
'lifetime' => null,
|
|
|
|
|
'automatic_serialization' => true,
|
|
|
|
|
'disable-segmentation' => true,
|
|
|
|
|
)
|
|
|
|
|
);
|
2014-08-16 02:51:17 +02:00
|
|
|
|
}
|
|
|
|
|
|
2009-03-10 23:08:52 +01:00
|
|
|
|
/**
|
|
|
|
|
* Use javascript i18n through the ss.i18n class (enabled by default).
|
|
|
|
|
* If set to TRUE, includes javascript requirements for the base library
|
2012-03-24 04:38:57 +01:00
|
|
|
|
* (framework/javascript/i18n.js) and all necessary lang files (e.g. framework/lang/de_DE.js)
|
|
|
|
|
* plus fallbacks to the default locale (e.g. framework/lang/en_US.js).
|
2009-03-10 23:08:52 +01:00
|
|
|
|
* If set to FALSE, only includes a stub implementation
|
|
|
|
|
* which is necessary. Mainly disabled to save bandwidth
|
|
|
|
|
* in a frontend context when website is in single language.
|
|
|
|
|
*
|
|
|
|
|
* Caution: This flag gets overwritten in {@link LeftAndMain::init()} to enforce javascript
|
|
|
|
|
* i18n for the CMS interfaces.
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
|
|
|
|
* @see Requirements::process_i18n_javascript()
|
2009-03-10 23:08:52 +01:00
|
|
|
|
*
|
2015-06-19 01:59:27 +02:00
|
|
|
|
* @deprecated 4.0 Use the "i18n.js_i18n" config setting instead
|
2009-03-10 23:08:52 +01:00
|
|
|
|
* @param bool $bool
|
|
|
|
|
*/
|
|
|
|
|
public static function set_js_i18n($bool) {
|
2015-06-19 01:59:27 +02:00
|
|
|
|
Deprecation::notice('4.0', 'Use the "i18n.js_i18n" config setting instead');
|
2013-03-21 19:48:54 +01:00
|
|
|
|
Config::inst()->update('i18n', 'js_i18n', $bool);
|
2009-03-10 23:08:52 +01:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2009-03-10 23:08:52 +01:00
|
|
|
|
/**
|
2015-06-19 01:59:27 +02:00
|
|
|
|
* @deprecated 4.0 Use the "i18n.js_i18n" config setting instead
|
2009-03-10 23:08:52 +01:00
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public static function get_js_i18n() {
|
2015-06-19 01:59:27 +02:00
|
|
|
|
Deprecation::notice('4.0', 'Use the "i18n.js_i18n" config setting instead');
|
2013-03-27 20:42:46 +01:00
|
|
|
|
return Config::inst()->get('i18n', 'js_i18n');
|
2009-03-10 23:08:52 +01:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2010-10-15 05:23:02 +02:00
|
|
|
|
/**
|
2015-06-19 01:59:27 +02:00
|
|
|
|
* @deprecated 4.0 Use the "i18n.date_format" config setting instead
|
2010-10-15 05:23:02 +02:00
|
|
|
|
* @param string ISO date format
|
|
|
|
|
*/
|
|
|
|
|
public static function set_date_format($format) {
|
2015-06-19 01:59:27 +02:00
|
|
|
|
Deprecation::notice('4.0', 'Use the "i18n.date_format" config setting instead');
|
2013-03-21 19:48:54 +01:00
|
|
|
|
Config::inst()->update('i18n', 'date_format', $format);
|
2010-10-15 05:23:02 +02:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2010-10-15 05:23:02 +02:00
|
|
|
|
/**
|
2015-06-19 01:59:27 +02:00
|
|
|
|
* @deprecated since version 4.0
|
2010-10-15 05:23:02 +02:00
|
|
|
|
* @return string ISO date format
|
|
|
|
|
*/
|
|
|
|
|
public static function get_date_format() {
|
2015-06-19 01:59:27 +02:00
|
|
|
|
Deprecation::notice('4.0', 'Use the "i18n.date_format" config setting instead');
|
2014-02-11 12:12:37 +01:00
|
|
|
|
return Config::inst()->get('i18n', 'date_format');
|
2010-10-15 05:23:02 +02:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2010-10-15 05:23:02 +02:00
|
|
|
|
/**
|
2015-06-19 01:59:27 +02:00
|
|
|
|
* @deprecated 4.0 Use the "i18n.time_format" config setting instead
|
2010-10-15 05:23:02 +02:00
|
|
|
|
* @param string ISO time format
|
|
|
|
|
*/
|
|
|
|
|
public static function set_time_format($format) {
|
2015-06-19 01:59:27 +02:00
|
|
|
|
Deprecation::notice('4.0', 'Use the "i18n.time_format" config setting instead');
|
2013-03-21 19:48:54 +01:00
|
|
|
|
Config::inst()->update('i18n', 'time_format', $format);
|
2010-10-15 05:23:02 +02:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2010-10-15 05:23:02 +02:00
|
|
|
|
/**
|
2015-06-19 01:59:27 +02:00
|
|
|
|
* @deprecated since version 4.0
|
2010-10-15 05:23:02 +02:00
|
|
|
|
* @return string ISO time format
|
|
|
|
|
*/
|
|
|
|
|
public static function get_time_format() {
|
2015-06-19 01:59:27 +02:00
|
|
|
|
Deprecation::notice('4.0', 'Use the "i18n.time_format" config setting instead');
|
2014-02-11 12:12:37 +01:00
|
|
|
|
return Config::inst()->get('i18n', 'time_format');
|
2010-10-15 05:23:02 +02:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2007-09-15 02:21:51 +02:00
|
|
|
|
/**
|
2007-09-16 18:16:58 +02:00
|
|
|
|
* An exhaustive list of possible locales (code => language and country)
|
|
|
|
|
*
|
2013-03-21 19:48:54 +01:00
|
|
|
|
* @config
|
2007-09-16 18:16:58 +02:00
|
|
|
|
* @var array
|
|
|
|
|
*/
|
2013-03-21 19:48:54 +01:00
|
|
|
|
private static $all_locales = array (
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'aa_DJ' => 'Afar (Djibouti)',
|
|
|
|
|
'ab_GE' => 'Abkhazian (Georgia)',
|
|
|
|
|
'abr_GH' => 'Abron (Ghana)',
|
|
|
|
|
'ace_ID' => 'Achinese (Indonesia)',
|
|
|
|
|
'ady_RU' => 'Adyghe (Russia)',
|
|
|
|
|
'af_ZA' => 'Afrikaans (South Africa)',
|
|
|
|
|
'ak_GH' => 'Akan (Ghana)',
|
|
|
|
|
'am_ET' => 'Amharic (Ethiopia)',
|
|
|
|
|
'ar_AE' => 'Arabic (United Arab Emirates)',
|
|
|
|
|
'ar_BH' => 'Arabic (Bahrain)',
|
|
|
|
|
'ar_DZ' => 'Arabic (Algeria)',
|
|
|
|
|
'ar_EG' => 'Arabic (Egypt)',
|
|
|
|
|
'ar_EH' => 'Arabic (Western Sahara)',
|
|
|
|
|
'ar_IQ' => 'Arabic (Iraq)',
|
|
|
|
|
'ar_JO' => 'Arabic (Jordan)',
|
|
|
|
|
'ar_KW' => 'Arabic (Kuwait)',
|
|
|
|
|
'ar_LB' => 'Arabic (Lebanon)',
|
|
|
|
|
'ar_LY' => 'Arabic (Libya)',
|
|
|
|
|
'ar_MA' => 'Arabic (Morocco)',
|
|
|
|
|
'ar_MR' => 'Arabic (Mauritania)',
|
|
|
|
|
'ar_OM' => 'Arabic (Oman)',
|
|
|
|
|
'ar_PS' => 'Arabic (Palestinian Territory)',
|
|
|
|
|
'ar_QA' => 'Arabic (Qatar)',
|
|
|
|
|
'ar_SA' => 'Arabic (Saudi Arabia)',
|
|
|
|
|
'ar_SD' => 'Arabic (Sudan)',
|
|
|
|
|
'ar_SY' => 'Arabic (Syria)',
|
|
|
|
|
'ar_TD' => 'Arabic (Chad)',
|
|
|
|
|
'ar_TN' => 'Arabic (Tunisia)',
|
|
|
|
|
'ar_YE' => 'Arabic (Yemen)',
|
|
|
|
|
'as_IN' => 'Assamese (India)',
|
|
|
|
|
'ast_ES' => 'Asturian (Spain)',
|
|
|
|
|
'auv_FR' => 'Auvergnat (France)',
|
|
|
|
|
'av_RU' => 'Avaric (Russia)',
|
|
|
|
|
'awa_IN' => 'Awadhi (India)',
|
|
|
|
|
'ay_BO' => 'Aymara (Bolivia)',
|
|
|
|
|
'ay_PE' => 'Aymara (Peru)',
|
|
|
|
|
'az_AZ' => 'Azerbaijani (Azerbaijan)',
|
|
|
|
|
'az_IR' => 'Azerbaijani (Iran)',
|
|
|
|
|
'ba_RU' => 'Bashkir (Russia)',
|
|
|
|
|
'ban_ID' => 'Balinese (Indonesia)',
|
|
|
|
|
'bcc_PK' => 'Balochi, Southern (Pakistan)',
|
|
|
|
|
'bcl_PH' => 'Bicolano, Central (Philippines)',
|
|
|
|
|
'be_BY' => 'Belarusian (Belarus)',
|
|
|
|
|
'bew_ID' => 'Betawi (Indonesia)',
|
|
|
|
|
'bg_BG' => 'Bulgarian (Bulgaria)',
|
|
|
|
|
'bgc_IN' => 'Haryanvi (India)',
|
|
|
|
|
'bgn_PK' => 'Balochi, Western (Pakistan)',
|
|
|
|
|
'bgp_PK' => 'Balochi, Easter (Pakistan)',
|
|
|
|
|
'bhb_IN' => 'Bhili (India)',
|
|
|
|
|
'bhi_IN' => 'Bhilali (India)',
|
|
|
|
|
'bhk_PH' => 'Bicolano, Albay (Philippines)',
|
|
|
|
|
'bho_IN' => 'Bhojpuri (India)',
|
|
|
|
|
'bho_MU' => 'Bhojpuri (Mauritius)',
|
|
|
|
|
'bho_NP' => 'Bhojpuri (Nepal)',
|
|
|
|
|
'bi_VU' => 'Bislama (Vanuatu)',
|
|
|
|
|
'bjj_IN' => 'Kanauji (India)',
|
|
|
|
|
'bjn_ID' => 'Banjar (Indonesia)',
|
|
|
|
|
'bm_ML' => 'Bambara (Mali)',
|
|
|
|
|
'bn_BD' => 'Bengali (Bangladesh)',
|
|
|
|
|
'bn_IN' => 'Bengali (India)',
|
|
|
|
|
'bo_CN' => 'Tibetan (China)',
|
|
|
|
|
'bqi_IR' => 'Bakhtiari (Iran)',
|
|
|
|
|
'brh_PK' => 'Brahui (Pakistan)',
|
|
|
|
|
'bs_BA' => 'Bosnian (Bosnia and Herzegovina)',
|
|
|
|
|
'btk_ID' => 'Batak (Indonesia)',
|
|
|
|
|
'buc_YT' => 'Bushi (Mayotte)',
|
|
|
|
|
'bug_ID' => 'Buginese (Indonesia)',
|
|
|
|
|
'ca_AD' => 'Catalan (Andorra)',
|
|
|
|
|
'ca_ES' => 'Catalan (Spain)',
|
|
|
|
|
'ce_RU' => 'Chechen (Russia)',
|
|
|
|
|
'ceb_PH' => 'Cebuano (Philippines)',
|
|
|
|
|
'cgg_UG' => 'Chiga (Uganda)',
|
|
|
|
|
'ch_GU' => 'Chamorro (Guam)',
|
|
|
|
|
'chk_FM' => 'Chuukese (Micronesia)',
|
|
|
|
|
'crk_CA' => 'Cree, Plains (Canada)',
|
|
|
|
|
'cs_CZ' => 'Czech (Czech Republic)',
|
|
|
|
|
'cwd_CA' => 'Cree, Woods (Canada)',
|
|
|
|
|
'cy_GB' => 'Welsh (United Kingdom)',
|
|
|
|
|
'da_DK' => 'Danish (Denmark)',
|
|
|
|
|
'da_GL' => 'Danish (Greenland)',
|
|
|
|
|
'dcc_IN' => 'Deccan (India)',
|
|
|
|
|
'de_AT' => 'German (Austria)',
|
|
|
|
|
'de_BE' => 'German (Belgium)',
|
|
|
|
|
'de_CH' => 'German (Switzerland)',
|
|
|
|
|
'de_DE' => 'German (Germany)',
|
|
|
|
|
'de_LI' => 'German (Liechtenstein)',
|
|
|
|
|
'de_LU' => 'German (Luxembourg)',
|
|
|
|
|
'dgo_IN' => 'Dogri (India)',
|
|
|
|
|
'dhd_IN' => 'Dhundari (India)',
|
|
|
|
|
'diq_TR' => 'Dimli (Turkey)',
|
|
|
|
|
'dje_NE' => 'Zarma (Niger)',
|
|
|
|
|
'dv_MV' => 'Divehi (Maldives)',
|
|
|
|
|
'dz_BT' => 'Dzongkha (Bhutan)',
|
|
|
|
|
'ee_GH' => 'Ewe (Ghana)',
|
|
|
|
|
'el_CY' => 'Greek (Cyprus)',
|
|
|
|
|
'el_GR' => 'Greek (Greece)',
|
|
|
|
|
'en_AS' => 'English (American Samoa)',
|
|
|
|
|
'en_AU' => 'English (Australia)',
|
|
|
|
|
'en_BM' => 'English (Bermuda)',
|
|
|
|
|
'en_BS' => 'English (Bahamas)',
|
|
|
|
|
'en_CA' => 'English (Canada)',
|
|
|
|
|
'en_DE' => 'English (Germany)',
|
|
|
|
|
'en_ES' => 'English (Spain)',
|
|
|
|
|
'en_FR' => 'English (France)',
|
|
|
|
|
'en_GB' => 'English (United Kingdom)',
|
|
|
|
|
'en_HK' => 'English (Hong Kong SAR China)',
|
|
|
|
|
'en_IE' => 'English (Ireland)',
|
|
|
|
|
'en_IN' => 'English (India)',
|
|
|
|
|
'en_IT' => 'English (Italy)',
|
|
|
|
|
'en_JM' => 'English (Jamaica)',
|
|
|
|
|
'en_KE' => 'English (Kenya)',
|
|
|
|
|
'en_LR' => 'English (Liberia)',
|
|
|
|
|
'en_MM' => 'English (Myanmar)',
|
|
|
|
|
'en_MW' => 'English (Malawi)',
|
|
|
|
|
'en_MY' => 'English (Malaysia)',
|
|
|
|
|
'en_NL' => 'English (Netherlands)',
|
|
|
|
|
'en_NZ' => 'English (New Zealand)',
|
|
|
|
|
'en_PH' => 'English (Philippines)',
|
|
|
|
|
'en_SG' => 'English (Singapore)',
|
|
|
|
|
'en_TT' => 'English (Trinidad and Tobago)',
|
|
|
|
|
'en_US' => 'English (United States)',
|
|
|
|
|
'en_ZA' => 'English (South Africa)',
|
|
|
|
|
'eo_XX' => 'Esperanto',
|
|
|
|
|
'es_419' => 'Spanish (Latin America)',
|
|
|
|
|
'es_AR' => 'Spanish (Argentina)',
|
|
|
|
|
'es_BO' => 'Spanish (Bolivia)',
|
|
|
|
|
'es_CL' => 'Spanish (Chile)',
|
|
|
|
|
'es_CO' => 'Spanish (Colombia)',
|
|
|
|
|
'es_CR' => 'Spanish (Costa Rica)',
|
|
|
|
|
'es_CU' => 'Spanish (Cuba)',
|
|
|
|
|
'es_DO' => 'Spanish (Dominican Republic)',
|
|
|
|
|
'es_EC' => 'Spanish (Ecuador)',
|
|
|
|
|
'es_ES' => 'Spanish (Spain)',
|
|
|
|
|
'es_GQ' => 'Spanish (Equatorial Guinea)',
|
|
|
|
|
'es_GT' => 'Spanish (Guatemala)',
|
|
|
|
|
'es_HN' => 'Spanish (Honduras)',
|
|
|
|
|
'es_MX' => 'Spanish (Mexico)',
|
|
|
|
|
'es_NI' => 'Spanish (Nicaragua)',
|
|
|
|
|
'es_PA' => 'Spanish (Panama)',
|
|
|
|
|
'es_PE' => 'Spanish (Peru)',
|
|
|
|
|
'es_PH' => 'Spanish (Philippines)',
|
|
|
|
|
'es_PR' => 'Spanish (Puerto Rico)',
|
|
|
|
|
'es_PY' => 'Spanish (Paraguay)',
|
|
|
|
|
'es_SV' => 'Spanish (El Salvador)',
|
|
|
|
|
'es_US' => 'Spanish (United States)',
|
|
|
|
|
'es_UY' => 'Spanish (Uruguay)',
|
|
|
|
|
'es_VE' => 'Spanish (Venezuela)',
|
|
|
|
|
'et_EE' => 'Estonian (Estonia)',
|
|
|
|
|
'eu_ES' => 'Basque (Spain)',
|
|
|
|
|
'fa_AF' => 'Persian (Afghanistan)',
|
|
|
|
|
'fa_IR' => 'Persian (Iran)',
|
|
|
|
|
'fa_PK' => 'Persian (Pakistan)',
|
|
|
|
|
'fan_GQ' => 'Fang (Equatorial Guinea)',
|
|
|
|
|
'fi_FI' => 'Finnish (Finland)',
|
|
|
|
|
'fi_SE' => 'Finnish (Sweden)',
|
|
|
|
|
'fil_PH' => 'Filipino (Philippines)',
|
|
|
|
|
'fj_FJ' => 'Fijian (Fiji)',
|
|
|
|
|
'fo_FO' => 'Faroese (Faroe Islands)',
|
|
|
|
|
'fon_BJ' => 'Fon (Benin)',
|
|
|
|
|
'fr_002' => 'French (Africa)',
|
|
|
|
|
'fr_BE' => 'French (Belgium)',
|
|
|
|
|
'fr_CA' => 'French (Canada)',
|
|
|
|
|
'fr_CH' => 'French (Switzerland)',
|
|
|
|
|
'fr_DZ' => 'French (Algeria)',
|
|
|
|
|
'fr_FR' => 'French (France)',
|
|
|
|
|
'fr_GF' => 'French (French Guiana)',
|
|
|
|
|
'fr_GP' => 'French (Guadeloupe)',
|
|
|
|
|
'fr_HT' => 'French (Haiti)',
|
|
|
|
|
'fr_KM' => 'French (Comoros)',
|
|
|
|
|
'fr_MA' => 'French (Morocco)',
|
|
|
|
|
'fr_MQ' => 'French (Martinique)',
|
|
|
|
|
'fr_MU' => 'French (Mauritius)',
|
|
|
|
|
'fr_NC' => 'French (New Caledonia)',
|
|
|
|
|
'fr_PF' => 'French (French Polynesia)',
|
|
|
|
|
'fr_PM' => 'French (Saint Pierre and Miquelon)',
|
|
|
|
|
'fr_RE' => 'French (Reunion)',
|
|
|
|
|
'fr_SC' => 'French (Seychelles)',
|
|
|
|
|
'fr_SN' => 'French (Senegal)',
|
|
|
|
|
'fr_US' => 'French (United States)',
|
|
|
|
|
'fuv_NG' => 'Fulfulde (Nigeria)',
|
|
|
|
|
'ga_GB' => 'Irish (United Kingdom)',
|
|
|
|
|
'ga_IE' => 'Irish (Ireland)',
|
|
|
|
|
'gaa_GH' => 'Ga (Ghana)',
|
|
|
|
|
'gbm_IN' => 'Garhwali (India)',
|
|
|
|
|
'gcr_GF' => 'Guianese Creole French (French Guiana)',
|
|
|
|
|
'gd_GB' => 'Scottish Gaelic (United Kingdom)',
|
|
|
|
|
'gil_KI' => 'Gilbertese (Kiribati)',
|
|
|
|
|
'gl_ES' => 'Galician (Spain)',
|
|
|
|
|
'glk_IR' => 'Gilaki (Iran)',
|
|
|
|
|
'gn_PY' => 'Guarani (Paraguay)',
|
|
|
|
|
'gno_IN' => 'Gondi, Northern (India)',
|
|
|
|
|
'gsw_CH' => 'Swiss German (Switzerland)',
|
|
|
|
|
'gsw_LI' => 'Swiss German (Liechtenstein)',
|
|
|
|
|
'gu_IN' => 'Gujarati (India)',
|
|
|
|
|
'guz_KE' => 'Gusii (Kenya)',
|
|
|
|
|
'ha_NE' => 'Hausa (Niger)',
|
|
|
|
|
'ha_NG' => 'Hausa (Nigeria)',
|
|
|
|
|
'haw_US' => 'Hawaiian (United States)',
|
|
|
|
|
'haz_AF' => 'Hazaragi (Afghanistan)',
|
|
|
|
|
'he_IL' => 'Hebrew (Israel)',
|
|
|
|
|
'hi_IN' => 'Hindi (India)',
|
|
|
|
|
'hil_PH' => 'Hiligaynon (Philippines)',
|
|
|
|
|
'hne_IN' => 'Chhattisgarhi (India)',
|
|
|
|
|
'hno_PK' => 'Hindko, Northern (Pakistan)',
|
|
|
|
|
'hoc_IN' => 'Ho (India)',
|
|
|
|
|
'hr_AT' => 'Croatian (Austria)',
|
|
|
|
|
'hr_BA' => 'Croatian (Bosnia and Herzegovina)',
|
|
|
|
|
'hr_HR' => 'Croatian (Croatia)',
|
|
|
|
|
'ht_HT' => 'Haitian (Haiti)',
|
|
|
|
|
'hu_AT' => 'Hungarian (Austria)',
|
|
|
|
|
'hu_HU' => 'Hungarian (Hungary)',
|
|
|
|
|
'hu_RO' => 'Hungarian (Romania)',
|
|
|
|
|
'hu_RS' => 'Hungarian (Serbia)',
|
|
|
|
|
'hy_AM' => 'Armenian (Armenia)',
|
|
|
|
|
'id_ID' => 'Indonesian (Indonesia)',
|
|
|
|
|
'ig_NG' => 'Igbo (Nigeria)',
|
|
|
|
|
'ilo_PH' => 'Iloko (Philippines)',
|
|
|
|
|
'inh_RU' => 'Ingush (Russia)',
|
|
|
|
|
'is_IS' => 'Icelandic (Iceland)',
|
|
|
|
|
'it_CH' => 'Italian (Switzerland)',
|
|
|
|
|
'it_FR' => 'Italian (France)',
|
|
|
|
|
'it_HR' => 'Italian (Croatia)',
|
|
|
|
|
'it_IT' => 'Italian (Italy)',
|
|
|
|
|
'it_SM' => 'Italian (San Marino)',
|
|
|
|
|
'it_US' => 'Italian (United States)',
|
|
|
|
|
'iu_CA' => 'Inuktitut (Canada)',
|
|
|
|
|
'ja_JP' => 'Japanese (Japan)',
|
|
|
|
|
'jv_ID' => 'Javanese (Indonesia)',
|
|
|
|
|
'ka_GE' => 'Georgian (Georgia)',
|
|
|
|
|
'kam_KE' => 'Kamba (Kenya)',
|
|
|
|
|
'kbd_RU' => 'Kabardian (Russia)',
|
|
|
|
|
'kfy_IN' => 'Kumauni (India)',
|
|
|
|
|
'kha_IN' => 'Khasi (India)',
|
|
|
|
|
'khn_IN' => 'Khandesi (India)',
|
|
|
|
|
'ki_KE' => 'Kikuyu (Kenya)',
|
|
|
|
|
'kj_NA' => 'Kuanyama (Namibia)',
|
|
|
|
|
'kk_CN' => 'Kazakh (China)',
|
|
|
|
|
'kk_KZ' => 'Kazakh (Kazakhstan)',
|
|
|
|
|
'kl_DK' => 'Kalaallisut (Denmark)',
|
|
|
|
|
'kl_GL' => 'Kalaallisut (Greenland)',
|
|
|
|
|
'kln_KE' => 'Kalenjin (Kenya)',
|
|
|
|
|
'km_KH' => 'Khmer (Cambodia)',
|
|
|
|
|
'kn_IN' => 'Kannada (India)',
|
|
|
|
|
'ko_KR' => 'Korean (Korea)',
|
|
|
|
|
'koi_RU' => 'Komi-Permyak (Russia)',
|
|
|
|
|
'kok_IN' => 'Konkani (India)',
|
|
|
|
|
'kos_FM' => 'Kosraean (Micronesia)',
|
|
|
|
|
'kpv_RU' => 'Komi-Zyrian (Russia)',
|
|
|
|
|
'krc_RU' => 'Karachay-Balkar (Russia)',
|
|
|
|
|
'kru_IN' => 'Kurukh (India)',
|
|
|
|
|
'ks_IN' => 'Kashmiri (India)',
|
|
|
|
|
'ku_IQ' => 'Kurdish (Iraq)',
|
|
|
|
|
'ku_IR' => 'Kurdish (Iran)',
|
|
|
|
|
'ku_SY' => 'Kurdish (Syria)',
|
|
|
|
|
'ku_TR' => 'Kurdish (Turkey)',
|
|
|
|
|
'kum_RU' => 'Kumyk (Russia)',
|
|
|
|
|
'kxm_TH' => 'Khmer, Northern (Thailand)',
|
|
|
|
|
'ky_KG' => 'Kirghiz (Kyrgyzstan)',
|
|
|
|
|
'la_VA' => 'Latin (Vatican)',
|
|
|
|
|
'lah_PK' => 'Lahnda (Pakistan)',
|
|
|
|
|
'lb_LU' => 'Luxembourgish (Luxembourg)',
|
|
|
|
|
'lbe_RU' => 'Lak (Russia)',
|
|
|
|
|
'lc_XX' => 'LOLCAT',
|
|
|
|
|
'lez_RU' => 'Lezghian (Russia)',
|
|
|
|
|
'lg_UG' => 'Ganda (Uganda)',
|
|
|
|
|
'lij_IT' => 'Ligurian (Italy)',
|
|
|
|
|
'lij_MC' => 'Ligurian (Monaco)',
|
|
|
|
|
'ljp_ID' => 'Lampung (Indonesia)',
|
|
|
|
|
'lmn_IN' => 'Lambadi (India)',
|
|
|
|
|
'ln_CD' => 'Lingala (Congo - Kinshasa)',
|
|
|
|
|
'ln_CG' => 'Lingala (Congo - Brazzaville)',
|
|
|
|
|
'lo_LA' => 'Lao (Laos)',
|
|
|
|
|
'lrc_IR' => 'Luri, Northern (Iran)',
|
|
|
|
|
'lt_LT' => 'Lithuanian (Lithuania)',
|
|
|
|
|
'luo_KE' => 'Luo (Kenya)',
|
|
|
|
|
'luy_KE' => 'Luyia (Kenya)',
|
|
|
|
|
'lv_LV' => 'Latvian (Latvia)',
|
|
|
|
|
'mad_ID' => 'Madurese (Indonesia)',
|
|
|
|
|
'mai_IN' => 'Maithili (India)',
|
|
|
|
|
'mai_NP' => 'Maithili (Nepal)',
|
|
|
|
|
'mak_ID' => 'Makasar (Indonesia)',
|
|
|
|
|
'mdf_RU' => 'Moksha (Russia)',
|
|
|
|
|
'mdh_PH' => 'Maguindanao (Philippines)',
|
|
|
|
|
'mer_KE' => 'Meru (Kenya)',
|
|
|
|
|
'mfa_TH' => 'Malay, Pattani (Thailand)',
|
|
|
|
|
'mfe_MU' => 'Morisyen (Mauritius)',
|
|
|
|
|
'mg_MG' => 'Malagasy (Madagascar)',
|
|
|
|
|
'mh_MH' => 'Marshallese (Marshall Islands)',
|
|
|
|
|
'mi_NZ' => 'te reo Māori (New Zealand)',
|
|
|
|
|
'min_ID' => 'Minangkabau (Indonesia)',
|
|
|
|
|
'mk_MK' => 'Macedonian (Macedonia)',
|
|
|
|
|
'ml_IN' => 'Malayalam (India)',
|
|
|
|
|
'mn_CN' => 'Mongolian (China)',
|
|
|
|
|
'mn_MN' => 'Mongolian (Mongolia)',
|
|
|
|
|
'mni_IN' => 'Manipuri (India)',
|
|
|
|
|
'mr_IN' => 'Marathi (India)',
|
|
|
|
|
'ms_BN' => 'Malay (Brunei)',
|
|
|
|
|
'ms_CC' => 'Malay (Cocos Islands)',
|
|
|
|
|
'ms_ID' => 'Malay (Indonesia)',
|
|
|
|
|
'ms_MY' => 'Malay (Malaysia)',
|
|
|
|
|
'ms_SG' => 'Malay (Singapore)',
|
|
|
|
|
'mt_MT' => 'Maltese (Malta)',
|
|
|
|
|
'mtr_IN' => 'Mewari (India)',
|
|
|
|
|
'mup_IN' => 'Malvi (India)',
|
|
|
|
|
'muw_IN' => 'Mundari (India)',
|
|
|
|
|
'my_MM' => 'Burmese (Myanmar)',
|
|
|
|
|
'myv_RU' => 'Erzya (Russia)',
|
|
|
|
|
'na_NR' => 'Nauru (Nauru)',
|
|
|
|
|
'nb_NO' => 'Norwegian Bokmal (Norway)',
|
|
|
|
|
'nb_SJ' => 'Norwegian Bokmal (Svalbard and Jan Mayen)',
|
|
|
|
|
'nd_ZW' => 'North Ndebele (Zimbabwe)',
|
|
|
|
|
'ndc_MZ' => 'Ndau (Mozambique)',
|
|
|
|
|
'ne_IN' => 'Nepali (India)',
|
|
|
|
|
'ne_NP' => 'Nepali (Nepal)',
|
|
|
|
|
'ng_NA' => 'Ndonga (Namibia)',
|
|
|
|
|
'ngl_MZ' => 'Lomwe (Mozambique)',
|
|
|
|
|
'niu_NU' => 'Niuean (Niue)',
|
|
|
|
|
'nl_AN' => 'Dutch (Netherlands Antilles)',
|
|
|
|
|
'nl_AW' => 'Dutch (Aruba)',
|
|
|
|
|
'nl_BE' => 'Dutch (Belgium)',
|
|
|
|
|
'nl_NL' => 'Dutch (Netherlands)',
|
|
|
|
|
'nl_SR' => 'Dutch (Suriname)',
|
|
|
|
|
'nn_NO' => 'Norwegian Nynorsk (Norway)',
|
|
|
|
|
'nb_NO' => 'Norwegian',
|
|
|
|
|
'nod_TH' => 'Thai, Northern (Thailand)',
|
|
|
|
|
'noe_IN' => 'Nimadi (India)',
|
|
|
|
|
'nso_ZA' => 'Northern Sotho (South Africa)',
|
|
|
|
|
'ny_MW' => 'Nyanja (Malawi)',
|
|
|
|
|
'ny_ZM' => 'Nyanja (Zambia)',
|
|
|
|
|
'nyn_UG' => 'Nyankole (Uganda)',
|
|
|
|
|
'om_ET' => 'Oromo (Ethiopia)',
|
|
|
|
|
'or_IN' => 'Oriya (India)',
|
|
|
|
|
'pa_IN' => 'Punjabi (India)',
|
|
|
|
|
'pag_PH' => 'Pangasinan (Philippines)',
|
|
|
|
|
'pap_AN' => 'Papiamento (Netherlands Antilles)',
|
|
|
|
|
'pap_AW' => 'Papiamento (Aruba)',
|
|
|
|
|
'pau_PW' => 'Palauan (Palau)',
|
|
|
|
|
'pl_PL' => 'Polish (Poland)',
|
|
|
|
|
'pl_UA' => 'Polish (Ukraine)',
|
|
|
|
|
'pon_FM' => 'Pohnpeian (Micronesia)',
|
|
|
|
|
'ps_AF' => 'Pashto (Afghanistan)',
|
|
|
|
|
'ps_PK' => 'Pashto (Pakistan)',
|
|
|
|
|
'pt_AO' => 'Portuguese (Angola)',
|
|
|
|
|
'pt_BR' => 'Portuguese (Brazil)',
|
|
|
|
|
'pt_CV' => 'Portuguese (Cape Verde)',
|
|
|
|
|
'pt_GW' => 'Portuguese (Guinea-Bissau)',
|
|
|
|
|
'pt_MZ' => 'Portuguese (Mozambique)',
|
|
|
|
|
'pt_PT' => 'Portuguese (Portugal)',
|
|
|
|
|
'pt_ST' => 'Portuguese (Sao Tome and Principe)',
|
|
|
|
|
'pt_TL' => 'Portuguese (East Timor)',
|
|
|
|
|
'qu_BO' => 'Quechua (Bolivia)',
|
|
|
|
|
'qu_PE' => 'Quechua (Peru)',
|
|
|
|
|
'rcf_RE' => 'R<>union Creole French (Reunion)',
|
|
|
|
|
'rej_ID' => 'Rejang (Indonesia)',
|
|
|
|
|
'rif_MA' => 'Tarifit (Morocco)',
|
|
|
|
|
'rjb_IN' => 'Rajbanshi (India)',
|
|
|
|
|
'rm_CH' => 'Rhaeto-Romance (Switzerland)',
|
|
|
|
|
'rmt_IR' => 'Domari (Iran)',
|
|
|
|
|
'rn_BI' => 'Rundi (Burundi)',
|
|
|
|
|
'ro_MD' => 'Romanian (Moldova)',
|
|
|
|
|
'ro_RO' => 'Romanian (Romania)',
|
|
|
|
|
'ro_RS' => 'Romanian (Serbia)',
|
|
|
|
|
'ru_BY' => 'Russian (Belarus)',
|
|
|
|
|
'ru_KG' => 'Russian (Kyrgyzstan)',
|
|
|
|
|
'ru_KZ' => 'Russian (Kazakhstan)',
|
|
|
|
|
'ru_RU' => 'Russian (Russia)',
|
|
|
|
|
'ru_SJ' => 'Russian (Svalbard and Jan Mayen)',
|
|
|
|
|
'ru_UA' => 'Russian (Ukraine)',
|
|
|
|
|
'rw_RW' => 'Kinyarwanda (Rwanda)',
|
|
|
|
|
'sa_IN' => 'Sanskrit (India)',
|
|
|
|
|
'sah_RU' => 'Yakut (Russia)',
|
|
|
|
|
'sas_ID' => 'Sasak (Indonesia)',
|
|
|
|
|
'sat_IN' => 'Santali (India)',
|
|
|
|
|
'sck_IN' => 'Sadri (India)',
|
|
|
|
|
'sco_GB' => 'Scots (United Kingdom)',
|
|
|
|
|
'sco_SCO' => 'Scots',
|
|
|
|
|
'sd_IN' => 'Sindhi (India)',
|
|
|
|
|
'sd_PK' => 'Sindhi (Pakistan)',
|
|
|
|
|
'se_NO' => 'Northern Sami (Norway)',
|
|
|
|
|
'sg_CF' => 'Sango (Central African Republic)',
|
|
|
|
|
'si_LK' => 'Sinhalese (Sri Lanka)',
|
|
|
|
|
'sid_ET' => 'Sidamo (Ethiopia)',
|
|
|
|
|
'sk_RS' => 'Slovak (Serbia)',
|
|
|
|
|
'sk_SK' => 'Slovak (Slovakia)',
|
|
|
|
|
'sl_AT' => 'Slovenian (Austria)',
|
|
|
|
|
'sl_SI' => 'Slovenian (Slovenia)',
|
|
|
|
|
'sm_AS' => 'Samoan (American Samoa)',
|
|
|
|
|
'sm_WS' => 'Samoan (Samoa)',
|
|
|
|
|
'sn_ZW' => 'Shona (Zimbabwe)',
|
|
|
|
|
'so_DJ' => 'Somali (Djibouti)',
|
|
|
|
|
'so_ET' => 'Somali (Ethiopia)',
|
|
|
|
|
'so_SO' => 'Somali (Somalia)',
|
|
|
|
|
'sou_TH' => 'Thai, Southern (Thailand)',
|
|
|
|
|
'sq_AL' => 'Albanian (Albania)',
|
|
|
|
|
'sr_BA' => 'Serbian (Bosnia and Herzegovina)',
|
|
|
|
|
'sr_ME' => 'Serbian (Montenegro)',
|
|
|
|
|
'sr_RS' => 'Serbian (Serbia)',
|
|
|
|
|
'ss_SZ' => 'Swati (Swaziland)',
|
|
|
|
|
'ss_ZA' => 'Swati (South Africa)',
|
|
|
|
|
'st_LS' => 'Southern Sotho (Lesotho)',
|
|
|
|
|
'st_ZA' => 'Southern Sotho (South Africa)',
|
|
|
|
|
'su_ID' => 'Sundanese (Indonesia)',
|
|
|
|
|
'sv_AX' => 'Swedish (Aland Islands)',
|
|
|
|
|
'sv_FI' => 'Swedish (Finland)',
|
|
|
|
|
'sv_SE' => 'Swedish (Sweden)',
|
|
|
|
|
'sw_KE' => 'Swahili (Kenya)',
|
|
|
|
|
'sw_SO' => 'Swahili (Somalia)',
|
|
|
|
|
'sw_TZ' => 'Swahili (Tanzania)',
|
|
|
|
|
'sw_UG' => 'Swahili (Uganda)',
|
|
|
|
|
'swb_KM' => 'Comorian (Comoros)',
|
|
|
|
|
'swb_YT' => 'Comorian (Mayotte)',
|
|
|
|
|
'swv_IN' => 'Shekhawati (India)',
|
|
|
|
|
'ta_IN' => 'Tamil (India)',
|
|
|
|
|
'ta_LK' => 'Tamil (Sri Lanka)',
|
|
|
|
|
'ta_MY' => 'Tamil (Malaysia)',
|
|
|
|
|
'ta_SG' => 'Tamil (Singapore)',
|
|
|
|
|
'tcy_IN' => 'Tulu (India)',
|
|
|
|
|
'te_IN' => 'Telugu (India)',
|
|
|
|
|
'tet_TL' => 'Tetum (East Timor)',
|
|
|
|
|
'tg_TJ' => 'Tajik (Tajikistan)',
|
|
|
|
|
'th_TH' => 'Thai (Thailand)',
|
|
|
|
|
'ti_ER' => 'Tigrinya (Eritrea)',
|
|
|
|
|
'ti_ET' => 'Tigrinya (Ethiopia)',
|
|
|
|
|
'tk_IR' => 'Turkmen (Iran)',
|
|
|
|
|
'tk_TM' => 'Turkmen (Turkmenistan)',
|
|
|
|
|
'tkl_TK' => 'Tokelau (Tokelau)',
|
|
|
|
|
'tl_PH' => 'Tagalog (Philippines)',
|
|
|
|
|
'tl_US' => 'Tagalog (United States)',
|
|
|
|
|
'tn_BW' => 'Tswana (Botswana)',
|
|
|
|
|
'tn_ZA' => 'Tswana (South Africa)',
|
|
|
|
|
'to_TO' => 'Tonga (Tonga)',
|
|
|
|
|
'tr_CY' => 'Turkish (Cyprus)',
|
|
|
|
|
'tr_DE' => 'Turkish (Germany)',
|
|
|
|
|
'tr_MK' => 'Turkish (Macedonia)',
|
|
|
|
|
'tr_TR' => 'Turkish (Turkey)',
|
|
|
|
|
'ts_MZ' => 'Tsonga (Mozambique)',
|
|
|
|
|
'ts_ZA' => 'Tsonga (South Africa)',
|
|
|
|
|
'tsg_PH' => 'Tausug (Philippines)',
|
|
|
|
|
'tt_RU' => 'Tatar (Russia)',
|
|
|
|
|
'tts_TH' => 'Thai, Northeastern (Thailand)',
|
|
|
|
|
'tvl_TV' => 'Tuvalu (Tuvalu)',
|
|
|
|
|
'tw_GH' => 'Twi (Ghana)',
|
|
|
|
|
'ty_PF' => 'Tahitian (French Polynesia)',
|
|
|
|
|
'tyv_RU' => 'Tuvinian (Russia)',
|
|
|
|
|
'tzm_MA' => 'Tamazight, Central Atlas (Morocco)',
|
|
|
|
|
'udm_RU' => 'Udmurt (Russia)',
|
|
|
|
|
'ug_CN' => 'Uighur (China)',
|
|
|
|
|
'uk_UA' => 'Ukrainian (Ukraine)',
|
|
|
|
|
'uli_FM' => 'Ulithian (Micronesia)',
|
|
|
|
|
'ur_IN' => 'Urdu (India)',
|
|
|
|
|
'ur_PK' => 'Urdu (Pakistan)',
|
|
|
|
|
'uz_AF' => 'Uzbek (Afghanistan)',
|
|
|
|
|
'uz_UZ' => 'Uzbek (Uzbekistan)',
|
|
|
|
|
've_ZA' => 'Venda (South Africa)',
|
|
|
|
|
'vi_US' => 'Vietnamese (United States)',
|
|
|
|
|
'vi_VN' => 'Vietnamese (Vietnam)',
|
|
|
|
|
'vmw_MZ' => 'Waddar (Mozambique)',
|
|
|
|
|
'wal_ET' => 'Walamo (Ethiopia)',
|
|
|
|
|
'war_PH' => 'Waray (Philippines)',
|
|
|
|
|
'wbq_IN' => 'Waddar (India)',
|
|
|
|
|
'wbr_IN' => 'Wagdi (India)',
|
|
|
|
|
'wo_MR' => 'Wolof (Mauritania)',
|
|
|
|
|
'wo_SN' => 'Wolof (Senegal)',
|
|
|
|
|
'wtm_IN' => 'Mewati (India)',
|
|
|
|
|
'xh_ZA' => 'Xhosa (South Africa)',
|
|
|
|
|
'xnr_IN' => 'Kangri (India)',
|
|
|
|
|
'xog_UG' => 'Soga (Uganda)',
|
|
|
|
|
'yap_FM' => 'Yapese (Micronesia)',
|
|
|
|
|
'yo_NG' => 'Yoruba (Nigeria)',
|
|
|
|
|
'za_CN' => 'Zhuang (China)',
|
|
|
|
|
'zh_CN' => 'Chinese (China)',
|
|
|
|
|
'zh_HK' => 'Chinese (Hong Kong SAR China)',
|
|
|
|
|
'zh_MO' => 'Chinese (Macao SAR China)',
|
|
|
|
|
'zh_SG' => 'Chinese (Singapore)',
|
|
|
|
|
'zh_TW' => 'Chinese (Taiwan)',
|
|
|
|
|
'zh_US' => 'Chinese (United States)',
|
|
|
|
|
'zh_cmn' => 'Chinese (Mandarin)',
|
|
|
|
|
'zh_yue' => 'Chinese (Cantonese)',
|
|
|
|
|
'zu_ZA' => 'Zulu (South Africa)'
|
2007-09-16 18:16:58 +02:00
|
|
|
|
);
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2007-09-16 18:16:58 +02:00
|
|
|
|
/**
|
2013-03-27 20:42:46 +01:00
|
|
|
|
* @config
|
2009-03-20 09:36:40 +01:00
|
|
|
|
* @var array $common_languages A list of commonly used languages, in the form
|
|
|
|
|
* langcode => array( EnglishName, NativeName)
|
2007-09-16 18:16:58 +02:00
|
|
|
|
*/
|
2013-03-27 20:42:46 +01:00
|
|
|
|
private static $common_languages = array(
|
|
|
|
|
'af' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Afrikaans',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Afrikaans'
|
|
|
|
|
),
|
|
|
|
|
'sq' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Albanian',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'shqip'
|
|
|
|
|
),
|
|
|
|
|
'ar' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Arabic',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'العربية'
|
|
|
|
|
),
|
|
|
|
|
'eu' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Basque',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'euskera'
|
|
|
|
|
),
|
|
|
|
|
'be' => array(
|
|
|
|
|
'name' => 'Belarusian',
|
2013-08-21 08:54:05 +02:00
|
|
|
|
'native' =>
|
|
|
|
|
'Беларуская мова'
|
2013-03-27 20:42:46 +01:00
|
|
|
|
),
|
|
|
|
|
'bn' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Bengali',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'বাংলা'
|
|
|
|
|
),
|
|
|
|
|
'bg' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Bulgarian',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'български'
|
|
|
|
|
),
|
|
|
|
|
'ca' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Catalan',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'català'
|
|
|
|
|
),
|
|
|
|
|
'zh_yue' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Chinese (Cantonese)',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => '廣東話 [广东话]'
|
|
|
|
|
),
|
|
|
|
|
'zh_cmn' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Chinese (Mandarin)',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => '普通話 [普通话]'
|
|
|
|
|
),
|
|
|
|
|
'hr' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Croatian',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Hrvatski'
|
|
|
|
|
),
|
|
|
|
|
'zh' => array(
|
2014-07-03 07:52:52 +02:00
|
|
|
|
'name' => 'Chinese',
|
|
|
|
|
'native' => '中国的'
|
2013-03-27 20:42:46 +01:00
|
|
|
|
),
|
|
|
|
|
'cs' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Czech',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'čeština'
|
|
|
|
|
),
|
|
|
|
|
'cy' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Welsh',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Welsh/Cymraeg'
|
|
|
|
|
),
|
|
|
|
|
'da' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Danish',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'dansk'
|
|
|
|
|
),
|
|
|
|
|
'nl' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Dutch',
|
2013-03-28 09:03:45 +01:00
|
|
|
|
'native' => 'Nederlands'
|
2013-03-27 20:42:46 +01:00
|
|
|
|
),
|
|
|
|
|
'en' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'English',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'English'
|
|
|
|
|
),
|
|
|
|
|
'eo' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Esperanto',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Esperanto'
|
|
|
|
|
),
|
|
|
|
|
'et' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Estonian',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'eesti keel'
|
|
|
|
|
),
|
|
|
|
|
'fo' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Faroese',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Føroyska'
|
|
|
|
|
),
|
|
|
|
|
'fi' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Finnish',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'suomi'
|
|
|
|
|
),
|
|
|
|
|
'fr' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'French',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'français'
|
|
|
|
|
),
|
|
|
|
|
'gd' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Gaelic',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Gaeilge'
|
|
|
|
|
),
|
|
|
|
|
'gl' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Galician',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Galego'
|
|
|
|
|
),
|
|
|
|
|
'de' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'German',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Deutsch'
|
|
|
|
|
),
|
|
|
|
|
'el' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Greek',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'ελληνικά'
|
|
|
|
|
),
|
|
|
|
|
'gu' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Gujarati',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'ગુજરાતી'
|
|
|
|
|
),
|
|
|
|
|
'ha' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Hausa',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'حَوْسَ'
|
|
|
|
|
),
|
|
|
|
|
'he' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Hebrew',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'עברית'
|
|
|
|
|
),
|
|
|
|
|
'hi' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Hindi',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'हिन्दी'
|
|
|
|
|
),
|
|
|
|
|
'hu' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Hungarian',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'magyar'
|
|
|
|
|
),
|
|
|
|
|
'is' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Icelandic',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Íslenska'
|
|
|
|
|
),
|
|
|
|
|
'io' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Ido',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Ido'
|
|
|
|
|
),
|
|
|
|
|
'id' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Indonesian',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Bahasa Indonesia'
|
|
|
|
|
),
|
|
|
|
|
'ga' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Irish',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Irish'
|
|
|
|
|
),
|
|
|
|
|
'it' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Italian',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'italiano'
|
|
|
|
|
),
|
|
|
|
|
'ja' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Japanese',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => '日本語'
|
|
|
|
|
),
|
|
|
|
|
'jv' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Javanese',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'basa Jawa'
|
|
|
|
|
),
|
|
|
|
|
'ko' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Korean',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => '한국어 [韓國語]'
|
|
|
|
|
),
|
|
|
|
|
'ku' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Kurdish',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Kurdí'
|
|
|
|
|
),
|
|
|
|
|
'lv' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Latvian',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'latviešu'
|
|
|
|
|
),
|
|
|
|
|
'lt' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Lithuanian',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'lietuviškai'
|
|
|
|
|
),
|
|
|
|
|
'lmo' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Lombard',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Lombardo'
|
|
|
|
|
),
|
|
|
|
|
'mk' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Macedonian',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'македонски'
|
|
|
|
|
),
|
|
|
|
|
'mi' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'te reo Māori',
|
|
|
|
|
'native' => 'te reo Māori'
|
2013-03-27 20:42:46 +01:00
|
|
|
|
),
|
|
|
|
|
'ms' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Malay',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Bahasa melayu'
|
|
|
|
|
),
|
|
|
|
|
'mt' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Maltese',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Malti'
|
|
|
|
|
),
|
|
|
|
|
'mr' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Marathi',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'मराठी'
|
|
|
|
|
),
|
|
|
|
|
'ne' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Nepali',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'नेपाली'
|
|
|
|
|
),
|
2014-06-23 15:50:36 +02:00
|
|
|
|
'nb' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Norwegian',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Norsk'
|
|
|
|
|
),
|
|
|
|
|
'om' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Oromo',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Afaan Oromo'
|
|
|
|
|
),
|
|
|
|
|
'fa' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Persian',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'فارسى'
|
|
|
|
|
),
|
|
|
|
|
'pl' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Polish',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'polski'
|
|
|
|
|
),
|
|
|
|
|
'pt_PT' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Portuguese (Portugal)',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'português (Portugal)'
|
|
|
|
|
),
|
|
|
|
|
'pt_BR' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Portuguese (Brazil)',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'português (Brazil)'
|
|
|
|
|
),
|
|
|
|
|
'pa' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Punjabi',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'ਪੰਜਾਬੀ'
|
|
|
|
|
),
|
|
|
|
|
'qu' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Quechua',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Quechua'
|
|
|
|
|
),
|
|
|
|
|
'rm' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Romansh',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'rumantsch'
|
|
|
|
|
),
|
|
|
|
|
'ro' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Romanian',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'român'
|
|
|
|
|
),
|
|
|
|
|
'ru' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Russian',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Русский'
|
|
|
|
|
),
|
|
|
|
|
'sco' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Scots',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Scoats leid, Lallans'
|
|
|
|
|
),
|
|
|
|
|
'sr' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Serbian',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'српски'
|
|
|
|
|
),
|
|
|
|
|
'sk' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Slovak',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'slovenčina'
|
|
|
|
|
),
|
|
|
|
|
'sl' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Slovenian',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'slovenščina'
|
|
|
|
|
),
|
|
|
|
|
'es' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Spanish',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'español'
|
|
|
|
|
),
|
|
|
|
|
'sv' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Swedish',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Svenska'
|
|
|
|
|
),
|
|
|
|
|
'tl' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Tagalog',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Tagalog'
|
|
|
|
|
),
|
|
|
|
|
'ta' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Tamil',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'தமிழ்'
|
|
|
|
|
),
|
|
|
|
|
'te' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Telugu',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'తెలుగు'
|
|
|
|
|
),
|
|
|
|
|
'to' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Tonga',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'chiTonga'
|
|
|
|
|
),
|
|
|
|
|
'ts' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Tsonga',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'xiTshonga'
|
|
|
|
|
),
|
|
|
|
|
'tn' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Tswana',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'seTswana'
|
|
|
|
|
),
|
|
|
|
|
'tr' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Turkish',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Türkçe'
|
|
|
|
|
),
|
|
|
|
|
'tk' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Turkmen',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'түркmенче'
|
|
|
|
|
),
|
|
|
|
|
'tw' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Twi',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'twi'
|
|
|
|
|
),
|
|
|
|
|
'uk' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Ukrainian',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Українська'
|
|
|
|
|
),
|
|
|
|
|
'ur' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Urdu',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'اردو'
|
|
|
|
|
),
|
|
|
|
|
'uz' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Uzbek',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'ўзбек'
|
|
|
|
|
),
|
|
|
|
|
've' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Venda',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'tshiVenḓa'
|
|
|
|
|
),
|
|
|
|
|
'vi' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Vietnamese',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'tiếng việt'
|
|
|
|
|
),
|
|
|
|
|
'wa' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Walloon',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'walon'
|
|
|
|
|
),
|
|
|
|
|
'wo' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Wolof',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'Wollof'
|
|
|
|
|
),
|
|
|
|
|
'xh' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Xhosa',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'isiXhosa'
|
|
|
|
|
),
|
|
|
|
|
'yi' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Yiddish',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'ײִדיש'
|
|
|
|
|
),
|
|
|
|
|
'zu' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'Zulu',
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'native' => 'isiZulu'
|
|
|
|
|
)
|
2007-09-16 18:16:58 +02:00
|
|
|
|
);
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2009-03-20 09:36:40 +01:00
|
|
|
|
/**
|
2013-03-21 19:48:54 +01:00
|
|
|
|
* @config
|
2009-03-20 09:36:40 +01:00
|
|
|
|
* @var array $common_locales
|
|
|
|
|
* Sorted alphabtically by the common language name,
|
|
|
|
|
* not the locale key.
|
|
|
|
|
*/
|
2013-03-21 19:48:54 +01:00
|
|
|
|
private static $common_locales = array(
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'af_ZA' => array(
|
|
|
|
|
'name' => 'Afrikaans',
|
|
|
|
|
'native' => 'Afrikaans'
|
|
|
|
|
),
|
|
|
|
|
'sq_AL' => array(
|
|
|
|
|
'name' => 'Albanian',
|
|
|
|
|
'native' => 'shqip'
|
|
|
|
|
),
|
|
|
|
|
'ar_EG' => array(
|
|
|
|
|
'name' => 'Arabic',
|
|
|
|
|
'native' => 'العربية'
|
|
|
|
|
),
|
|
|
|
|
'eu_ES' => array(
|
|
|
|
|
'name' => 'Basque',
|
|
|
|
|
'native' => 'euskera'
|
|
|
|
|
),
|
|
|
|
|
'be_BY' => array(
|
|
|
|
|
'name' => 'Belarusian',
|
2013-08-21 08:54:05 +02:00
|
|
|
|
'native' =>
|
|
|
|
|
'Беларуская мова'
|
2013-03-27 20:42:46 +01:00
|
|
|
|
),
|
|
|
|
|
'bn_BD' => array(
|
|
|
|
|
'name' => 'Bengali',
|
|
|
|
|
'native' => 'বাংলা'
|
|
|
|
|
),
|
|
|
|
|
'bg_BG' => array(
|
|
|
|
|
'name' => 'Bulgarian',
|
|
|
|
|
'native' => 'български'
|
|
|
|
|
),
|
|
|
|
|
'ca_ES' => array(
|
|
|
|
|
'name' => 'Catalan',
|
|
|
|
|
'native' => 'català'
|
|
|
|
|
),
|
|
|
|
|
'zh_CN' => array(
|
2013-03-28 09:03:45 +01:00
|
|
|
|
'name' => 'Chinese',
|
|
|
|
|
'native' => '中国的'
|
2013-03-27 20:42:46 +01:00
|
|
|
|
),
|
|
|
|
|
'zh_yue' => array(
|
|
|
|
|
'name' => 'Chinese (Cantonese)',
|
|
|
|
|
'native' => '廣東話 [广东话]'
|
|
|
|
|
),
|
|
|
|
|
'zh_cmn' => array(
|
|
|
|
|
'name' => 'Chinese (Mandarin)',
|
|
|
|
|
'native' => '普通話 [普通话]'
|
|
|
|
|
),
|
|
|
|
|
'hr_HR' => array(
|
|
|
|
|
'name' => 'Croatian',
|
|
|
|
|
'native' => 'Hrvatski'
|
|
|
|
|
),
|
|
|
|
|
'cs_CZ' => array(
|
|
|
|
|
'name' => 'Czech',
|
|
|
|
|
'native' => 'čeština'
|
|
|
|
|
),
|
|
|
|
|
'cy_GB' => array(
|
|
|
|
|
'name' => 'Welsh',
|
|
|
|
|
'native' => 'Welsh/Cymraeg'
|
|
|
|
|
),
|
|
|
|
|
'da_DK' => array(
|
|
|
|
|
'name' => 'Danish',
|
|
|
|
|
'native' => 'dansk'
|
|
|
|
|
),
|
|
|
|
|
'nl_NL' => array(
|
|
|
|
|
'name' => 'Dutch',
|
|
|
|
|
'native' => 'Nederlands'
|
|
|
|
|
),
|
2015-08-11 14:30:49 +02:00
|
|
|
|
'nl_BE' => array(
|
|
|
|
|
'name' => 'Dutch (Belgium)',
|
|
|
|
|
'native' => 'Nederlands (België)'
|
|
|
|
|
),
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'en_NZ' => array(
|
|
|
|
|
'name' => 'English (NZ)',
|
|
|
|
|
'native' => 'English (NZ)'
|
|
|
|
|
),
|
|
|
|
|
'en_US' => array(
|
|
|
|
|
'name' => 'English (US)',
|
|
|
|
|
'native' => 'English (US)'
|
|
|
|
|
),
|
|
|
|
|
'en_GB' => array(
|
|
|
|
|
'name' => 'English (UK)',
|
|
|
|
|
'native' => 'English (UK)'
|
|
|
|
|
),
|
|
|
|
|
'eo_XX' => array(
|
|
|
|
|
'name' => 'Esperanto',
|
|
|
|
|
'native' => 'Esperanto'
|
|
|
|
|
),
|
|
|
|
|
'et_EE' => array(
|
|
|
|
|
'name' => 'Estonian',
|
|
|
|
|
'native' => 'eesti keel'
|
|
|
|
|
),
|
|
|
|
|
'fo_FO' => array(
|
|
|
|
|
'name' => 'Faroese',
|
|
|
|
|
'native' => 'Føroyska'
|
|
|
|
|
),
|
|
|
|
|
'fi_FI' => array(
|
|
|
|
|
'name' => 'Finnish',
|
|
|
|
|
'native' => 'suomi'
|
|
|
|
|
),
|
|
|
|
|
'fr_FR' => array(
|
|
|
|
|
'name' => 'French',
|
|
|
|
|
'native' => 'français'
|
|
|
|
|
),
|
2015-08-11 14:30:49 +02:00
|
|
|
|
'fr_BE' => array(
|
|
|
|
|
'name' => 'French (Belgium)',
|
|
|
|
|
'native' => 'Français (Belgique)'
|
|
|
|
|
),
|
2013-03-27 20:42:46 +01:00
|
|
|
|
'gd_GB' => array(
|
|
|
|
|
'name' => 'Gaelic',
|
|
|
|
|
'native' => 'Gaeilge'
|
|
|
|
|
),
|
|
|
|
|
'gl_ES' => array(
|
|
|
|
|
'name' => 'Galician',
|
|
|
|
|
'native' => 'Galego'
|
|
|
|
|
),
|
|
|
|
|
'de_DE' => array(
|
|
|
|
|
'name' => 'German',
|
|
|
|
|
'native' => 'Deutsch'
|
|
|
|
|
),
|
|
|
|
|
'el_GR' => array(
|
|
|
|
|
'name' => 'Greek',
|
|
|
|
|
'native' => 'ελληνικά'
|
|
|
|
|
),
|
|
|
|
|
'gu_IN' => array(
|
|
|
|
|
'name' => 'Gujarati',
|
|
|
|
|
'native' => 'ગુજરાતી'
|
|
|
|
|
),
|
|
|
|
|
'ha_NG' => array(
|
|
|
|
|
'name' => 'Hausa',
|
|
|
|
|
'native' => 'حَوْسَ'
|
|
|
|
|
),
|
|
|
|
|
'he_IL' => array(
|
|
|
|
|
'name' => 'Hebrew',
|
|
|
|
|
'native' => 'עברית'
|
|
|
|
|
),
|
|
|
|
|
'hi_IN' => array(
|
|
|
|
|
'name' => 'Hindi',
|
|
|
|
|
'native' => 'हिन्दी'
|
|
|
|
|
),
|
|
|
|
|
'hu_HU' => array(
|
|
|
|
|
'name' => 'Hungarian',
|
|
|
|
|
'native' => 'magyar'
|
|
|
|
|
),
|
|
|
|
|
'is_IS' => array(
|
|
|
|
|
'name' => 'Icelandic',
|
|
|
|
|
'native' => 'Íslenska'
|
|
|
|
|
),
|
|
|
|
|
'id_ID' => array(
|
|
|
|
|
'name' => 'Indonesian',
|
|
|
|
|
'native' => 'Bahasa Indonesia'
|
|
|
|
|
),
|
|
|
|
|
'ga_IE' => array(
|
|
|
|
|
'name' => 'Irish',
|
|
|
|
|
'native' => 'Irish'
|
|
|
|
|
),
|
|
|
|
|
'it_IT' => array(
|
|
|
|
|
'name' => 'Italian',
|
|
|
|
|
'native' => 'italiano'
|
|
|
|
|
),
|
|
|
|
|
'ja_JP' => array(
|
|
|
|
|
'name' => 'Japanese',
|
|
|
|
|
'native' => '日本語'
|
|
|
|
|
),
|
|
|
|
|
'jv_ID' => array(
|
|
|
|
|
'name' => 'Javanese',
|
|
|
|
|
'native' => 'basa Jawa'
|
|
|
|
|
),
|
|
|
|
|
'ko_KR' => array(
|
|
|
|
|
'name' => 'Korean',
|
|
|
|
|
'native' => '한국어 [韓國語]'
|
|
|
|
|
),
|
|
|
|
|
'ku_IQ' => array(
|
|
|
|
|
'name' => 'Kurdish',
|
|
|
|
|
'native' => 'Kurdí'
|
|
|
|
|
),
|
|
|
|
|
'lv_LV' => array(
|
|
|
|
|
'name' => 'Latvian',
|
|
|
|
|
'native' => 'latviešu'
|
|
|
|
|
),
|
|
|
|
|
'lt_LT' => array(
|
|
|
|
|
'name' => 'Lithuanian',
|
|
|
|
|
'native' => 'lietuviškai'
|
|
|
|
|
),
|
|
|
|
|
'mk_MK' => array(
|
|
|
|
|
'name' => 'Macedonian',
|
|
|
|
|
'native' => 'македонски'
|
|
|
|
|
),
|
|
|
|
|
'mi_NZ' => array(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'name' => 'te reo Māori',
|
|
|
|
|
'native' => 'te reo Māori'
|
2013-03-27 20:42:46 +01:00
|
|
|
|
),
|
|
|
|
|
'ms_MY' => array(
|
|
|
|
|
'name' => 'Malay',
|
|
|
|
|
'native' => 'Bahasa melayu'
|
|
|
|
|
),
|
|
|
|
|
'mt_MT' => array(
|
|
|
|
|
'name' => 'Maltese',
|
|
|
|
|
'native' => 'Malti'
|
|
|
|
|
),
|
|
|
|
|
'mr_IN' => array(
|
|
|
|
|
'name' => 'Marathi',
|
|
|
|
|
'native' => 'मराठी'
|
|
|
|
|
),
|
|
|
|
|
'ne_NP' => array(
|
|
|
|
|
'name' => 'Nepali',
|
|
|
|
|
'native' => 'नेपाली'
|
|
|
|
|
),
|
|
|
|
|
'nb_NO' => array(
|
|
|
|
|
'name' => 'Norwegian',
|
|
|
|
|
'native' => 'Norsk'
|
|
|
|
|
),
|
|
|
|
|
'om_ET' => array(
|
|
|
|
|
'name' => 'Oromo',
|
|
|
|
|
'native' => 'Afaan Oromo'
|
|
|
|
|
),
|
|
|
|
|
'fa_IR' => array(
|
|
|
|
|
'name' => 'Persian',
|
|
|
|
|
'native' => 'فارسى'
|
|
|
|
|
),
|
|
|
|
|
'pl_PL' => array(
|
|
|
|
|
'name' => 'Polish',
|
|
|
|
|
'native' => 'polski'
|
|
|
|
|
),
|
|
|
|
|
'pt_PT' => array(
|
|
|
|
|
'name' => 'Portuguese (Portugal)',
|
|
|
|
|
'native' => 'português (Portugal)'
|
|
|
|
|
),
|
|
|
|
|
'pt_BR' => array(
|
|
|
|
|
'name' => 'Portuguese (Brazil)',
|
|
|
|
|
'native' => 'português (Brazil)'
|
|
|
|
|
),
|
|
|
|
|
'pa_IN' => array(
|
|
|
|
|
'name' => 'Punjabi',
|
|
|
|
|
'native' => 'ਪੰਜਾਬੀ'
|
|
|
|
|
),
|
|
|
|
|
'qu_PE' => array(
|
|
|
|
|
'name' => 'Quechua',
|
|
|
|
|
'native' => 'Quechua'
|
|
|
|
|
),
|
|
|
|
|
'rm_CH' => array(
|
|
|
|
|
'name' => 'Romansh',
|
|
|
|
|
'native' => 'rumantsch'
|
|
|
|
|
),
|
|
|
|
|
'ro_RO' => array(
|
|
|
|
|
'name' => 'Romanian',
|
|
|
|
|
'native' => 'român'
|
|
|
|
|
),
|
|
|
|
|
'ru_RU' => array(
|
|
|
|
|
'name' => 'Russian',
|
|
|
|
|
'native' => 'Русский'
|
|
|
|
|
),
|
|
|
|
|
'sco_SCO' => array(
|
|
|
|
|
'name' => 'Scots',
|
|
|
|
|
'native' => 'Scoats leid, Lallans'
|
|
|
|
|
),
|
|
|
|
|
'sr_RS' => array(
|
|
|
|
|
'name' => 'Serbian',
|
|
|
|
|
'native' => 'српски'
|
|
|
|
|
),
|
|
|
|
|
'sk_SK' => array(
|
|
|
|
|
'name' => 'Slovak',
|
|
|
|
|
'native' => 'slovenčina'
|
|
|
|
|
),
|
|
|
|
|
'sl_SI' => array(
|
|
|
|
|
'name' => 'Slovenian',
|
|
|
|
|
'native' => 'slovenščina'
|
|
|
|
|
),
|
|
|
|
|
'es_ES' => array(
|
|
|
|
|
'name' => 'Spanish',
|
|
|
|
|
'native' => 'español'
|
|
|
|
|
),
|
|
|
|
|
'sv_SE' => array(
|
|
|
|
|
'name' => 'Swedish',
|
|
|
|
|
'native' => 'Svenska'
|
|
|
|
|
),
|
|
|
|
|
'tl_PH' => array(
|
|
|
|
|
'name' => 'Tagalog',
|
|
|
|
|
'native' => 'Tagalog'
|
|
|
|
|
),
|
|
|
|
|
'ta_IN' => array(
|
|
|
|
|
'name' => 'Tamil',
|
|
|
|
|
'native' => 'தமிழ்'
|
|
|
|
|
),
|
|
|
|
|
'te_IN' => array(
|
|
|
|
|
'name' => 'Telugu',
|
|
|
|
|
'native' => 'తెలుగు'
|
|
|
|
|
),
|
|
|
|
|
'to_TO' => array(
|
|
|
|
|
'name' => 'Tonga',
|
|
|
|
|
'native' => 'chiTonga'
|
|
|
|
|
),
|
|
|
|
|
'ts_ZA' => array(
|
|
|
|
|
'name' => 'Tsonga',
|
|
|
|
|
'native' => 'xiTshonga'
|
|
|
|
|
),
|
|
|
|
|
'tn_ZA' => array(
|
|
|
|
|
'name' => 'Tswana',
|
|
|
|
|
'native' => 'seTswana'
|
|
|
|
|
),
|
|
|
|
|
'tr_TR' => array(
|
|
|
|
|
'name' => 'Turkish',
|
|
|
|
|
'native' => 'Türkçe'
|
|
|
|
|
),
|
|
|
|
|
'tk_TM' => array(
|
|
|
|
|
'name' => 'Turkmen',
|
|
|
|
|
'native' => 'түркmенче'
|
|
|
|
|
),
|
|
|
|
|
'tw_GH' => array(
|
|
|
|
|
'name' => 'Twi',
|
|
|
|
|
'native' => 'twi'
|
|
|
|
|
),
|
|
|
|
|
'uk_UA' => array(
|
|
|
|
|
'name' => 'Ukrainian',
|
|
|
|
|
'native' => 'Українська'
|
|
|
|
|
),
|
|
|
|
|
'ur_PK' => array(
|
|
|
|
|
'name' => 'Urdu',
|
|
|
|
|
'native' => 'اردو'
|
|
|
|
|
),
|
|
|
|
|
'uz_UZ' => array(
|
|
|
|
|
'name' => 'Uzbek',
|
|
|
|
|
'native' => 'ўзбек'
|
|
|
|
|
),
|
|
|
|
|
've_ZA' => array(
|
|
|
|
|
'name' => 'Venda',
|
|
|
|
|
'native' => 'tshiVenḓa'
|
|
|
|
|
),
|
|
|
|
|
'vi_VN' => array(
|
|
|
|
|
'name' => 'Vietnamese',
|
|
|
|
|
'native' => 'tiếng việt'
|
|
|
|
|
),
|
|
|
|
|
'wo_SN' => array(
|
|
|
|
|
'name' => 'Wolof',
|
|
|
|
|
'native' => 'Wollof'
|
|
|
|
|
),
|
|
|
|
|
'xh_ZA' => array(
|
|
|
|
|
'name' => 'Xhosa',
|
|
|
|
|
'native' => 'isiXhosa'
|
|
|
|
|
),
|
|
|
|
|
'zu_ZA' => array(
|
|
|
|
|
'name' => 'Zulu',
|
|
|
|
|
'native' => 'isiZulu'
|
|
|
|
|
),
|
2009-03-20 09:36:40 +01:00
|
|
|
|
);
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2013-03-21 19:48:54 +01:00
|
|
|
|
/**
|
|
|
|
|
* @config
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
|
|
|
|
private static $tinymce_lang = array(
|
2013-10-06 23:50:20 +02:00
|
|
|
|
'ar_EG' => 'ar',
|
2007-10-08 23:55:15 +02:00
|
|
|
|
'ca_AD' => 'ca',
|
|
|
|
|
'ca_ES' => 'ca',
|
|
|
|
|
'cs_CZ' => 'cs',
|
|
|
|
|
'cy_GB' => 'cy',
|
|
|
|
|
'da_DK' => 'da',
|
|
|
|
|
'da_GL' => 'da',
|
|
|
|
|
'de_AT' => 'de',
|
|
|
|
|
'de_BE' => 'de',
|
|
|
|
|
'de_CH' => 'de',
|
|
|
|
|
'de_DE' => 'de',
|
|
|
|
|
'de_LI' => 'de',
|
|
|
|
|
'de_LU' => 'de',
|
|
|
|
|
'de_BR' => 'de',
|
|
|
|
|
'de_US' => 'de',
|
|
|
|
|
'el_CY' => 'el',
|
|
|
|
|
'el_GR' => 'el',
|
|
|
|
|
'es_AR' => 'es',
|
|
|
|
|
'es_BO' => 'es',
|
|
|
|
|
'es_CL' => 'es',
|
|
|
|
|
'es_CO' => 'es',
|
|
|
|
|
'es_CR' => 'es',
|
|
|
|
|
'es_CU' => 'es',
|
|
|
|
|
'es_DO' => 'es',
|
|
|
|
|
'es_EC' => 'es',
|
|
|
|
|
'es_ES' => 'es',
|
|
|
|
|
'es_GQ' => 'es',
|
|
|
|
|
'es_GT' => 'es',
|
|
|
|
|
'es_HN' => 'es',
|
|
|
|
|
'es_MX' => 'es',
|
|
|
|
|
'es_NI' => 'es',
|
|
|
|
|
'es_PA' => 'es',
|
|
|
|
|
'es_PE' => 'es',
|
|
|
|
|
'es_PH' => 'es',
|
|
|
|
|
'es_PR' => 'es',
|
|
|
|
|
'es_PY' => 'es',
|
|
|
|
|
'es_SV' => 'es',
|
|
|
|
|
'es_UY' => 'es',
|
|
|
|
|
'es_VE' => 'es',
|
|
|
|
|
'es_AD' => 'es',
|
|
|
|
|
'es_BZ' => 'es',
|
|
|
|
|
'es_US' => 'es',
|
|
|
|
|
'fa_AF' => 'fa',
|
|
|
|
|
'fa_IR' => 'fa',
|
|
|
|
|
'fa_PK' => 'fa',
|
|
|
|
|
'fi_FI' => 'fi',
|
|
|
|
|
'fi_SE' => 'fi',
|
|
|
|
|
'fr_BE' => 'fr',
|
|
|
|
|
'fr_BF' => 'fr',
|
|
|
|
|
'fr_BI' => 'fr',
|
|
|
|
|
'fr_BJ' => 'fr',
|
|
|
|
|
'fr_CA' => 'fr_ca',
|
|
|
|
|
'fr_CF' => 'fr',
|
|
|
|
|
'fr_CG' => 'fr',
|
|
|
|
|
'fr_CH' => 'fr',
|
|
|
|
|
'fr_CI' => 'fr',
|
|
|
|
|
'fr_CM' => 'fr',
|
|
|
|
|
'fr_DJ' => 'fr',
|
|
|
|
|
'fr_DZ' => 'fr',
|
|
|
|
|
'fr_FR' => 'fr',
|
|
|
|
|
'fr_GA' => 'fr',
|
|
|
|
|
'fr_GF' => 'fr',
|
|
|
|
|
'fr_GN' => 'fr',
|
|
|
|
|
'fr_GP' => 'fr',
|
|
|
|
|
'fr_HT' => 'fr',
|
|
|
|
|
'fr_KM' => 'fr',
|
|
|
|
|
'fr_LU' => 'fr',
|
|
|
|
|
'fr_MA' => 'fr',
|
|
|
|
|
'fr_MC' => 'fr',
|
|
|
|
|
'fr_MG' => 'fr',
|
|
|
|
|
'fr_ML' => 'fr',
|
|
|
|
|
'fr_MQ' => 'fr',
|
|
|
|
|
'fr_MU' => 'fr',
|
|
|
|
|
'fr_NC' => 'fr',
|
|
|
|
|
'fr_NE' => 'fr',
|
|
|
|
|
'fr_PF' => 'fr',
|
|
|
|
|
'fr_PM' => 'fr',
|
|
|
|
|
'fr_RE' => 'fr',
|
|
|
|
|
'fr_RW' => 'fr',
|
|
|
|
|
'fr_SC' => 'fr',
|
|
|
|
|
'fr_SN' => 'fr',
|
|
|
|
|
'fr_SY' => 'fr',
|
|
|
|
|
'fr_TD' => 'fr',
|
|
|
|
|
'fr_TG' => 'fr',
|
|
|
|
|
'fr_TN' => 'fr',
|
|
|
|
|
'fr_VU' => 'fr',
|
|
|
|
|
'fr_WF' => 'fr',
|
|
|
|
|
'fr_YT' => 'fr',
|
|
|
|
|
'fr_GB' => 'fr',
|
|
|
|
|
'fr_US' => 'fr',
|
|
|
|
|
'he_IL' => 'he',
|
|
|
|
|
'hu_HU' => 'hu',
|
|
|
|
|
'hu_AT' => 'hu',
|
|
|
|
|
'hu_RO' => 'hu',
|
|
|
|
|
'hu_RS' => 'hu',
|
|
|
|
|
'is_IS' => 'is',
|
|
|
|
|
'it_CH' => 'it',
|
|
|
|
|
'it_IT' => 'it',
|
|
|
|
|
'it_SM' => 'it',
|
|
|
|
|
'it_FR' => 'it',
|
|
|
|
|
'it_HR' => 'it',
|
|
|
|
|
'it_US' => 'it',
|
|
|
|
|
'it_VA' => 'it',
|
|
|
|
|
'ja_JP' => 'ja',
|
|
|
|
|
'ko_KP' => 'ko',
|
|
|
|
|
'ko_KR' => 'ko',
|
|
|
|
|
'ko_CN' => 'ko',
|
2012-08-13 00:15:28 +02:00
|
|
|
|
'mi_NZ' => 'mi_NZ',
|
2007-10-08 23:55:15 +02:00
|
|
|
|
'nb_NO' => 'nb',
|
|
|
|
|
'nb_SJ' => 'nb',
|
|
|
|
|
'nl_AN' => 'nl',
|
|
|
|
|
'nl_AW' => 'nl',
|
|
|
|
|
'nl_BE' => 'nl',
|
|
|
|
|
'nl_NL' => 'nl',
|
|
|
|
|
'nl_SR' => 'nl',
|
|
|
|
|
'nn_NO' => 'nn',
|
|
|
|
|
'pl_PL' => 'pl',
|
|
|
|
|
'pl_UA' => 'pl',
|
2012-12-14 01:47:32 +01:00
|
|
|
|
'pt_AO' => 'pt',
|
|
|
|
|
'pt_BR' => 'pt',
|
|
|
|
|
'pt_CV' => 'pt',
|
|
|
|
|
'pt_GW' => 'pt',
|
|
|
|
|
'pt_MZ' => 'pt',
|
|
|
|
|
'pt_PT' => 'pt',
|
|
|
|
|
'pt_ST' => 'pt',
|
|
|
|
|
'pt_TL' => 'pt',
|
2007-10-08 23:55:15 +02:00
|
|
|
|
'ro_MD' => 'ro',
|
|
|
|
|
'ro_RO' => 'ro',
|
|
|
|
|
'ro_RS' => 'ro',
|
|
|
|
|
'ru_BY' => 'ru',
|
|
|
|
|
'ru_KG' => 'ru',
|
|
|
|
|
'ru_KZ' => 'ru',
|
|
|
|
|
'ru_RU' => 'ru',
|
|
|
|
|
'ru_SJ' => 'ru',
|
|
|
|
|
'ru_UA' => 'ru',
|
|
|
|
|
'si_LK' => 'si',
|
|
|
|
|
'sk_SK' => 'sk',
|
|
|
|
|
'sk_RS' => 'sk',
|
|
|
|
|
'sq_AL' => 'sq',
|
|
|
|
|
'sr_BA' => 'sr',
|
|
|
|
|
'sr_ME' => 'sr',
|
|
|
|
|
'sr_RS' => 'sr',
|
|
|
|
|
'sv_FI' => 'sv',
|
|
|
|
|
'sv_SE' => 'sv',
|
|
|
|
|
'tr_CY' => 'tr',
|
|
|
|
|
'tr_TR' => 'tr',
|
|
|
|
|
'tr_DE' => 'tr',
|
|
|
|
|
'tr_MK' => 'tr',
|
|
|
|
|
'uk_UA' => 'uk',
|
|
|
|
|
'vi_VN' => 'vi',
|
|
|
|
|
'vi_US' => 'vi',
|
2013-10-06 23:50:20 +02:00
|
|
|
|
'zh_CN' => 'zh-cn',
|
|
|
|
|
'zh_HK' => 'zh-cn',
|
|
|
|
|
'zh_MO' => 'zh-cn',
|
|
|
|
|
'zh_SG' => 'zh-cn',
|
|
|
|
|
'zh_TW' => 'zh-tw',
|
|
|
|
|
'zh_ID' => 'zh-cn',
|
|
|
|
|
'zh_MY' => 'zh-cn',
|
|
|
|
|
'zh_TH' => 'zh-cn',
|
|
|
|
|
'zh_US' => 'zn-cn',
|
2007-10-08 23:55:15 +02:00
|
|
|
|
|
|
|
|
|
);
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2009-03-20 09:36:40 +01:00
|
|
|
|
/**
|
2013-03-21 19:48:54 +01:00
|
|
|
|
* @config
|
2009-03-20 09:36:40 +01:00
|
|
|
|
* @var array $likely_subtags Provides you "likely locales"
|
|
|
|
|
* for a given "short" language code. This is a guess,
|
|
|
|
|
* as we can't disambiguate from e.g. "en" to "en_US" - it
|
|
|
|
|
* could also mean "en_UK".
|
|
|
|
|
* @see http://www.unicode.org/cldr/data/charts/supplemental/likely_subtags.html
|
|
|
|
|
*/
|
2013-03-21 19:48:54 +01:00
|
|
|
|
private static $likely_subtags = array(
|
2009-03-20 09:36:40 +01:00
|
|
|
|
'aa' => 'aa_ET',
|
|
|
|
|
'ab' => 'ab_GE',
|
|
|
|
|
'ady' => 'ady_RU',
|
|
|
|
|
'af' => 'af_ZA',
|
|
|
|
|
'ak' => 'ak_GH',
|
|
|
|
|
'am' => 'am_ET',
|
|
|
|
|
'ar' => 'ar_EG',
|
|
|
|
|
'as' => 'as_IN',
|
|
|
|
|
'ast' => 'ast_ES',
|
|
|
|
|
'av' => 'av_RU',
|
|
|
|
|
'ay' => 'ay_BO',
|
|
|
|
|
'az' => 'az_AZ',
|
|
|
|
|
'az_Cyrl' => 'az_AZ',
|
|
|
|
|
'az_Arab' => 'az_IR',
|
|
|
|
|
'az_IR' => 'az_IR',
|
|
|
|
|
'ba' => 'ba_RU',
|
|
|
|
|
'be' => 'be_BY',
|
|
|
|
|
'bg' => 'bg_BG',
|
|
|
|
|
'bi' => 'bi_VU',
|
|
|
|
|
'bn' => 'bn_BD',
|
|
|
|
|
'bo' => 'bo_CN',
|
|
|
|
|
'bs' => 'bs_BA',
|
|
|
|
|
'ca' => 'ca_ES',
|
|
|
|
|
'ce' => 'ce_RU',
|
|
|
|
|
'ceb' => 'ceb_PH',
|
|
|
|
|
'ch' => 'ch_GU',
|
|
|
|
|
'chk' => 'chk_FM',
|
|
|
|
|
'crk' => 'crk_CA',
|
|
|
|
|
'cs' => 'cs_CZ',
|
|
|
|
|
'cwd' => 'cwd_CA',
|
|
|
|
|
'cy' => 'cy_GB',
|
|
|
|
|
'da' => 'da_DK',
|
|
|
|
|
'de' => 'de_DE',
|
|
|
|
|
'dv' => 'dv_MV',
|
|
|
|
|
'dz' => 'dz_BT',
|
|
|
|
|
'ee' => 'ee_GH',
|
|
|
|
|
'efi' => 'efi_NG',
|
|
|
|
|
'el' => 'el_GR',
|
|
|
|
|
'en' => 'en_US',
|
|
|
|
|
'es' => 'es_ES',
|
|
|
|
|
'et' => 'et_EE',
|
|
|
|
|
'eu' => 'eu_ES',
|
2012-04-15 20:54:24 +02:00
|
|
|
|
'eo' => 'eo_XX',
|
2009-03-20 09:36:40 +01:00
|
|
|
|
'fa' => 'fa_IR',
|
|
|
|
|
'fi' => 'fi_FI',
|
|
|
|
|
'fil' => 'fil_PH',
|
|
|
|
|
'fj' => 'fj_FJ',
|
|
|
|
|
'fo' => 'fo_FO',
|
|
|
|
|
'fr' => 'fr_FR',
|
|
|
|
|
'fur' => 'fur_IT',
|
|
|
|
|
'fy' => 'fy_NL',
|
|
|
|
|
'ga' => 'ga_IE',
|
|
|
|
|
'gaa' => 'gaa_GH',
|
|
|
|
|
'gd' => 'gd_GB',
|
|
|
|
|
'gil' => 'gil_KI',
|
|
|
|
|
'gl' => 'gl_ES',
|
|
|
|
|
'gn' => 'gn_PY',
|
|
|
|
|
'gu' => 'gu_IN',
|
|
|
|
|
'ha' => 'ha_NG',
|
|
|
|
|
'ha_Arab' => 'ha_SD',
|
|
|
|
|
'ha_SD' => 'ha_SD',
|
|
|
|
|
'haw' => 'haw_US',
|
|
|
|
|
'he' => 'he_IL',
|
|
|
|
|
'hi' => 'hi_IN',
|
|
|
|
|
'hil' => 'hil_PH',
|
|
|
|
|
'ho' => 'ho_PG',
|
|
|
|
|
'hr' => 'hr_HR',
|
|
|
|
|
'ht' => 'ht_HT',
|
|
|
|
|
'hu' => 'hu_HU',
|
|
|
|
|
'hy' => 'hy_AM',
|
|
|
|
|
'id' => 'id_ID',
|
|
|
|
|
'ig' => 'ig_NG',
|
|
|
|
|
'ii' => 'ii_CN',
|
|
|
|
|
'ilo' => 'ilo_PH',
|
|
|
|
|
'inh' => 'inh_RU',
|
|
|
|
|
'is' => 'is_IS',
|
|
|
|
|
'it' => 'it_IT',
|
|
|
|
|
'iu' => 'iu_CA',
|
|
|
|
|
'ja' => 'ja_JP',
|
|
|
|
|
'jv' => 'jv_ID',
|
|
|
|
|
'ka' => 'ka_GE',
|
|
|
|
|
'kaj' => 'kaj_NG',
|
|
|
|
|
'kam' => 'kam_KE',
|
|
|
|
|
'kbd' => 'kbd_RU',
|
|
|
|
|
'kha' => 'kha_IN',
|
|
|
|
|
'kk' => 'kk_KZ',
|
|
|
|
|
'kl' => 'kl_GL',
|
|
|
|
|
'km' => 'km_KH',
|
|
|
|
|
'kn' => 'kn_IN',
|
|
|
|
|
'ko' => 'ko_KR',
|
|
|
|
|
'koi' => 'koi_RU',
|
|
|
|
|
'kok' => 'kok_IN',
|
|
|
|
|
'kos' => 'kos_FM',
|
|
|
|
|
'kpe' => 'kpe_LR',
|
|
|
|
|
'kpv' => 'kpv_RU',
|
|
|
|
|
'krc' => 'krc_RU',
|
|
|
|
|
'ks' => 'ks_IN',
|
|
|
|
|
'ku' => 'ku_IQ',
|
|
|
|
|
'ku_Latn' => 'ku_TR',
|
|
|
|
|
'ku_TR' => 'ku_TR',
|
|
|
|
|
'kum' => 'kum_RU',
|
2012-04-15 20:54:24 +02:00
|
|
|
|
'kxm' => 'kxm_TH',
|
2009-03-20 09:36:40 +01:00
|
|
|
|
'ky' => 'ky_KG',
|
|
|
|
|
'la' => 'la_VA',
|
|
|
|
|
'lah' => 'lah_PK',
|
|
|
|
|
'lb' => 'lb_LU',
|
|
|
|
|
'lbe' => 'lbe_RU',
|
|
|
|
|
'lez' => 'lez_RU',
|
|
|
|
|
'ln' => 'ln_CD',
|
|
|
|
|
'lo' => 'lo_LA',
|
|
|
|
|
'lt' => 'lt_LT',
|
|
|
|
|
'lv' => 'lv_LV',
|
|
|
|
|
'mai' => 'mai_IN',
|
|
|
|
|
'mdf' => 'mdf_RU',
|
|
|
|
|
'mdh' => 'mdh_PH',
|
|
|
|
|
'mg' => 'mg_MG',
|
|
|
|
|
'mh' => 'mh_MH',
|
|
|
|
|
'mi' => 'mi_NZ',
|
|
|
|
|
'mk' => 'mk_MK',
|
|
|
|
|
'ml' => 'ml_IN',
|
|
|
|
|
'mn' => 'mn_MN',
|
|
|
|
|
'mn_CN' => 'mn_CN',
|
|
|
|
|
'mn_Mong' => 'mn_CN',
|
|
|
|
|
'mr' => 'mr_IN',
|
|
|
|
|
'ms' => 'ms_MY',
|
|
|
|
|
'mt' => 'mt_MT',
|
|
|
|
|
'my' => 'my_MM',
|
|
|
|
|
'myv' => 'myv_RU',
|
|
|
|
|
'na' => 'na_NR',
|
|
|
|
|
'nb' => 'nb_NO',
|
|
|
|
|
'ne' => 'ne_NP',
|
|
|
|
|
'niu' => 'niu_NU',
|
|
|
|
|
'nl' => 'nl_NL',
|
|
|
|
|
'nn' => 'nn_NO',
|
|
|
|
|
'nr' => 'nr_ZA',
|
|
|
|
|
'nso' => 'nso_ZA',
|
|
|
|
|
'ny' => 'ny_MW',
|
|
|
|
|
'om' => 'om_ET',
|
|
|
|
|
'or' => 'or_IN',
|
|
|
|
|
'os' => 'os_GE',
|
|
|
|
|
'pa' => 'pa_IN',
|
|
|
|
|
'pa_Arab' => 'pa_PK',
|
|
|
|
|
'pa_PK' => 'pa_PK',
|
|
|
|
|
'pag' => 'pag_PH',
|
|
|
|
|
'pap' => 'pap_AN',
|
|
|
|
|
'pau' => 'pau_PW',
|
|
|
|
|
'pl' => 'pl_PL',
|
|
|
|
|
'pon' => 'pon_FM',
|
|
|
|
|
'ps' => 'ps_AF',
|
|
|
|
|
'pt' => 'pt_BR',
|
|
|
|
|
'qu' => 'qu_PE',
|
|
|
|
|
'rm' => 'rm_CH',
|
|
|
|
|
'rn' => 'rn_BI',
|
|
|
|
|
'ro' => 'ro_RO',
|
|
|
|
|
'ru' => 'ru_RU',
|
|
|
|
|
'rw' => 'rw_RW',
|
|
|
|
|
'sa' => 'sa_IN',
|
|
|
|
|
'sah' => 'sah_RU',
|
|
|
|
|
'sat' => 'sat_IN',
|
|
|
|
|
'sd' => 'sd_IN',
|
|
|
|
|
'se' => 'se_NO',
|
|
|
|
|
'sg' => 'sg_CF',
|
|
|
|
|
'si' => 'si_LK',
|
|
|
|
|
'sid' => 'sid_ET',
|
|
|
|
|
'sk' => 'sk_SK',
|
|
|
|
|
'sl' => 'sl_SI',
|
|
|
|
|
'sm' => 'sm_WS',
|
|
|
|
|
'sn' => 'sn_ZW',
|
|
|
|
|
'so' => 'so_SO',
|
|
|
|
|
'sq' => 'sq_AL',
|
|
|
|
|
'sr' => 'sr_RS',
|
|
|
|
|
'ss' => 'ss_ZA',
|
|
|
|
|
'st' => 'st_ZA',
|
|
|
|
|
'su' => 'su_ID',
|
|
|
|
|
'sv' => 'sv_SE',
|
|
|
|
|
'sw' => 'sw_TZ',
|
|
|
|
|
'swb' => 'swb_KM',
|
|
|
|
|
'ta' => 'ta_IN',
|
|
|
|
|
'te' => 'te_IN',
|
|
|
|
|
'tet' => 'tet_TL',
|
|
|
|
|
'tg' => 'tg_TJ',
|
|
|
|
|
'th' => 'th_TH',
|
|
|
|
|
'ti' => 'ti_ET',
|
|
|
|
|
'tig' => 'tig_ER',
|
|
|
|
|
'tk' => 'tk_TM',
|
|
|
|
|
'tkl' => 'tkl_TK',
|
|
|
|
|
'tl' => 'tl_PH',
|
|
|
|
|
'tn' => 'tn_ZA',
|
|
|
|
|
'to' => 'to_TO',
|
|
|
|
|
'tpi' => 'tpi_PG',
|
|
|
|
|
'tr' => 'tr_TR',
|
|
|
|
|
'trv' => 'trv_TW',
|
|
|
|
|
'ts' => 'ts_ZA',
|
|
|
|
|
'tsg' => 'tsg_PH',
|
|
|
|
|
'tt' => 'tt_RU',
|
|
|
|
|
'tts' => 'tts_TH',
|
|
|
|
|
'tvl' => 'tvl_TV',
|
|
|
|
|
'tw' => 'tw_GH',
|
|
|
|
|
'ty' => 'ty_PF',
|
|
|
|
|
'tyv' => 'tyv_RU',
|
|
|
|
|
'udm' => 'udm_RU',
|
|
|
|
|
'ug' => 'ug_CN',
|
|
|
|
|
'uk' => 'uk_UA',
|
|
|
|
|
'uli' => 'uli_FM',
|
|
|
|
|
'und' => 'en_US',
|
|
|
|
|
'und_AD' => 'ca_AD',
|
|
|
|
|
'und_AE' => 'ar_AE',
|
|
|
|
|
'und_AF' => 'fa_AF',
|
|
|
|
|
'und_AL' => 'sq_AL',
|
|
|
|
|
'und_AM' => 'hy_AM',
|
|
|
|
|
'und_AN' => 'pap_AN',
|
|
|
|
|
'und_AO' => 'pt_AO',
|
|
|
|
|
'und_AR' => 'es_AR',
|
|
|
|
|
'und_AS' => 'sm_AS',
|
|
|
|
|
'und_AT' => 'de_AT',
|
|
|
|
|
'und_AW' => 'nl_AW',
|
|
|
|
|
'und_AX' => 'sv_AX',
|
|
|
|
|
'und_AZ' => 'az_AZ',
|
|
|
|
|
'und_Arab' => 'ar_EG',
|
|
|
|
|
'und_Arab_CN' => 'ug_CN',
|
|
|
|
|
'und_Arab_DJ' => 'ar_DJ',
|
|
|
|
|
'und_Arab_ER' => 'ar_ER',
|
|
|
|
|
'und_Arab_IL' => 'ar_IL',
|
|
|
|
|
'und_Arab_IN' => 'ur_IN',
|
|
|
|
|
'und_Arab_PK' => 'ur_PK',
|
|
|
|
|
'und_Armn' => 'hy_AM',
|
|
|
|
|
'und_BA' => 'bs_BA',
|
|
|
|
|
'und_BD' => 'bn_BD',
|
|
|
|
|
'und_BE' => 'nl_BE',
|
|
|
|
|
'und_BF' => 'fr_BF',
|
|
|
|
|
'und_BG' => 'bg_BG',
|
|
|
|
|
'und_BH' => 'ar_BH',
|
|
|
|
|
'und_BI' => 'rn_BI',
|
|
|
|
|
'und_BJ' => 'fr_BJ',
|
|
|
|
|
'und_BL' => 'fr_BL',
|
|
|
|
|
'und_BN' => 'ms_BN',
|
|
|
|
|
'und_BO' => 'es_BO',
|
|
|
|
|
'und_BR' => 'pt_BR',
|
|
|
|
|
'und_BT' => 'dz_BT',
|
|
|
|
|
'und_BY' => 'be_BY',
|
|
|
|
|
'und_Beng' => 'bn_BD',
|
|
|
|
|
'und_CD' => 'fr_CD',
|
|
|
|
|
'und_CF' => 'sg_CF',
|
|
|
|
|
'und_CG' => 'ln_CG',
|
|
|
|
|
'und_CH' => 'de_CH',
|
|
|
|
|
'und_CI' => 'fr_CI',
|
|
|
|
|
'und_CL' => 'es_CL',
|
|
|
|
|
'und_CM' => 'fr_CM',
|
|
|
|
|
'und_CN' => 'zh_CN',
|
|
|
|
|
'und_CO' => 'es_CO',
|
|
|
|
|
'und_CR' => 'es_CR',
|
|
|
|
|
'und_CU' => 'es_CU',
|
|
|
|
|
'und_CV' => 'pt_CV',
|
|
|
|
|
'und_CY' => 'el_CY',
|
|
|
|
|
'und_CZ' => 'cs_CZ',
|
|
|
|
|
'und_Cans' => 'cwd_CA',
|
|
|
|
|
'und_Cyrl' => 'ru_RU',
|
|
|
|
|
'und_Cyrl_BA' => 'sr_BA',
|
|
|
|
|
'und_Cyrl_GE' => 'ab_GE',
|
|
|
|
|
'und_DE' => 'de_DE',
|
|
|
|
|
'und_DJ' => 'aa_DJ',
|
|
|
|
|
'und_DK' => 'da_DK',
|
|
|
|
|
'und_DO' => 'es_DO',
|
|
|
|
|
'und_DZ' => 'ar_DZ',
|
|
|
|
|
'und_Deva' => 'hi_IN',
|
|
|
|
|
'und_EC' => 'es_EC',
|
|
|
|
|
'und_EE' => 'et_EE',
|
|
|
|
|
'und_EG' => 'ar_EG',
|
|
|
|
|
'und_EH' => 'ar_EH',
|
|
|
|
|
'und_ER' => 'ti_ER',
|
|
|
|
|
'und_ES' => 'es_ES',
|
|
|
|
|
'und_ET' => 'am_ET',
|
|
|
|
|
'und_Ethi' => 'am_ET',
|
|
|
|
|
'und_FI' => 'fi_FI',
|
|
|
|
|
'und_FJ' => 'fj_FJ',
|
|
|
|
|
'und_FM' => 'chk_FM',
|
|
|
|
|
'und_FO' => 'fo_FO',
|
|
|
|
|
'und_FR' => 'fr_FR',
|
|
|
|
|
'und_GA' => 'fr_GA',
|
|
|
|
|
'und_GE' => 'ka_GE',
|
|
|
|
|
'und_GF' => 'fr_GF',
|
|
|
|
|
'und_GH' => 'ak_GH',
|
|
|
|
|
'und_GL' => 'kl_GL',
|
|
|
|
|
'und_GN' => 'fr_GN',
|
|
|
|
|
'und_GP' => 'fr_GP',
|
|
|
|
|
'und_GQ' => 'fr_GQ',
|
|
|
|
|
'und_GR' => 'el_GR',
|
|
|
|
|
'und_GT' => 'es_GT',
|
|
|
|
|
'und_GU' => 'ch_GU',
|
|
|
|
|
'und_GW' => 'pt_GW',
|
|
|
|
|
'und_Geor' => 'ka_GE',
|
|
|
|
|
'und_Grek' => 'el_GR',
|
|
|
|
|
'und_Gujr' => 'gu_IN',
|
|
|
|
|
'und_Guru' => 'pa_IN',
|
|
|
|
|
'und_HK' => 'zh_HK',
|
|
|
|
|
'und_HN' => 'es_HN',
|
|
|
|
|
'und_HR' => 'hr_HR',
|
|
|
|
|
'und_HT' => 'ht_HT',
|
|
|
|
|
'und_HU' => 'hu_HU',
|
|
|
|
|
'und_Hani' => 'zh_CN',
|
|
|
|
|
'und_Hans' => 'zh_CN',
|
|
|
|
|
'und_Hant' => 'zh_TW',
|
|
|
|
|
'und_Hebr' => 'he_IL',
|
|
|
|
|
'und_ID' => 'id_ID',
|
|
|
|
|
'und_IL' => 'he_IL',
|
|
|
|
|
'und_IN' => 'hi_IN',
|
|
|
|
|
'und_IQ' => 'ar_IQ',
|
|
|
|
|
'und_IR' => 'fa_IR',
|
|
|
|
|
'und_IS' => 'is_IS',
|
|
|
|
|
'und_IT' => 'it_IT',
|
|
|
|
|
'und_JO' => 'ar_JO',
|
|
|
|
|
'und_JP' => 'ja_JP',
|
|
|
|
|
'und_Jpan' => 'ja_JP',
|
|
|
|
|
'und_KG' => 'ky_KG',
|
|
|
|
|
'und_KH' => 'km_KH',
|
|
|
|
|
'und_KM' => 'ar_KM',
|
|
|
|
|
'und_KP' => 'ko_KP',
|
|
|
|
|
'und_KR' => 'ko_KR',
|
|
|
|
|
'und_KW' => 'ar_KW',
|
|
|
|
|
'und_KZ' => 'ru_KZ',
|
|
|
|
|
'und_Khmr' => 'km_KH',
|
|
|
|
|
'und_Knda' => 'kn_IN',
|
|
|
|
|
'und_Kore' => 'ko_KR',
|
|
|
|
|
'und_LA' => 'lo_LA',
|
|
|
|
|
'und_LB' => 'ar_LB',
|
|
|
|
|
'und_LI' => 'de_LI',
|
|
|
|
|
'und_LK' => 'si_LK',
|
|
|
|
|
'und_LS' => 'st_LS',
|
|
|
|
|
'und_LT' => 'lt_LT',
|
|
|
|
|
'und_LU' => 'fr_LU',
|
|
|
|
|
'und_LV' => 'lv_LV',
|
|
|
|
|
'und_LY' => 'ar_LY',
|
|
|
|
|
'und_Laoo' => 'lo_LA',
|
|
|
|
|
'und_Latn_CN' => 'ii_CN',
|
|
|
|
|
'und_Latn_CY' => 'tr_CY',
|
|
|
|
|
'und_Latn_DZ' => 'fr_DZ',
|
|
|
|
|
'und_Latn_ET' => 'om_ET',
|
|
|
|
|
'und_Latn_KM' => 'fr_KM',
|
|
|
|
|
'und_Latn_MA' => 'fr_MA',
|
|
|
|
|
'und_Latn_MK' => 'sq_MK',
|
|
|
|
|
'und_Latn_SY' => 'fr_SY',
|
|
|
|
|
'und_Latn_TD' => 'fr_TD',
|
|
|
|
|
'und_Latn_TN' => 'fr_TN',
|
|
|
|
|
'und_MA' => 'ar_MA',
|
|
|
|
|
'und_MC' => 'fr_MC',
|
|
|
|
|
'und_MD' => 'ro_MD',
|
|
|
|
|
'und_ME' => 'sr_ME',
|
|
|
|
|
'und_MF' => 'fr_MF',
|
|
|
|
|
'und_MG' => 'mg_MG',
|
|
|
|
|
'und_MH' => 'mh_MH',
|
|
|
|
|
'und_MK' => 'mk_MK',
|
|
|
|
|
'und_ML' => 'fr_ML',
|
|
|
|
|
'und_MM' => 'my_MM',
|
|
|
|
|
'und_MN' => 'mn_MN',
|
|
|
|
|
'und_MO' => 'zh_MO',
|
|
|
|
|
'und_MQ' => 'fr_MQ',
|
|
|
|
|
'und_MR' => 'ar_MR',
|
|
|
|
|
'und_MT' => 'mt_MT',
|
|
|
|
|
'und_MV' => 'dv_MV',
|
|
|
|
|
'und_MW' => 'ny_MW',
|
|
|
|
|
'und_MX' => 'es_MX',
|
|
|
|
|
'und_MY' => 'ms_MY',
|
|
|
|
|
'und_MZ' => 'pt_MZ',
|
|
|
|
|
'und_Mlym' => 'ml_IN',
|
|
|
|
|
'und_Mong' => 'mn_CN',
|
|
|
|
|
'und_Mymr' => 'my_MM',
|
|
|
|
|
'und_NC' => 'fr_NC',
|
|
|
|
|
'und_NE' => 'ha_NE',
|
|
|
|
|
'und_NG' => 'ha_NG',
|
|
|
|
|
'und_NI' => 'es_NI',
|
|
|
|
|
'und_NL' => 'nl_NL',
|
|
|
|
|
'und_NO' => 'nb_NO',
|
|
|
|
|
'und_NP' => 'ne_NP',
|
|
|
|
|
'und_NR' => 'na_NR',
|
|
|
|
|
'und_NU' => 'niu_NU',
|
|
|
|
|
'und_OM' => 'ar_OM',
|
|
|
|
|
'und_Orya' => 'or_IN',
|
|
|
|
|
'und_PA' => 'es_PA',
|
|
|
|
|
'und_PE' => 'es_PE',
|
|
|
|
|
'und_PF' => 'ty_PF',
|
|
|
|
|
'und_PG' => 'tpi_PG',
|
|
|
|
|
'und_PH' => 'fil_PH',
|
|
|
|
|
'und_PK' => 'ur_PK',
|
|
|
|
|
'und_PL' => 'pl_PL',
|
|
|
|
|
'und_PM' => 'fr_PM',
|
|
|
|
|
'und_PR' => 'es_PR',
|
|
|
|
|
'und_PS' => 'ar_PS',
|
|
|
|
|
'und_PT' => 'pt_PT',
|
|
|
|
|
'und_PW' => 'pau_PW',
|
|
|
|
|
'und_PY' => 'gn_PY',
|
|
|
|
|
'und_QA' => 'ar_QA',
|
|
|
|
|
'und_RE' => 'fr_RE',
|
|
|
|
|
'und_RO' => 'ro_RO',
|
|
|
|
|
'und_RS' => 'sr_RS',
|
|
|
|
|
'und_RU' => 'ru_RU',
|
|
|
|
|
'und_RW' => 'rw_RW',
|
|
|
|
|
'und_SA' => 'ar_SA',
|
|
|
|
|
'und_SD' => 'ar_SD',
|
|
|
|
|
'und_SE' => 'sv_SE',
|
|
|
|
|
'und_SI' => 'sl_SI',
|
|
|
|
|
'und_SJ' => 'nb_SJ',
|
|
|
|
|
'und_SK' => 'sk_SK',
|
|
|
|
|
'und_SM' => 'it_SM',
|
|
|
|
|
'und_SN' => 'fr_SN',
|
|
|
|
|
'und_SO' => 'so_SO',
|
|
|
|
|
'und_SR' => 'nl_SR',
|
|
|
|
|
'und_ST' => 'pt_ST',
|
|
|
|
|
'und_SV' => 'es_SV',
|
|
|
|
|
'und_SY' => 'ar_SY',
|
|
|
|
|
'und_Sinh' => 'si_LK',
|
|
|
|
|
'und_TD' => 'ar_TD',
|
|
|
|
|
'und_TG' => 'ee_TG',
|
|
|
|
|
'und_TH' => 'th_TH',
|
|
|
|
|
'und_TJ' => 'tg_TJ',
|
|
|
|
|
'und_TK' => 'tkl_TK',
|
|
|
|
|
'und_TL' => 'tet_TL',
|
|
|
|
|
'und_TM' => 'tk_TM',
|
|
|
|
|
'und_TN' => 'ar_TN',
|
|
|
|
|
'und_TO' => 'to_TO',
|
|
|
|
|
'und_TR' => 'tr_TR',
|
|
|
|
|
'und_TV' => 'tvl_TV',
|
|
|
|
|
'und_TW' => 'zh_TW',
|
|
|
|
|
'und_Taml' => 'ta_IN',
|
|
|
|
|
'und_Telu' => 'te_IN',
|
|
|
|
|
'und_Thaa' => 'dv_MV',
|
|
|
|
|
'und_Thai' => 'th_TH',
|
|
|
|
|
'und_Tibt' => 'bo_CN',
|
|
|
|
|
'und_UA' => 'uk_UA',
|
|
|
|
|
'und_UY' => 'es_UY',
|
|
|
|
|
'und_UZ' => 'uz_UZ',
|
|
|
|
|
'und_VA' => 'la_VA',
|
|
|
|
|
'und_VE' => 'es_VE',
|
|
|
|
|
'und_VN' => 'vi_VN',
|
|
|
|
|
'und_VU' => 'fr_VU',
|
|
|
|
|
'und_WF' => 'fr_WF',
|
|
|
|
|
'und_WS' => 'sm_WS',
|
|
|
|
|
'und_YE' => 'ar_YE',
|
|
|
|
|
'und_YT' => 'fr_YT',
|
|
|
|
|
'und_ZW' => 'sn_ZW',
|
|
|
|
|
'ur' => 'ur_PK',
|
|
|
|
|
'uz' => 'uz_UZ',
|
|
|
|
|
'uz_AF' => 'uz_AF',
|
|
|
|
|
'uz_Arab' => 'uz_AF',
|
|
|
|
|
've' => 've_ZA',
|
|
|
|
|
'vi' => 'vi_VN',
|
|
|
|
|
'wal' => 'wal_ET',
|
|
|
|
|
'war' => 'war_PH',
|
|
|
|
|
'wo' => 'wo_SN',
|
|
|
|
|
'xh' => 'xh_ZA',
|
|
|
|
|
'yap' => 'yap_FM',
|
|
|
|
|
'yo' => 'yo_NG',
|
|
|
|
|
'za' => 'za_CN',
|
|
|
|
|
'zh' => 'zh_CN',
|
|
|
|
|
'zh_HK' => 'zh_HK',
|
|
|
|
|
'zh_Hani' => 'zh_CN',
|
|
|
|
|
'zh_Hant' => 'zh_TW',
|
|
|
|
|
'zh_MO' => 'zh_MO',
|
|
|
|
|
'zh_TW' => 'zh_TW',
|
|
|
|
|
'zu' => 'zu_ZA',
|
|
|
|
|
);
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2008-10-17 17:40:59 +02:00
|
|
|
|
/**
|
2012-09-26 23:34:00 +02:00
|
|
|
|
* This is the main translator function. Returns the string defined by $class and $entity according to the
|
|
|
|
|
* currently set locale.
|
2008-10-17 17:40:59 +02:00
|
|
|
|
*
|
2012-09-26 23:34:00 +02:00
|
|
|
|
* @param string $entity Entity that identifies the string. It must be in the form "Namespace.Entity" where
|
|
|
|
|
* Namespace will be usually the class name where this string is used and Entity identifies
|
|
|
|
|
* the string inside the namespace.
|
|
|
|
|
* @param string $string The original string itself. In a usual call this is a mandatory parameter, but if you are
|
|
|
|
|
* reusing a string which has already been "declared" (using another call to this function,
|
|
|
|
|
* with the same class and entity), you can omit it.
|
|
|
|
|
* @param string $context (optional) If the string can be difficult to translate by any reason, you can help
|
2017-06-16 00:22:09 +02:00
|
|
|
|
* translators with some more info using this param
|
|
|
|
|
* @param array $injection (optional) array of key value pairs that are used to replace corresponding
|
|
|
|
|
* expressions in {curly brackets} in the $string. The injection array can also be
|
|
|
|
|
* used as the their argument to the _t() function. The injection array can be the second,
|
|
|
|
|
* third or fourth parameter. The function will use the first parameter that is an array
|
2008-10-17 17:40:59 +02:00
|
|
|
|
* @return string The translated string, according to the currently set locale {@link i18n::set_locale()}
|
|
|
|
|
*/
|
2017-06-16 00:22:09 +02:00
|
|
|
|
public static function _t($entity, $string = "", $context = "", $injection = array()) {
|
2012-04-14 00:16:30 +02:00
|
|
|
|
if(is_numeric($context) && in_array($context, array(PR_LOW, PR_MEDIUM, PR_HIGH))) {
|
|
|
|
|
Deprecation::notice(
|
2012-04-16 07:37:57 +02:00
|
|
|
|
'3.0',
|
2012-07-13 11:37:35 +02:00
|
|
|
|
'The $priority argument to _t() is deprecated, please use module inclusion priorities instead',
|
|
|
|
|
Deprecation::SCOPE_GLOBAL
|
2012-04-14 00:16:30 +02:00
|
|
|
|
);
|
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
|
|
|
|
|
|
//fetch the injection array out of the parameters (if it is present)
|
|
|
|
|
$argList = func_get_args();
|
|
|
|
|
$argNum = func_num_args();
|
|
|
|
|
//_t($entity, $string = "", $context (optional), $injectionArray (optional))
|
|
|
|
|
$injectionArray = null;
|
|
|
|
|
for($i = 0; $i < $argNum; $i++) {
|
|
|
|
|
if (is_array($argList[$i])) { //we have reached the injectionArray
|
|
|
|
|
$injectionArray = $argList[$i]; //any array in the args will be the injection array
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-04 18:36:45 +01:00
|
|
|
|
// get current locale (either default or user preference)
|
|
|
|
|
$locale = i18n::get_locale();
|
|
|
|
|
$lang = i18n::get_lang_from_locale($locale);
|
2012-04-16 07:37:57 +02:00
|
|
|
|
|
2011-12-04 21:39:17 +01:00
|
|
|
|
// Only call getter if static isn't already defined (for performance reasons)
|
2011-12-20 12:00:02 +01:00
|
|
|
|
$translatorsByPrio = self::$translators;
|
|
|
|
|
if(!$translatorsByPrio) $translatorsByPrio = self::get_translators();
|
2012-04-16 07:37:57 +02:00
|
|
|
|
|
2012-05-01 22:13:50 +02:00
|
|
|
|
$returnValue = (is_string($string)) ? $string : ''; // Fall back to default string argument
|
2012-04-16 07:37:57 +02:00
|
|
|
|
|
2011-12-20 12:00:02 +01:00
|
|
|
|
foreach($translatorsByPrio as $priority => $translators) {
|
2011-11-26 14:34:11 +01:00
|
|
|
|
foreach($translators as $name => $translator) {
|
|
|
|
|
$adapter = $translator->getAdapter();
|
|
|
|
|
|
2012-05-23 01:43:44 +02:00
|
|
|
|
// at this point, we need to ensure the language and locale are loaded
|
|
|
|
|
// as include_by_locale() doesn't load a fallback.
|
|
|
|
|
|
|
|
|
|
// TODO Remove reliance on global state, by refactoring into an i18nTranslatorManager
|
|
|
|
|
// which is instanciated by core with a $clean instance variable.
|
|
|
|
|
|
|
|
|
|
if(!$adapter->isAvailable($lang)) {
|
2014-08-16 02:51:17 +02:00
|
|
|
|
i18n::include_by_locale($lang);
|
2012-05-23 01:43:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!$adapter->isAvailable($locale)) {
|
2014-08-16 02:51:17 +02:00
|
|
|
|
i18n::include_by_locale($locale);
|
2011-12-04 18:36:45 +01:00
|
|
|
|
}
|
2012-05-23 01:43:44 +02:00
|
|
|
|
|
2011-11-26 14:34:11 +01:00
|
|
|
|
$translation = $adapter->translate($entity, $locale);
|
|
|
|
|
|
2013-08-03 20:18:06 +02:00
|
|
|
|
// Return translation only if we found a match thats not the entity itself (Zend fallback)
|
2012-04-18 03:21:07 +02:00
|
|
|
|
if($translation && $translation != $entity) {
|
2013-08-03 20:18:06 +02:00
|
|
|
|
$returnValue = $translation;
|
2012-04-18 03:21:07 +02:00
|
|
|
|
break 2;
|
2013-08-03 20:18:06 +02:00
|
|
|
|
}
|
2012-04-18 03:21:07 +02:00
|
|
|
|
}
|
2011-11-26 14:34:11 +01:00
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
|
|
|
|
|
|
// inject the variables from injectionArray (if present)
|
2012-05-01 20:56:07 +02:00
|
|
|
|
if($injectionArray) {
|
|
|
|
|
$regex = '/\{[\w\d]*\}/i';
|
|
|
|
|
if(!preg_match($regex, $returnValue)) {
|
2014-08-04 22:26:22 +02:00
|
|
|
|
// Legacy mode: If no injection placeholders are found,
|
2012-05-01 20:56:07 +02:00
|
|
|
|
// replace sprintf placeholders in fixed order.
|
2012-06-04 11:40:55 +02:00
|
|
|
|
// Fail silently in case the translation is outdated
|
2012-12-21 11:46:30 +01:00
|
|
|
|
preg_match_all('/%[s,d]/', $returnValue, $returnValueArgs);
|
|
|
|
|
if($returnValueArgs) foreach($returnValueArgs[0] as $i => $returnValueArg) {
|
|
|
|
|
if($i >= count($injectionArray)) {
|
|
|
|
|
$injectionArray[] = '';
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
$replaced = vsprintf($returnValue, array_values($injectionArray));
|
2012-06-04 11:40:55 +02:00
|
|
|
|
if($replaced) $returnValue = $replaced;
|
2012-05-01 20:56:07 +02:00
|
|
|
|
} else if(!ArrayLib::is_associative($injectionArray)) {
|
|
|
|
|
// Legacy mode: If injection placeholders are found,
|
|
|
|
|
// but parameters are passed without names, replace them in fixed order.
|
|
|
|
|
$returnValue = preg_replace_callback(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
$regex,
|
2012-05-01 20:56:07 +02:00
|
|
|
|
function($matches) use(&$injectionArray) {
|
|
|
|
|
return $injectionArray ? array_shift($injectionArray) : '';
|
|
|
|
|
},
|
|
|
|
|
$returnValue
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
// Standard placeholder replacement with named injections and variable order.
|
|
|
|
|
foreach($injectionArray as $variable => $injection) {
|
|
|
|
|
$placeholder = '{'.$variable.'}';
|
|
|
|
|
$returnValue = str_replace($placeholder, $injection, $returnValue, $count);
|
|
|
|
|
if(!$count) {
|
|
|
|
|
SS_Log::log(sprintf(
|
|
|
|
|
"Couldn't find placeholder '%s' in translation string '%s' (id: '%s')",
|
|
|
|
|
$placeholder,
|
|
|
|
|
$returnValue,
|
|
|
|
|
$entity
|
|
|
|
|
), SS_Log::NOTICE);
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $returnValue;
|
2011-11-26 14:34:11 +01:00
|
|
|
|
}
|
2010-10-15 03:15:54 +02:00
|
|
|
|
|
2012-04-16 07:37:57 +02:00
|
|
|
|
|
2011-11-26 14:34:11 +01:00
|
|
|
|
/**
|
|
|
|
|
* @return array Array of priority keys to instances of Zend_Translate, mapped by name.
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function get_translators() {
|
2012-04-15 18:03:51 +02:00
|
|
|
|
if(!Zend_Translate::getCache()) {
|
2014-08-16 02:51:17 +02:00
|
|
|
|
Zend_Translate::setCache(self::get_cache());
|
2012-04-15 18:03:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!self::$translators) {
|
2011-11-26 14:34:11 +01:00
|
|
|
|
$defaultPriority = 10;
|
|
|
|
|
self::$translators[$defaultPriority] = array(
|
|
|
|
|
'core' => new Zend_Translate(array(
|
|
|
|
|
'adapter' => 'i18nRailsYamlAdapter',
|
2016-01-13 09:24:15 +01:00
|
|
|
|
'locale' => Config::inst()->get('i18n', 'default_locale'),
|
2011-11-26 14:34:11 +01:00
|
|
|
|
'disableNotices' => true,
|
|
|
|
|
))
|
|
|
|
|
);
|
2012-05-23 01:43:44 +02:00
|
|
|
|
|
2014-08-16 02:51:17 +02:00
|
|
|
|
i18n::include_by_locale('en');
|
|
|
|
|
i18n::include_by_locale('en_US');
|
2011-11-26 14:34:11 +01:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2011-11-26 14:34:11 +01:00
|
|
|
|
return self::$translators;
|
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2011-11-26 14:34:11 +01:00
|
|
|
|
/**
|
|
|
|
|
* @param String
|
|
|
|
|
* @return Zend_Translate
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function get_translator($name) {
|
2011-11-26 14:34:11 +01:00
|
|
|
|
foreach(self::get_translators() as $priority => $translators) {
|
|
|
|
|
if(isset($translators[$name])) return $translators[$name];
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2011-11-26 14:34:11 +01:00
|
|
|
|
/**
|
|
|
|
|
* @param Zend_Translate Needs to implement {@link i18nTranslateAdapterInterface}
|
|
|
|
|
* @param String If left blank will override the default translator.
|
|
|
|
|
* @param Int
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function register_translator($translator, $name, $priority = 10) {
|
2011-11-26 14:34:11 +01:00
|
|
|
|
if (!is_int($priority)) throw new InvalidArgumentException("register_translator expects an int priority");
|
2009-08-27 05:09:34 +02:00
|
|
|
|
|
2011-11-26 14:34:11 +01:00
|
|
|
|
// Ensure it's not there. If it is, we're replacing it. It may exist in a different priority.
|
|
|
|
|
self::unregister_translator($name);
|
2010-12-05 09:43:38 +01:00
|
|
|
|
|
2011-11-26 14:34:11 +01:00
|
|
|
|
// Add our new translator
|
|
|
|
|
if(!isset(self::$translators[$priority])) self::$translators[$priority] = array();
|
|
|
|
|
self::$translators[$priority][$name] = $translator;
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2011-11-26 14:34:11 +01:00
|
|
|
|
// Resort array, ensuring highest priority comes first
|
|
|
|
|
krsort(self::$translators);
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2011-11-26 14:34:11 +01:00
|
|
|
|
i18n::include_by_locale('en_US');
|
2012-05-28 04:10:58 +02:00
|
|
|
|
i18n::include_by_locale('en');
|
2011-11-26 14:34:11 +01:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2011-11-26 14:34:11 +01:00
|
|
|
|
/**
|
|
|
|
|
* @param String
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function unregister_translator($name) {
|
2011-11-26 14:34:11 +01:00
|
|
|
|
foreach (self::get_translators() as $priority => $translators) {
|
|
|
|
|
if (isset($translators[$name])) unset(self::$translators[$priority][$name]);
|
|
|
|
|
}
|
2008-10-17 17:40:59 +02:00
|
|
|
|
}
|
2007-09-15 02:21:51 +02:00
|
|
|
|
|
2007-09-16 18:16:58 +02:00
|
|
|
|
/**
|
|
|
|
|
* Get a list of commonly used languages
|
|
|
|
|
*
|
|
|
|
|
* @param boolean $native Use native names for languages instead of English ones
|
|
|
|
|
* @return list of languages in the form 'code' => 'name'
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function get_common_languages($native = false) {
|
2007-09-16 18:16:58 +02:00
|
|
|
|
$languages = array();
|
2013-03-27 20:42:46 +01:00
|
|
|
|
foreach (Config::inst()->get('i18n', 'common_languages') as $code => $name) {
|
|
|
|
|
$languages[$code] = ($native ? $name['native'] : $name['name']);
|
2007-09-15 02:21:51 +02:00
|
|
|
|
}
|
2007-09-16 18:16:58 +02:00
|
|
|
|
return $languages;
|
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2009-03-20 09:36:40 +01:00
|
|
|
|
/**
|
|
|
|
|
* Get a list of commonly used locales
|
|
|
|
|
*
|
|
|
|
|
* @param boolean $native Use native names for locale instead of English ones
|
|
|
|
|
* @return list of languages in the form 'code' => 'name'
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function get_common_locales($native = false) {
|
2009-03-20 09:36:40 +01:00
|
|
|
|
$languages = array();
|
2013-03-21 19:48:54 +01:00
|
|
|
|
foreach (Config::inst()->get('i18n', 'common_locales') as $code => $name) {
|
2013-03-27 20:42:46 +01:00
|
|
|
|
$languages[$code] = ($native ? $name['native'] : $name['name']);
|
2009-03-20 09:36:40 +01:00
|
|
|
|
}
|
|
|
|
|
return $languages;
|
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2007-09-16 18:16:58 +02:00
|
|
|
|
/**
|
|
|
|
|
* Get a list of locales (code => language and country)
|
|
|
|
|
*
|
2015-06-19 01:59:27 +02:00
|
|
|
|
* @deprecated since version 4.0
|
2007-09-16 18:16:58 +02:00
|
|
|
|
* @return list of languages in the form 'code' => 'name'
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function get_locale_list() {
|
2015-06-19 01:59:27 +02:00
|
|
|
|
Deprecation::notice('4.0', 'Use the "i18n.all_locales" config setting instead');
|
2013-03-21 19:48:54 +01:00
|
|
|
|
return (array)Config::inst()->get('i18n', 'all_locales');
|
2007-09-16 18:16:58 +02:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2014-01-30 03:55:14 +01:00
|
|
|
|
/**
|
|
|
|
|
* Matches a given locale with the closest translation available in the system
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2014-01-30 03:55:14 +01:00
|
|
|
|
* @param string $locale locale code
|
|
|
|
|
* @return string Locale of closest available translation, if available
|
|
|
|
|
*/
|
|
|
|
|
public static function get_closest_translation($locale) {
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2014-01-30 03:55:14 +01:00
|
|
|
|
// Check if exact match
|
|
|
|
|
$pool = self::get_existing_translations();
|
|
|
|
|
if(isset($pool[$locale])) return $locale;
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2014-01-30 03:55:14 +01:00
|
|
|
|
// Fallback to best locale for common language
|
|
|
|
|
$lang = self::get_lang_from_locale($locale);
|
|
|
|
|
$candidate = self::get_locale_from_lang($lang);
|
|
|
|
|
if(isset($pool[$candidate])) return $candidate;
|
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2007-09-27 22:47:16 +02:00
|
|
|
|
/**
|
|
|
|
|
* Searches the root-directory for module-directories
|
|
|
|
|
* (identified by having a _config.php on their first directory-level).
|
2011-12-04 19:02:40 +01:00
|
|
|
|
* Finds locales by filename convention ("<locale>.<extension>", e.g. "de_AT.yml").
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2007-09-27 22:47:16 +02:00
|
|
|
|
* @return array
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function get_existing_translations() {
|
2011-12-04 19:02:40 +01:00
|
|
|
|
$locales = array();
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2011-12-04 19:02:40 +01:00
|
|
|
|
// TODO Inspect themes
|
|
|
|
|
$modules = SS_ClassLoader::instance()->getManifest()->getModules();
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2011-12-04 19:02:40 +01:00
|
|
|
|
foreach($modules as $module) {
|
|
|
|
|
if(!file_exists("{$module}/lang/")) continue;
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2013-03-21 19:48:54 +01:00
|
|
|
|
$allLocales = Config::inst()->get('i18n', 'all_locales');
|
2011-12-04 19:02:40 +01:00
|
|
|
|
$moduleLocales = scandir("{$module}/lang/");
|
|
|
|
|
foreach($moduleLocales as $moduleLocale) {
|
2013-08-07 17:33:06 +02:00
|
|
|
|
$locale = pathinfo($moduleLocale, PATHINFO_FILENAME);
|
|
|
|
|
$ext = pathinfo($moduleLocale, PATHINFO_EXTENSION);
|
|
|
|
|
if($locale && in_array($ext, array('php','yml'))) {
|
|
|
|
|
// Normalize locale to include likely region tag, avoid repetition in locale labels
|
2011-11-26 14:34:11 +01:00
|
|
|
|
// TODO Replace with CLDR list of actually available languages/regions
|
2013-08-07 17:33:06 +02:00
|
|
|
|
// Only allow explicitly registered locales, otherwise we'll get into trouble
|
|
|
|
|
// if the locale doesn't exist in Zend's CLDR data
|
2013-08-20 14:07:07 +02:00
|
|
|
|
$fullLocale = self::get_locale_from_lang($locale);
|
|
|
|
|
if(isset($allLocales[$fullLocale])) {
|
2014-08-04 22:26:22 +02:00
|
|
|
|
$locales[$fullLocale] = $allLocales[$fullLocale];
|
2013-08-20 14:07:07 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2007-09-27 22:47:16 +02:00
|
|
|
|
}
|
2013-08-07 17:33:06 +02:00
|
|
|
|
}
|
2007-09-27 22:47:16 +02:00
|
|
|
|
|
2008-02-25 03:10:37 +01:00
|
|
|
|
// sort by title (not locale)
|
2011-12-04 19:02:40 +01:00
|
|
|
|
asort($locales);
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2011-12-04 19:02:40 +01:00
|
|
|
|
return $locales;
|
2007-09-27 22:47:16 +02:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2007-09-16 18:16:58 +02:00
|
|
|
|
/**
|
2009-03-20 09:36:40 +01:00
|
|
|
|
* Get a name from a language code (two characters, e.g. "en").
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2009-03-20 09:36:40 +01:00
|
|
|
|
* @see get_locale_name()
|
2007-09-16 18:16:58 +02:00
|
|
|
|
*
|
|
|
|
|
* @param mixed $code Language code
|
|
|
|
|
* @param boolean $native If true, the native name will be returned
|
|
|
|
|
* @return Name of the language
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function get_language_name($code, $native = false) {
|
2013-03-27 20:42:46 +01:00
|
|
|
|
$langs = Config::inst()->get('i18n', 'common_languages');
|
2010-10-15 05:47:44 +02:00
|
|
|
|
if($native) {
|
2013-03-27 20:42:46 +01:00
|
|
|
|
return (isset($langs[$code]['native'])) ? $langs[$code]['native'] : false;
|
2010-10-15 05:47:44 +02:00
|
|
|
|
} else {
|
2013-03-27 20:42:46 +01:00
|
|
|
|
return (isset($langs[$code]['name'])) ? $langs[$code]['name'] : false;
|
2010-10-15 05:47:44 +02:00
|
|
|
|
}
|
2007-09-16 18:16:58 +02:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2007-09-16 18:16:58 +02:00
|
|
|
|
/**
|
2009-03-20 09:36:40 +01:00
|
|
|
|
* Get a name from a locale code (xx_YY).
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2009-03-20 09:36:40 +01:00
|
|
|
|
* @see get_language_name()
|
2007-09-16 18:16:58 +02:00
|
|
|
|
*
|
|
|
|
|
* @param mixed $code locale code
|
|
|
|
|
* @return Name of the locale
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function get_locale_name($code) {
|
2013-03-26 10:13:00 +01:00
|
|
|
|
$langs = self::config()->all_locales;
|
2007-09-26 00:14:48 +02:00
|
|
|
|
return isset($langs[$code]) ? $langs[$code] : false;
|
2007-09-16 18:16:58 +02:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2007-09-16 18:16:58 +02:00
|
|
|
|
/**
|
|
|
|
|
* Get a code from an English language name
|
|
|
|
|
*
|
|
|
|
|
* @param mixed $name Name of the language
|
|
|
|
|
* @return Language code (if the name is not found, it'll return the passed name)
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function get_language_code($name) {
|
2007-10-21 02:39:14 +02:00
|
|
|
|
$code = array_search($name,self::get_common_languages());
|
2007-09-16 18:16:58 +02:00
|
|
|
|
return ($code ? $code : $name);
|
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2007-10-08 23:55:15 +02:00
|
|
|
|
/**
|
|
|
|
|
* Get the current tinyMCE language
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2007-10-08 23:55:15 +02:00
|
|
|
|
* @return Language
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function get_tinymce_lang() {
|
2013-03-21 19:48:54 +01:00
|
|
|
|
$lang = Config::inst()->get('i18n', 'tinymce_lang');
|
|
|
|
|
if(isset($lang[self::get_locale()])) {
|
|
|
|
|
return $lang[self::get_locale()];
|
2007-10-08 23:55:15 +02:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2007-10-08 23:55:15 +02:00
|
|
|
|
return 'en';
|
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2007-09-26 00:14:48 +02:00
|
|
|
|
/**
|
|
|
|
|
* Searches the root-directory for module-directories
|
|
|
|
|
* (identified by having a _config.php on their first directory-level
|
|
|
|
|
* and a language-file with the default locale in the /lang-subdirectory).
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2007-09-26 00:14:48 +02:00
|
|
|
|
* @return array
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function get_translatable_modules() {
|
2007-09-26 00:14:48 +02:00
|
|
|
|
$translatableModules = array();
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2007-09-26 00:14:48 +02:00
|
|
|
|
$baseDir = Director::baseFolder();
|
|
|
|
|
$modules = scandir($baseDir);
|
|
|
|
|
foreach($modules as $module) {
|
|
|
|
|
$moduleDir = $baseDir . DIRECTORY_SEPARATOR . $module;
|
|
|
|
|
if(
|
2014-08-04 22:26:22 +02:00
|
|
|
|
is_dir($moduleDir)
|
2007-09-26 00:14:48 +02:00
|
|
|
|
&& is_file($moduleDir . DIRECTORY_SEPARATOR . "_config.php")
|
2014-08-04 22:26:22 +02:00
|
|
|
|
&& is_file($moduleDir . DIRECTORY_SEPARATOR . "lang" . DIRECTORY_SEPARATOR
|
2016-01-13 09:24:15 +01:00
|
|
|
|
. Config::inst()->get('i18n', 'default_locale') . ".php")
|
2007-09-26 00:14:48 +02:00
|
|
|
|
) {
|
|
|
|
|
$translatableModules[] = $module;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $translatableModules;
|
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2009-03-02 23:13:30 +01:00
|
|
|
|
/**
|
|
|
|
|
* Returns the "short" language name from a locale,
|
2014-08-04 22:26:22 +02:00
|
|
|
|
* e.g. "en_US" would return "en".
|
|
|
|
|
*
|
2009-03-02 23:13:30 +01:00
|
|
|
|
* @param string $locale E.g. "en_US"
|
|
|
|
|
* @return string Short language code, e.g. "en"
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function get_lang_from_locale($locale) {
|
2012-04-18 13:20:23 +02:00
|
|
|
|
return preg_replace('/(_|-).*/', '', $locale);
|
2009-03-02 23:13:30 +01:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2009-03-20 09:36:40 +01:00
|
|
|
|
/**
|
|
|
|
|
* Provides you "likely locales"
|
|
|
|
|
* for a given "short" language code. This is a guess,
|
|
|
|
|
* as we can't disambiguate from e.g. "en" to "en_US" - it
|
|
|
|
|
* could also mean "en_UK". Based on the Unicode CLDR
|
|
|
|
|
* project.
|
|
|
|
|
* @see http://www.unicode.org/cldr/data/charts/supplemental/likely_subtags.html
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2009-03-20 09:36:40 +01:00
|
|
|
|
* @param string $lang Short language code, e.g. "en"
|
|
|
|
|
* @return string Long locale, e.g. "en_US"
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function get_locale_from_lang($lang) {
|
2013-03-21 19:48:54 +01:00
|
|
|
|
$subtags = Config::inst()->get('i18n', 'likely_subtags');
|
2009-04-30 01:15:38 +02:00
|
|
|
|
if(preg_match('/\-|_/', $lang)) {
|
2013-08-20 14:07:07 +02:00
|
|
|
|
return str_replace('-', '_', $lang);
|
2013-03-21 19:48:54 +01:00
|
|
|
|
} else if(isset($subtags[$lang])) {
|
|
|
|
|
return $subtags[$lang];
|
2009-03-20 09:36:40 +01:00
|
|
|
|
} else {
|
|
|
|
|
return $lang . '_' . strtoupper($lang);
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2009-03-02 23:13:30 +01:00
|
|
|
|
/**
|
|
|
|
|
* Gets a RFC 1766 compatible language code,
|
|
|
|
|
* e.g. "en-US".
|
|
|
|
|
*
|
|
|
|
|
* @see http://www.ietf.org/rfc/rfc1766.txt
|
|
|
|
|
* @see http://tools.ietf.org/html/rfc2616#section-3.10
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2009-03-02 23:13:30 +01:00
|
|
|
|
* @param string $locale
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function convert_rfc1766($locale) {
|
2009-03-02 23:13:30 +01:00
|
|
|
|
return str_replace('_','-', $locale);
|
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2007-10-22 03:51:02 +02:00
|
|
|
|
/**
|
2011-03-23 04:43:07 +01:00
|
|
|
|
* Given a PHP class name, finds the module where it's located.
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2011-03-23 04:43:07 +01:00
|
|
|
|
* @param string $name
|
|
|
|
|
* @return string
|
2007-10-22 03:51:02 +02:00
|
|
|
|
*/
|
2009-01-12 06:08:21 +01:00
|
|
|
|
public static function get_owner_module($name) {
|
2011-03-23 04:43:07 +01:00
|
|
|
|
$manifest = SS_ClassLoader::instance()->getManifest();
|
|
|
|
|
$path = $manifest->getItemPath($name);
|
|
|
|
|
|
|
|
|
|
if (!$path) {
|
|
|
|
|
return false;
|
2007-10-22 03:51:02 +02:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2011-03-23 04:43:07 +01:00
|
|
|
|
$path = Director::makeRelative($path);
|
|
|
|
|
$path = str_replace('\\', '/', $path);
|
|
|
|
|
|
2012-04-27 10:11:06 +02:00
|
|
|
|
$parts = explode('/', trim($path, '/'));
|
|
|
|
|
return array_shift($parts);
|
2007-10-22 03:51:02 +02:00
|
|
|
|
}
|
2011-03-23 04:43:07 +01:00
|
|
|
|
|
2010-12-03 01:27:41 +01:00
|
|
|
|
/**
|
|
|
|
|
* Validates a "long" locale format (e.g. "en_US")
|
|
|
|
|
* by checking it against {@link $all_locales}.
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2010-12-03 01:27:41 +01:00
|
|
|
|
* To add a locale to {@link $all_locales}, use the following example
|
|
|
|
|
* in your mysite/_config.php:
|
|
|
|
|
* <code>
|
|
|
|
|
* i18n::$allowed_locales['xx_XX'] = '<Language name>';
|
|
|
|
|
* </code>
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2010-12-03 01:27:41 +01:00
|
|
|
|
* Note: Does not check for {@link $allowed_locales}.
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2010-12-03 01:27:41 +01:00
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function validate_locale($locale) {
|
2010-12-03 01:27:41 +01:00
|
|
|
|
// Convert en-US to en_US
|
|
|
|
|
$locale = str_replace('-', '_', $locale);
|
2013-03-21 19:48:54 +01:00
|
|
|
|
return (array_key_exists($locale, Config::inst()->get('i18n', 'all_locales')));
|
2010-12-03 01:27:41 +01:00
|
|
|
|
}
|
2007-09-15 02:21:51 +02:00
|
|
|
|
|
|
|
|
|
/**
|
2014-08-04 22:26:22 +02:00
|
|
|
|
* Set the current locale, used as the default for
|
2010-12-05 09:18:58 +01:00
|
|
|
|
* any localized classes, such as {@link FormField} or {@link DBField}
|
|
|
|
|
* instances. Locales can also be persisted in {@link Member->Locale},
|
|
|
|
|
* for example in the {@link CMSMain} interface the Member locale
|
|
|
|
|
* overrules the global locale value set here.
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2012-09-26 23:34:00 +02:00
|
|
|
|
* @param string $locale Locale to be set. See
|
|
|
|
|
* http://unicode.org/cldr/data/diff/supplemental/languages_and_territories.html for a list
|
|
|
|
|
* of possible locales.
|
2007-09-15 02:21:51 +02:00
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function set_locale($locale) {
|
2007-10-21 02:39:14 +02:00
|
|
|
|
if ($locale) self::$current_locale = $locale;
|
2007-09-15 02:21:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2010-10-19 02:37:43 +02:00
|
|
|
|
* Get the current locale.
|
|
|
|
|
* Used by {@link Member::populateDefaults()}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2007-09-15 02:21:51 +02:00
|
|
|
|
* @return string Current locale in the system
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function get_locale() {
|
2016-01-13 09:24:15 +01:00
|
|
|
|
return (!empty(self::$current_locale)) ? self::$current_locale : Config::inst()->get('i18n', 'default_locale');
|
2007-09-15 02:21:51 +02:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2010-10-13 05:57:31 +02:00
|
|
|
|
/**
|
2010-12-05 09:18:58 +01:00
|
|
|
|
* This is the "fallback locale", in case resources with the "current locale"
|
|
|
|
|
* (set through {@link set_locale()}) can't be found.
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2010-12-05 09:18:58 +01:00
|
|
|
|
* If you just want to globally read/write a different locale (e.g. in a CMS interface),
|
|
|
|
|
* please use {@link get_locale()} and {@link set_locale()} instead.
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2010-12-05 09:18:58 +01:00
|
|
|
|
* For example, {@link Requirements::add_i18n_javascript()} and {@link i18n::include_by_class()}
|
|
|
|
|
* use this "fallback locale" value to include fallback language files.
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2016-01-13 09:24:15 +01:00
|
|
|
|
* @deprecated since version 4.0; Use the "i18n.default_locale" config setting instead
|
2010-10-13 05:57:31 +02:00
|
|
|
|
* @return String
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function default_locale() {
|
2016-01-13 09:24:15 +01:00
|
|
|
|
Deprecation::notice('4.0', 'Use the "i18n.default_locale" config setting instead');
|
|
|
|
|
return Config::inst()->get('i18n', 'default_locale');
|
2007-10-24 02:29:49 +02:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2010-10-13 05:57:31 +02:00
|
|
|
|
/**
|
2010-12-05 09:18:58 +01:00
|
|
|
|
* See {@link default_locale()} for usage.
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2016-01-13 09:24:15 +01:00
|
|
|
|
* @deprecated since version 4.0; Use the "i18n.default_locale" config setting instead
|
2010-10-13 05:57:31 +02:00
|
|
|
|
* @param String $locale
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function set_default_locale($locale) {
|
2016-01-13 09:24:15 +01:00
|
|
|
|
Deprecation::notice('4.0', 'Use the "i18n.default_locale" config setting instead');
|
|
|
|
|
Config::inst()->update('i18n', 'default_locale', $locale);
|
2010-10-13 05:57:31 +02:00
|
|
|
|
}
|
2013-10-14 11:27:53 +02:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the script direction in format compatible with the HTML "dir" attribute.
|
|
|
|
|
*
|
|
|
|
|
* @see http://www.w3.org/International/tutorials/bidi-xhtml/
|
|
|
|
|
* @param String $locale Optional locale incl. region (underscored)
|
|
|
|
|
* @return String "rtl" or "ltr"
|
|
|
|
|
*/
|
|
|
|
|
public static function get_script_direction($locale = null) {
|
|
|
|
|
require_once 'Zend/Locale/Data.php';
|
|
|
|
|
if(!$locale) $locale = i18n::get_locale();
|
2013-10-16 00:30:10 +02:00
|
|
|
|
try {
|
|
|
|
|
$dir = Zend_Locale_Data::getList($locale, 'layout');
|
|
|
|
|
} catch(Zend_Locale_Exception $e) {
|
|
|
|
|
$dir = Zend_Locale_Data::getList(i18n::get_lang_from_locale($locale), 'layout');
|
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2013-10-14 11:27:53 +02:00
|
|
|
|
return ($dir && $dir['characters'] == 'right-to-left') ? 'rtl' : 'ltr';
|
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2007-09-15 02:21:51 +02:00
|
|
|
|
/**
|
2011-11-26 14:34:11 +01:00
|
|
|
|
* Includes all available language files for a certain defined locale.
|
2012-05-23 01:43:44 +02:00
|
|
|
|
*
|
2007-09-15 02:21:51 +02:00
|
|
|
|
* @param string $locale All resources from any module in locale $locale will be loaded
|
2012-04-15 18:03:51 +02:00
|
|
|
|
* @param Boolean $clean Clean old caches?
|
2007-09-15 02:21:51 +02:00
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function include_by_locale($locale, $clean = false) {
|
2012-04-15 18:03:51 +02:00
|
|
|
|
if($clean) {
|
2014-08-16 02:51:17 +02:00
|
|
|
|
self::flush();
|
2012-04-15 18:03:51 +02:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2012-08-24 01:45:11 +02:00
|
|
|
|
// Get list of module => path pairs, and then just the names
|
2012-04-13 17:39:25 +02:00
|
|
|
|
$modules = SS_ClassLoader::instance()->getManifest()->getModules();
|
2012-08-24 01:45:11 +02:00
|
|
|
|
$moduleNames = array_keys($modules);
|
|
|
|
|
|
|
|
|
|
// Remove the "project" module from the list - we'll add it back specially later if needed
|
|
|
|
|
global $project;
|
|
|
|
|
if (($idx = array_search($project, $moduleNames)) !== false) array_splice($moduleNames, $idx, 1);
|
|
|
|
|
|
|
|
|
|
// Get the order from the config syste,
|
|
|
|
|
$order = Config::inst()->get('i18n', 'module_priority');
|
|
|
|
|
|
|
|
|
|
// Find all modules that don't have their order specified by the config system
|
|
|
|
|
$unspecified = array_diff($moduleNames, $order);
|
|
|
|
|
|
|
|
|
|
// If the placeholder "other_modules" exists in the order array, replace it by the unspecified modules
|
|
|
|
|
if (($idx = array_search('other_modules', $order)) !== false) array_splice($order, $idx, 1, $unspecified);
|
|
|
|
|
// Otherwise just jam them on the front
|
|
|
|
|
else array_splice($order, 0, 0, $unspecified);
|
|
|
|
|
|
|
|
|
|
// Put the project module back in at the begining if it wasn't specified by the config system
|
|
|
|
|
if (!in_array($project, $order)) array_unshift($order, $project);
|
|
|
|
|
|
|
|
|
|
$sortedModules = array();
|
|
|
|
|
foreach ($order as $module) {
|
|
|
|
|
if (isset($modules[$module])) $sortedModules[$module] = $modules[$module];
|
BUGFIX i18n module load order in i18n::include_by_locale()
The "project" module (normally mysite) is considered with the highest priority. Yet, the project's i18n is loaded first and cannot overwrite existing translations. I've added a array_reverse(), so the iteration keeps the translation of the module with the highest priority.
Old $sortedModules: mysite, (other_modules,) cms, admin, framework.
New $sortedModules: framework, admin, cms, (other_modules,) mysite.
2013-08-05 13:17:29 +02:00
|
|
|
|
}
|
|
|
|
|
$sortedModules = array_reverse($sortedModules, true);
|
2012-04-13 17:39:25 +02:00
|
|
|
|
|
2011-11-26 14:34:11 +01:00
|
|
|
|
// Loop in reverse order, meaning the translator with the highest priority goes first
|
|
|
|
|
$translators = array_reverse(self::get_translators(), true);
|
|
|
|
|
foreach($translators as $priority => $translators) {
|
|
|
|
|
foreach($translators as $name => $translator) {
|
|
|
|
|
$adapter = $translator->getAdapter();
|
2010-10-15 03:15:54 +02:00
|
|
|
|
|
2011-11-26 14:34:11 +01:00
|
|
|
|
// Load translations from modules
|
2012-08-24 01:45:11 +02:00
|
|
|
|
foreach($sortedModules as $module) {
|
2012-05-23 01:43:44 +02:00
|
|
|
|
$filename = $adapter->getFilenameForLocale($locale);
|
|
|
|
|
$filepath = "{$module}/lang/" . $filename;
|
2012-04-15 18:03:51 +02:00
|
|
|
|
|
2012-05-23 01:43:44 +02:00
|
|
|
|
if($filename && !file_exists($filepath)) continue;
|
|
|
|
|
$adapter->addTranslation(
|
|
|
|
|
array('content' => $filepath, 'locale' => $locale)
|
|
|
|
|
);
|
2011-11-26 14:34:11 +01:00
|
|
|
|
}
|
2009-08-27 05:09:34 +02:00
|
|
|
|
|
2011-11-26 14:34:11 +01:00
|
|
|
|
// Load translations from themes
|
|
|
|
|
// TODO Replace with theme listing once implemented in TemplateManifest
|
|
|
|
|
$themesBase = Director::baseFolder() . '/themes';
|
|
|
|
|
if(is_dir($themesBase)) {
|
|
|
|
|
foreach(scandir($themesBase) as $theme) {
|
|
|
|
|
if(
|
2013-03-21 19:48:54 +01:00
|
|
|
|
strpos($theme, Config::inst()->get('SSViewer', 'theme')) === 0
|
2011-11-26 14:34:11 +01:00
|
|
|
|
&& file_exists("{$themesBase}/{$theme}/lang/")
|
|
|
|
|
) {
|
2012-05-23 01:43:44 +02:00
|
|
|
|
$filename = $adapter->getFilenameForLocale($locale);
|
|
|
|
|
$filepath = "{$themesBase}/{$theme}/lang/" . $filename;
|
|
|
|
|
if($filename && !file_exists($filepath)) continue;
|
|
|
|
|
$adapter->addTranslation(
|
|
|
|
|
array('content' => $filepath, 'locale' => $locale)
|
|
|
|
|
);
|
2011-11-26 14:34:11 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2011-01-01 22:38:21 +01:00
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2011-12-04 18:36:45 +01:00
|
|
|
|
// Add empty translations to ensure the locales are "registered" with isAvailable(),
|
|
|
|
|
// and the next invocation of include_by_locale() doesn't cause a new reparse.
|
2012-05-23 01:43:44 +02:00
|
|
|
|
$adapter->addTranslation(
|
|
|
|
|
array(
|
2012-09-26 23:34:00 +02:00
|
|
|
|
// Cached by content hash, so needs to be locale dependent
|
2014-08-04 22:26:22 +02:00
|
|
|
|
'content' => array($locale => $locale),
|
2012-05-23 01:43:44 +02:00
|
|
|
|
'locale' => $locale,
|
|
|
|
|
'usetranslateadapter' => true
|
|
|
|
|
)
|
|
|
|
|
);
|
2010-12-05 09:43:38 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2007-09-15 02:21:51 +02:00
|
|
|
|
}
|
2010-10-15 03:15:54 +02:00
|
|
|
|
|
2007-09-15 02:21:51 +02:00
|
|
|
|
/**
|
|
|
|
|
* Given a class name (a "locale namespace"), will search for its module and, if available,
|
|
|
|
|
* will load the resources for the currently defined locale.
|
|
|
|
|
* If not available, the original English resource will be loaded instead (to avoid blanks)
|
2014-08-04 22:26:22 +02:00
|
|
|
|
*
|
2007-09-15 02:21:51 +02:00
|
|
|
|
* @param string $class Resources for this class will be included, according to the set locale.
|
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
|
public static function include_by_class($class) {
|
2007-10-22 03:51:02 +02:00
|
|
|
|
$module = self::get_owner_module($class);
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2011-11-26 14:34:11 +01:00
|
|
|
|
$translators = array_reverse(self::get_translators(), true);
|
|
|
|
|
foreach($translators as $priority => $translators) {
|
|
|
|
|
foreach($translators as $name => $translator) {
|
|
|
|
|
$adapter = $translator->getAdapter();
|
|
|
|
|
$filename = $adapter->getFilenameForLocale(self::get_locale());
|
|
|
|
|
$filepath = "{$module}/lang/" . $filename;
|
|
|
|
|
if($filename && !file_exists($filepath)) continue;
|
|
|
|
|
$adapter->addTranslation(array(
|
|
|
|
|
'content' => $filepath,
|
|
|
|
|
'locale' => self::get_locale()
|
|
|
|
|
));
|
2010-10-15 03:15:54 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-02-11 03:08:39 +01:00
|
|
|
|
|
2012-02-21 01:36:34 +01:00
|
|
|
|
public static function get_template_global_variables() {
|
2012-02-11 03:08:39 +01:00
|
|
|
|
return array(
|
|
|
|
|
'i18nLocale' => 'get_locale',
|
|
|
|
|
'get_locale',
|
2013-10-14 11:27:53 +02:00
|
|
|
|
'i18nScriptDirection' => 'get_script_direction',
|
2012-02-11 03:08:39 +01:00
|
|
|
|
);
|
|
|
|
|
}
|
2014-08-04 22:26:22 +02:00
|
|
|
|
|
2007-09-15 02:21:51 +02:00
|
|
|
|
}
|