UNPKG

phpjs

Version:

php.js offers community built php functions in javascript

24 lines (21 loc) 998 B
function i18n_loc_set_default(name) { // discuss at: http://phpjs.org/functions/i18n_loc_set_default/ // original by: Brett Zamir (http://brett-zamir.me) // note: Renamed in PHP6 from locale_set_default(). Not listed yet at php.net // note: List of locales at http://demo.icu-project.org/icu-bin/locexp (use for implementing other locales here) // note: To be usable with sort() if it is passed the SORT_LOCALE_STRING sorting flag: http://php.net/manual/en/function.sort.php // example 1: i18n_loc_set_default('pt_PT'); // returns 1: true // BEGIN REDUNDANT this.php_js = this.php_js || {}; // END REDUNDANT this.php_js.i18nLocales = { en_US_POSIX: { sorting: function(str1, str2) { // Fix: This one taken from strcmp, but need for other locales; we don't use localeCompare since its locale is not settable return (str1 == str2) ? 0 : ((str1 > str2) ? 1 : -1); } } }; this.php_js.i18nLocale = name; return true; }