Skip to content

Commit

Permalink
Add data as js and a simple module
Browse files Browse the repository at this point in the history
  • Loading branch information
jsor committed Nov 6, 2015
1 parent 6415ed0 commit 3522188
Show file tree
Hide file tree
Showing 316 changed files with 49,679 additions and 0 deletions.
33 changes: 33 additions & 0 deletions bin/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,46 @@ function value($value)
return $value;
}

function indent($str, $indent = ' ')
{
return implode(PHP_EOL, array_map(function($line) use($indent) {
return $indent . $line;
}, explode(PHP_EOL, $str)));
}

function js($name, $data)
{
$json = trim(indent(json_encode($data, JSON_PRETTY_PRINT)));

return <<<EOF
(function(window, factory) {
if (typeof define === 'function' && define.amd) {
define([], function() {
return factory();
});
} else if (typeof module === 'object' && typeof module.exports === 'object') {
module.exports = factory();
} else {
(window.LocaleData || (window.LocaleData = {}))['{$name}'] = factory();
}
}(typeof window !== "undefined" ? window : this, function() {
return {$json};
}));
EOF;
}

function store($name, array $data)
{
file_put_contents(
__DIR__.'/../data/'.$name.'.json',
json_encode($data, JSON_PRETTY_PRINT).PHP_EOL
);

file_put_contents(
__DIR__.'/../data/'.$name.'.js',
js($name, $data).PHP_EOL
);

file_put_contents(
__DIR__.'/../data/'.$name.'.php',
'<?php return '.var_export($data, true).';'.PHP_EOL
Expand Down
151 changes: 151 additions & 0 deletions data/POSIX.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
(function(window, factory) {
if (typeof define === 'function' && define.amd) {
define([], function() {
return factory();
});
} else if (typeof module === 'object' && typeof module.exports === 'object') {
module.exports = factory();
} else {
(window.LocaleData || (window.LocaleData = {}))['POSIX'] = factory();
}
}(typeof window !== "undefined" ? window : this, function() {
return {
"LC_ADDRESS": {
"postal_fmt": "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N",
"country_name": null,
"country_post": null,
"country_ab2": null,
"country_ab3": null,
"country_num": null,
"country_car": null,
"country_isbn": null,
"lang_name": null,
"lang_ab": null,
"lang_term": null,
"lang_lib": null
},
"LC_MEASUREMENT": {
"measurement": 1
},
"LC_MESSAGES": {
"yesexpr": "^[yY]",
"noexpr": "^[nN]",
"yesstr": "Yes",
"nostr": "No"
},
"LC_MONETARY": {
"currency_symbol": "",
"mon_decimal_point": ".",
"mon_thousands_sep": "",
"mon_grouping": -1,
"positive_sign": "",
"negative_sign": "",
"frac_digits": -1,
"p_cs_precedes": -1,
"p_sep_by_space": -1,
"n_cs_precedes": -1,
"n_sep_by_space": -1,
"p_sign_posn": -1,
"n_sign_posn": -1,
"int_curr_symbol": "",
"int_frac_digits": -1,
"int_p_cs_precedes": null,
"int_p_sep_by_space": null,
"int_n_cs_precedes": null,
"int_n_sep_by_space": null,
"int_p_sign_posn": null,
"int_n_sign_posn": null
},
"LC_NAME": {
"name_fmt": "%p%t%g%t%m%t%f",
"name_gen": null,
"name_mr": null,
"name_mrs": null,
"name_miss": null,
"name_ms": null
},
"LC_NUMERIC": {
"decimal_point": ".",
"thousands_sep": "",
"grouping": -1
},
"LC_PAPER": {
"height": 297,
"width": 210
},
"LC_TELEPHONE": {
"tel_int_fmt": "+%c %a %l",
"tel_dom_fmt": null,
"int_select": null,
"int_prefix": null
},
"LC_TIME": {
"date_fmt": "%a %b %e %H:%M:%S %Z %Y",
"abday": [
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat"
],
"day": [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
],
"week": null,
"abmon": [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
],
"mon": [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],
"d_t_fmt": "%a %b %e %H:%M:%S %Y",
"d_fmt": "%m\/%d\/%y",
"t_fmt": "%H:%M:%S",
"am_pm": [
"AM",
"PM"
],
"t_fmt_ampm": "%I:%M:%S %p",
"era": null,
"era_year": null,
"era_d_t_fmt": null,
"era_d_fmt": null,
"era_t_fmt": null,
"alt_digits": null,
"first_weekday": null,
"first_workday": null,
"cal_direction": null,
"timezone": null
}
};
}));
157 changes: 157 additions & 0 deletions data/aa_DJ.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
(function(window, factory) {
if (typeof define === 'function' && define.amd) {
define([], function() {
return factory();
});
} else if (typeof module === 'object' && typeof module.exports === 'object') {
module.exports = factory();
} else {
(window.LocaleData || (window.LocaleData = {}))['aa_DJ'] = factory();
}
}(typeof window !== "undefined" ? window : this, function() {
return {
"LC_ADDRESS": {
"postal_fmt": "%z%c%T%s%b%e%r",
"country_name": "Yabuuti",
"country_post": "DJI",
"country_ab2": "DJ",
"country_ab3": "DJI",
"country_num": 262,
"country_car": null,
"country_isbn": null,
"lang_name": "Qafar",
"lang_ab": "aa",
"lang_term": "aar",
"lang_lib": "aar"
},
"LC_MEASUREMENT": {
"measurement": 1
},
"LC_MESSAGES": {
"yesexpr": "^[oOyY].*",
"noexpr": "^[mnMN].*",
"yesstr": null,
"nostr": null
},
"LC_MONETARY": {
"currency_symbol": "$",
"mon_decimal_point": ".",
"mon_thousands_sep": " ",
"mon_grouping": [
3,
3
],
"positive_sign": "",
"negative_sign": "-",
"frac_digits": 2,
"p_cs_precedes": 1,
"p_sep_by_space": 0,
"n_cs_precedes": 1,
"n_sep_by_space": 0,
"p_sign_posn": 1,
"n_sign_posn": 1,
"int_curr_symbol": "DJF ",
"int_frac_digits": 2,
"int_p_cs_precedes": null,
"int_p_sep_by_space": null,
"int_n_cs_precedes": null,
"int_n_sep_by_space": null,
"int_p_sign_posn": null,
"int_n_sign_posn": null
},
"LC_NAME": {
"name_fmt": "%d%t%g%t%m%t%f",
"name_gen": "",
"name_mr": "Toobokoyta",
"name_mrs": "Gisti",
"name_miss": "Maqanxa",
"name_ms": ""
},
"LC_NUMERIC": {
"decimal_point": ".",
"thousands_sep": "",
"grouping": [
0,
0
]
},
"LC_PAPER": {
"height": 297,
"width": 210
},
"LC_TELEPHONE": {
"tel_int_fmt": "+%c %a %l",
"tel_dom_fmt": "%a-%l",
"int_select": "00",
"int_prefix": "253"
},
"LC_TIME": {
"date_fmt": "%a %b %e %r %Z %Y",
"abday": [
"aca",
"etl",
"tal",
"arb",
"kam",
"gum",
"sab"
],
"day": [
"Acaada",
"Etleeni",
"Talaata",
"Arbaqa",
"Kamiisi",
"Gumqata",
"Sabti"
],
"week": null,
"abmon": [
"qun",
"nah",
"cig",
"agd",
"cax",
"qas",
"qad",
"leq",
"way",
"dit",
"xim",
"kax"
],
"mon": [
"Qunxa Garablu",
"Kudo",
"Ciggilta Kudo",
"Agda Baxisso",
"Caxah Alsa",
"Qasa Dirri",
"Qado Dirri",
"Liiqen",
"Waysu",
"Diteli",
"Ximoli",
"Kaxxa Garablu"
],
"d_t_fmt": "%a %d %b %Y %r %Z",
"d_fmt": "%d.%m.%Y",
"t_fmt": "%l:%M:%S",
"am_pm": [
"saaku",
"carra"
],
"t_fmt_ampm": "%X %p",
"era": null,
"era_year": null,
"era_d_t_fmt": null,
"era_d_fmt": null,
"era_t_fmt": null,
"alt_digits": null,
"first_weekday": null,
"first_workday": null,
"cal_direction": null,
"timezone": null
}
};
}));
Loading

0 comments on commit 3522188

Please sign in to comment.