'languages'], $rows); $longForShortMapping = []; foreach ($rows as $row) { $longForShortMapping[$row['value']] = $row['name']; } // hand-crafted enforced overrides for language variants // NB: when adding support for a regional override for a new language below, update // relevant comments in templates/CRM/common/civicrm.settings.php.template as well $longForShortMapping['zh'] = defined("CIVICRM_LANGUAGE_MAPPING_ZH") ? CIVICRM_LANGUAGE_MAPPING_ZH : 'zh_CN'; $longForShortMapping['en'] = defined("CIVICRM_LANGUAGE_MAPPING_EN") ? CIVICRM_LANGUAGE_MAPPING_EN : 'en_US'; $longForShortMapping['fr'] = defined("CIVICRM_LANGUAGE_MAPPING_FR") ? CIVICRM_LANGUAGE_MAPPING_FR : 'fr_FR'; $longForShortMapping['pt'] = defined("CIVICRM_LANGUAGE_MAPPING_PT") ? CIVICRM_LANGUAGE_MAPPING_PT : 'pt_PT'; $longForShortMapping['es'] = defined("CIVICRM_LANGUAGE_MAPPING_ES") ? CIVICRM_LANGUAGE_MAPPING_ES : 'es_ES'; } return $longForShortMapping; } /** * @param $long * * @return string */ public static function shortForLong($long) { return substr($long, 0, 2); } /** * Returns a list of ISO 639-1 "right-to-left" language codes. * * @return array */ public static function getRTLlanguages() { $rtl = [ 'ar', 'fa', 'he', 'ur', ]; return $rtl; } }