k. 've_ZA', // Venda. 'vi_VN', // Vietnamese. 'wo_SN', // Wolof. 'xh_ZA', // Xhosa. 'yi_DE', // Yiddish. 'yo_NG', // Yoruba. 'zh_CN', // Simplified Chinese (China). 'zh_HK', // Traditional Chinese (Hong Kong). 'zh_TW', // Traditional Chinese (Taiwan). 'zu_ZA', // Zulu. 'zz_TR', // Zazaki. ]; /** * Catch some weird locales served out by WP that are not easily doubled up. * * @param string $locale Current site locale. * * @return string */ public static function sanitize( $locale ) { $fix_locales = [ 'ca' => 'ca_ES', 'en' => 'en_US', 'el' => 'el_GR', 'et' => 'et_EE', 'ja' => 'ja_JP', 'sq' => 'sq_AL', 'uk' => 'uk_UA', 'vi' => 'vi_VN', 'zh' => 'zh_CN', 'te' => 'te_IN', 'ur' => 'ur_PK', 'cy' => 'cy_GB', 'eu' => 'eu_ES', 'th' => 'th_TH', 'af' => 'af_ZA', 'hy' => 'hy_AM', 'gu' => 'gu_IN', 'kn' => 'kn_IN', 'mr' => 'mr_IN', 'kk' => 'kk_KZ', 'lv' => 'lv_LV', 'sw' => 'sw_KE', 'tl' => 'tl_PH', 'ps' => 'ps_AF', 'as' => 'as_IN', ]; if ( isset( $fix_locales[ $locale ] ) ) { $locale = $fix_locales[ $locale ]; } // Convert locales like "es" to "es_ES", in case that works for the given locale (sometimes it does). if ( 2 === strlen( $locale ) ) { $locale = self::join( $locale ); } return $locale; } /** * Validate with locales FB supports. * * Check to see if the locale is a valid FB one, if not, use en_US as a fallback. * * @param string $locale Current site locale. * * @return string */ public static function validate( $locale ) { if ( in_array( $locale, self::FACEBOOK_LOCALES, true ) ) { return $locale; } $locale = self::join( substr( $locale, 0, 2 ) ); return in_array( $locale, self::FACEBOOK_LOCALES, true ) ? $locale : 'en_US'; } /** * Join locale to make full locale. * * @param string $locale Locale to join. * * @return string */ private static function join( $locale ) { return strtolower( $locale ) . '_' . strtoupper( $locale ); } } WordPress › Error

There has been a critical error on this website.

Learn more about troubleshooting WordPress.