Skip to content

Commit

Permalink
Merge pull request #194 from iLib-js/fixScriptorder
Browse files Browse the repository at this point in the history
Fix a bug which a default script for pa(Punjabi) should be Guru instead of Arabic
  • Loading branch information
ehoogerbeets authored Jul 8, 2019
2 parents 9c91a1f + 54fb918 commit 1a3a1f2
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 31 deletions.
1 change: 1 addition & 0 deletions docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Bug Fixes:
* Updated to IANA time zone data version 2019a
* Fixed a bug where the DateRngFmt was not heeding the specified
time zone when formatting the start and end dates
* Fixed a bug which a default script for pa-IN should be Guru instead of Arabic


Build 005
Expand Down
4 changes: 2 additions & 2 deletions js/data/locale/pa/scripts.jf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"scripts": [
"Arab",
"Guru"
"Guru",
"Arab"
],
"generated": true
}
8 changes: 4 additions & 4 deletions js/test/date/testMeridiems.js
Original file line number Diff line number Diff line change
Expand Up @@ -1894,13 +1894,13 @@ module.exports.testmeridiems = {

test.done();
},
testMeridiem_pa_PK: function(test) {
testMeridiem_pa_Arab_PK: function(test) {
test.expect(3);
var fmt = DateFmt.getMeridiemsRange({locale:"pa-PK"});
var fmt = DateFmt.getMeridiemsRange({locale:"pa-Arab-PK"});
test.ok(fmt !== null);

test.equal(fmt[0].name, "ਪੂ.ਦੁ.");
test.equal(fmt[1].name, "ਬਾ.ਦੁ.");
test.equal(fmt[0].name, 'AM');
test.equal(fmt[1].name, 'PM');

test.done();
},
Expand Down
57 changes: 35 additions & 22 deletions js/test/durfmt/testdurfmt2.js
Original file line number Diff line number Diff line change
Expand Up @@ -4219,23 +4219,26 @@ module.exports.testdurfmt2 = {
test.done();
},
testDurFmt_pa_Guru_IN: function(test) {
test.expect(16);
// 1 2
test.expect(24);
// 1 2 18
var textfmt;
var data = setVariable();
var length = data["fullLength"];

var textformatted_1 = [],textformatted_2 = [];
var clockformatted_1 = [],clockformatted_2 = [];
var textformatted_1 = [],textformatted_2 = [],textformatted_18 = [];
var clockformatted_1 = [],clockformatted_2 = [],clockformatted_18 = [];;


for (var i=0; i<4; i++) {
textfmt = new DurationFmt({locale: "pa-Guru-IN", style:"text", length:length[i]});

textformatted_1.push(textfmt.format({year: 1,month: 1,week: 1,day: 1}).toString());
textformatted_2.push(textfmt.format({year: 2,month: 2,week: 2,day: 2}).toString());
textformatted_18.push(textfmt.format({year: 18,month: 18,week: 18,day: 18}).toString());

clockformatted_1.push(textfmt.format({hour: 1,minute: 1,second: 1}).toString());
clockformatted_2.push(textfmt.format({hour: 2,minute: 2,second: 2}).toString());
clockformatted_18.push(textfmt.format({hour: 18,minute: 18,second: 18}).toString());
}

test.equal(textformatted_1[0], '1 ਸਾਲ, 1 ਮਹੀਨਾ, 1 ਹਫ਼ਤਾ, 1 ਦਿਨ');
Expand All @@ -4248,6 +4251,11 @@ module.exports.testdurfmt2 = {
test.equal(textformatted_2[2], '2 ਸਾਲ, 2 ਮਹੀਨੇ, 2 ਹਫ਼ਤੇ, 2 ਦਿਨ');
test.equal(textformatted_2[3], '2 ਸਾਲ, 2 ਮਹੀਨੇ, 2 ਹਫ਼ਤੇ, 2 ਦਿਨ');

test.equal(textformatted_18[0], '18 ਸਾਲ, 18 ਮਹੀਨੇ, 18 ਹਫ਼ਤੇ, 18 ਦਿਨ');
test.equal(textformatted_18[1], '18 ਸਾਲ, 18 ਮਹੀਨੇ, 18 ਹਫ਼ਤੇ, 18 ਦਿਨ');
test.equal(textformatted_18[2], '18 ਸਾਲ, 18 ਮਹੀਨੇ, 18 ਹਫ਼ਤੇ, 18 ਦਿਨ');
test.equal(textformatted_18[3], '18 ਸਾਲ, 18 ਮਹੀਨੇ, 18 ਹਫ਼ਤੇ, 18 ਦਿਨ');

test.equal(clockformatted_1[0], '1 ਘੰਟਾ, 1 ਮਿੰਟ, 1 ਸਕਿੰਟ');
test.equal(clockformatted_1[1], '1 ਘੰਟਾ, 1 ਮਿੰਟ, 1 ਸਕਿੰਟ');
test.equal(clockformatted_1[2], '1 ਘੰਟਾ, 1 ਮਿੰਟ, 1 ਸਕਿੰਟ');
Expand All @@ -4258,6 +4266,11 @@ module.exports.testdurfmt2 = {
test.equal(clockformatted_2[2], '2 ਘੰਟੇ, 2 ਮਿੰਟ, 2 ਸਕਿੰਟ');
test.equal(clockformatted_2[3], '2 ਘੰਟੇ, 2 ਮਿੰਟ, 2 ਸਕਿੰਟ');

test.equal(clockformatted_18[0], '18 ਘੰਟੇ, 18 ਮਿੰਟ, 18 ਸਕਿੰਟ');
test.equal(clockformatted_18[1], '18 ਘੰਟੇ, 18 ਮਿੰਟ, 18 ਸਕਿੰਟ');
test.equal(clockformatted_18[2], '18 ਘੰਟੇ, 18 ਮਿੰਟ, 18 ਸਕਿੰਟ');
test.equal(clockformatted_18[3], '18 ਘੰਟੇ, 18 ਮਿੰਟ, 18 ਸਕਿੰਟ');

test.done();
},
testDurFmt_pl_PL: function(test) {
Expand Down Expand Up @@ -8720,7 +8733,7 @@ module.exports.testdurfmt2 = {

test.done();
},
testDurFmt_pa_PK: function(test) {
testDurFmt_pa_Arab_PK: function(test) {
test.expect(16);
// 1 18
var textfmt;
Expand All @@ -8731,7 +8744,7 @@ module.exports.testdurfmt2 = {
var clockformatted_1 = [],clockformatted_18 = [];

for (var i=0; i<4; i++) {
textfmt = new DurationFmt({locale: "pa-PK", style:"text", length:length[i]});
textfmt = new DurationFmt({locale: "pa-Arab-PK", style:"text", length:length[i], useNative:false});

textformatted_1.push(textfmt.format({year: 1,month: 1,week: 1,day: 1}).toString());
textformatted_18.push(textfmt.format({year: 18,month: 18,week: 18,day: 18}).toString());
Expand All @@ -8740,25 +8753,25 @@ module.exports.testdurfmt2 = {
clockformatted_18.push(textfmt.format({hour: 18,minute: 18,second: 18}).toString());
}

test.equal(textformatted_1[0], '‏1 ਸਾਲ, 1 ਮਹੀਨਾ, 1 ਹਫ਼ਤਾ, 1 ਦਿਨ');
test.equal(textformatted_1[1], '‏1 ਸਾਲ, 1 ਮਹੀਨਾ, 1 ਹਫ਼ਤਾ, 1 ਦਿਨ');
test.equal(textformatted_1[2], '‏1 ਸਾਲ, 1 ਮਹੀਨਾ, 1 ਹਫ਼ਤਾ, 1 ਦਿਨ');
test.equal(textformatted_1[3], '‏1 ਸਾਲ, 1 ਮਹੀਨਾ, 1 ਹਫ਼ਤਾ, 1 ਦਿਨ');
test.equal(textformatted_1[0], '‏1 y, 1 m, 1 w, 1 d');
test.equal(textformatted_1[1], '‏1 y, 1 m, 1 w, 1 d');
test.equal(textformatted_1[2], '‏1 y, 1 m, 1 w, 1 d');
test.equal(textformatted_1[3], '‏1 y, 1 m, 1 w, 1 d');

test.equal(textformatted_18[0], '‏18 ਸਾਲ, 18 ਮਹੀਨੇ, 18 ਹਫ਼ਤੇ, 18 ਦਿਨ');
test.equal(textformatted_18[1], '‏18 ਸਾਲ, 18 ਮਹੀਨੇ, 18 ਹਫ਼ਤੇ, 18 ਦਿਨ');
test.equal(textformatted_18[2], '‏18 ਸਾਲ, 18 ਮਹੀਨੇ, 18 ਹਫ਼ਤੇ, 18 ਦਿਨ');
test.equal(textformatted_18[3], '‏18 ਸਾਲ, 18 ਮਹੀਨੇ, 18 ਹਫ਼ਤੇ, 18 ਦਿਨ');
test.equal(textformatted_18[0], '‏18 y, 18 m, 18 w, 18 d');
test.equal(textformatted_18[1], '‏18 y, 18 m, 18 w, 18 d');
test.equal(textformatted_18[2], '‏18 y, 18 m, 18 w, 18 d');
test.equal(textformatted_18[3], '‏18 y, 18 m, 18 w, 18 d');

test.equal(clockformatted_1[0], '‏1 ਘੰਟਾ, 1 ਮਿੰਟ, 1 ਸਕਿੰਟ');
test.equal(clockformatted_1[1], '‏1 ਘੰਟਾ, 1 ਮਿੰਟ, 1 ਸਕਿੰਟ');
test.equal(clockformatted_1[2], '‏1 ਘੰਟਾ, 1 ਮਿੰਟ, 1 ਸਕਿੰਟ');
test.equal(clockformatted_1[3], '‏1 ਘੰਟਾ, 1 ਮਿੰਟ, 1 ਸਕਿੰਟ');
test.equal(clockformatted_1[0], '‏1 h, 1 min, 1 s');
test.equal(clockformatted_1[1], '‏1 h, 1 min, 1 s');
test.equal(clockformatted_1[2], '‏1 h, 1 min, 1 s');
test.equal(clockformatted_1[3], '‏1 h, 1 min, 1 s');

test.equal(clockformatted_18[0], '‏18 ਘੰਟੇ, 18 ਮਿੰਟ, 18 ਸਕਿੰਟ');
test.equal(clockformatted_18[1], '‏18 ਘੰਟੇ, 18 ਮਿੰਟ, 18 ਸਕਿੰਟ');
test.equal(clockformatted_18[2], '‏18 ਘੰਟੇ, 18 ਮਿੰਟ, 18 ਸਕਿੰਟ');
test.equal(clockformatted_18[3], '‏18 ਘੰਟੇ, 18 ਮਿੰਟ, 18 ਸਕਿੰਟ');
test.equal(clockformatted_18[0], '‏18 h, 18 min, 18 s');
test.equal(clockformatted_18[1], '‏18 h, 18 min, 18 s');
test.equal(clockformatted_18[2], '‏18 h, 18 min, 18 s');
test.equal(clockformatted_18[3], '‏18 h, 18 min, 18 s');

test.done();
},
Expand Down
14 changes: 12 additions & 2 deletions js/test/root/testscriptinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,16 @@ module.exports.testscriptinfo = {
test.equal(scinfo.getScriptDirection(), "ltr");
test.done();
},
testScriptInfo_pa_IN: function(test) {
test.expect(4);
var li = new LocaleInfo("pa-IN");
var scinfo = new ScriptInfo(li.getScript());
test.ok(li !== null);
test.ok(scinfo !== null);
test.equal(li.getScript(), "Guru");
test.equal(scinfo.getScriptDirection(), "ltr");
test.done();
},
testScriptInfo_pa_Guru_IN: function(test) {
test.expect(4);
var li = new LocaleInfo("pa-Guru-IN");
Expand Down Expand Up @@ -2096,9 +2106,9 @@ module.exports.testscriptinfo = {
test.equal(scinfo.getScriptDirection(), "ltr");
test.done();
},
testScriptInfo_pa_PK: function(test) {
testScriptInfo_pa_Arab_PK: function(test) {
test.expect(4);
var li = new LocaleInfo("pa-PK");
var li = new LocaleInfo("pa-Arab-PK");
var scinfo = new ScriptInfo(li.getScript());
test.ok(li !== null);
test.ok(scinfo !== null);
Expand Down
2 changes: 1 addition & 1 deletion tools/cldr/genlangscripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ for (var language in scripts) {
if (!fs.existsSync(filename)) {
fs.mkdirSync(filename);
}
if (language === 'ms' || language === 'kk') {
if (language === 'ms' || language === 'kk' || language === 'pa') {
scripts[language] = scripts[language].reverse();
}
console.log(language + ':\t"scripts": ' + JSON.stringify(scripts[language]) + ',');
Expand Down

0 comments on commit 1a3a1f2

Please sign in to comment.