add language codes and names

This commit is contained in:
rolux 2014-07-23 15:54:24 +02:00
parent 28f221ef47
commit 0f6d70766f
2 changed files with 7220 additions and 7179 deletions

View file

@ -97,8 +97,10 @@ Ox.load.Geo = function(options, callback) {
> Ox.test.array
[196, 73, 10, 8, 28, 24, 14, 1]
@*/
Ox.COUNTRIES = data.countries;
//@ Ox.LANGUAGES <[o]> Array of ISO 639-1 language codes and names
Ox.LANGUAGES = data.languages;
Ox.COUNTRIES = data;
Ox.GEO_COLORS = {
'North America': [0, 0, 255],
@ -253,6 +255,26 @@ Ox.load.Geo = function(options, callback) {
return Ox.GEO_COLORS[str] || [128, 128, 128];
};
/*@
Ox.getLanguageCodeByName <f> Returns a language code
(str) -> <s> Two-letter ISO 639-1 language code, or original string
str <s> Language name
@*/
Ox.getLanguageCodeByName = function(str) {
var language = Ox.getObject(Ox.LANGUAGES, 'name', Ox.toTitleCase(str));
return language ? language.code : str;
};
/*@
Ox.getLanguageNameByCode <f> Returns a language name
(str) -> <s> Language name, or original string
str <s> Two-letter ISO 639-1 language code
@*/
Ox.getLanguageNameByCode = function(str) {
var language = Ox.getObject(Ox.LANGUAGES, 'code', str);
return language ? language.name : str;
};
/*@
Ox.splitGeoname <f> Splits a geoname into its component parts
(geoname) -> <[s]> Components

File diff suppressed because it is too large Load diff