mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
* added support for locale 4 * some strings are missing and will need to be translated at a later date * thx @qyh214 for a lot of content Co-authored-by: qyh214 <sandy0214qin@msn.com>
64 lines
1.0 KiB
JavaScript
64 lines
1.0 KiB
JavaScript
/*
|
|
Locale class
|
|
*/
|
|
|
|
var LOCALE_ENUS = 0;
|
|
var LOCALE_FRFR = 2;
|
|
var LOCALE_DEDE = 3;
|
|
var LOCALE_ZHCN = 4;
|
|
var LOCALE_ESES = 6;
|
|
var LOCALE_RURU = 8;
|
|
|
|
var Locale = {
|
|
|
|
current: {},
|
|
|
|
// All
|
|
locales: {
|
|
/*setup:locales*/
|
|
},
|
|
|
|
getAll: function() {
|
|
var result = [];
|
|
|
|
for (var id in Locale.locales) {
|
|
result.push(Locale.locales[id]);
|
|
}
|
|
|
|
return result;
|
|
},
|
|
|
|
getAllByName: function() {
|
|
var result = Locale.getAll();
|
|
|
|
result.sort(function(a, b) {
|
|
return $WH.strcmp(a.description, b.description);
|
|
});
|
|
|
|
return result;
|
|
},
|
|
|
|
getId: function() {
|
|
return Locale.current.id;
|
|
},
|
|
|
|
getName: function() {
|
|
var localeId = Locale.getId();
|
|
|
|
return Locale.locales[localeId].name;
|
|
},
|
|
|
|
get: function() {
|
|
var localeId = Locale.getId();
|
|
|
|
return Locale.locales[localeId];
|
|
},
|
|
|
|
set: function(localeId) {
|
|
$.extend(Locale.current, Locale.locales[localeId]);
|
|
}
|
|
|
|
};
|
|
|
|
Locale.set(LOCALE_ENUS); // Default
|