diff -u b/includes/locale.inc b/includes/locale.inc --- b/includes/locale.inc +++ b/includes/locale.inc @@ -152,7 +152,7 @@ if (preg_match_all('@(?<=[, ]|^)([a-zA-Z-]+|\*)(?:;q=([0-9.]+))?(?:$|\s*,\s*)@', trim($_SERVER['HTTP_ACCEPT_LANGUAGE']), $matches, PREG_SET_ORDER)) { // Load custom mappings to support browsers that are sending non standard // language codes. - $mappings = language_get_browser_drupal_langcode_mappings(); + $mappings = variable_get('locale_language_mappings', array()); foreach ($matches as $match) { if ($mappings) { $langcode = strtolower($match[1]); diff -u b/modules/locale/locale.install b/modules/locale/locale.install --- b/modules/locale/locale.install +++ b/modules/locale/locale.install @@ -226,6 +226,21 @@ } /** + * Set default mappings for Chinese languages. + */ +function locale_update_7006() { + language_set_browser_drupal_langcode_mappings(array( + 'zh-tw' => 'zh-hant', // Taiwan Chinese in traditional script + 'zh-hk' => 'zh-hant', // Hong Kong Chinese in traditional script + 'zh-mo' => 'zh-hant', // Macao Chinese in traditional script + 'zh-cht' => 'zh-hant', // traditional Chinese + 'zh-cn' => 'zh-hans', // PRC Mainland Chinese in simplified script + 'zh-sg' => 'zh-hans', // Singapore Chinese in simplified script + 'zh-chs' => 'zh-hans', // simplified Chinese + )); +} + +/** * @} End of "addtogroup updates-7.x-extra". */ @@ -262,6 +277,7 @@ variable_del('javascript_parsed'); variable_del('locale_field_language_fallback'); variable_del('locale_cache_length'); + variable_del('locale_language_mappings'); foreach (language_types() as $type) { variable_del("language_negotiation_$type"); diff -u b/modules/locale/locale.module b/modules/locale/locale.module --- b/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -1095,7 +1095,6 @@ } } - /** * Returns language mappings between browser and Drupal language codes. * diff -u b/modules/locale/locale.test b/modules/locale/locale.test --- b/modules/locale/locale.test +++ b/modules/locale/locale.test @@ -1640,4 +1640,6 @@ class LocaleBrowserDetectionTest extends DrupalWebTestCase { + public static $modules = array('locale'); + public static function getInfo() { return array( @@ -1647,6 +1649,10 @@ ); } + function setUp() { + parent::setUp('locale'); + } + /** * Unit tests for the locale_language_from_browser() function. */