From 43108875dbe43eb62bd94f18dc1a9f92f9fa4a47 Mon Sep 17 00:00:00 2001 From: Goun Lee Date: Fri, 5 Jul 2019 15:45:06 +0900 Subject: [PATCH 1/3] Fix a bug which a default script for pa should be Guru instead of Arabic --- js/data/locale/pa/scripts.jf | 4 ++-- js/test/date/testMeridiems.js | 6 +++--- js/test/durfmt/testdurfmt2.js | 36 +++++++++++++++++----------------- js/test/root/testscriptinfo.js | 14 +++++++++++-- tools/cldr/genlangscripts.js | 2 +- 5 files changed, 36 insertions(+), 26 deletions(-) diff --git a/js/data/locale/pa/scripts.jf b/js/data/locale/pa/scripts.jf index 6340b3066d..1ea244b08b 100644 --- a/js/data/locale/pa/scripts.jf +++ b/js/data/locale/pa/scripts.jf @@ -1,7 +1,7 @@ { "scripts": [ - "Arab", - "Guru" + "Guru", + "Arab" ], "generated": true } \ No newline at end of file diff --git a/js/test/date/testMeridiems.js b/js/test/date/testMeridiems.js index 2a5d963e45..1faaa02d8b 100644 --- a/js/test/date/testMeridiems.js +++ b/js/test/date/testMeridiems.js @@ -1896,11 +1896,11 @@ module.exports.testmeridiems = { }, testMeridiem_pa_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(); }, diff --git a/js/test/durfmt/testdurfmt2.js b/js/test/durfmt/testdurfmt2.js index cf3383e6a2..86f9b5ca2a 100644 --- a/js/test/durfmt/testdurfmt2.js +++ b/js/test/durfmt/testdurfmt2.js @@ -8720,7 +8720,7 @@ module.exports.testdurfmt2 = { test.done(); }, - testDurFmt_pa_PK: function(test) { + testDurFmt_pa_Arab_PK: function(test) { test.expect(16); // 1 18 var textfmt; @@ -8731,7 +8731,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()); @@ -8740,25 +8740,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(); }, diff --git a/js/test/root/testscriptinfo.js b/js/test/root/testscriptinfo.js index 54cda92c19..87b249a9dd 100644 --- a/js/test/root/testscriptinfo.js +++ b/js/test/root/testscriptinfo.js @@ -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"); @@ -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); diff --git a/tools/cldr/genlangscripts.js b/tools/cldr/genlangscripts.js index f18fa0b3d3..1c1e236ca9 100644 --- a/tools/cldr/genlangscripts.js +++ b/tools/cldr/genlangscripts.js @@ -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]) + ','); From 27446f3db8f24f6deb229eaa25455b61a879a2cd Mon Sep 17 00:00:00 2001 From: Goun Lee Date: Fri, 5 Jul 2019 15:50:37 +0900 Subject: [PATCH 2/3] Update ReleaseNotes --- docs/ReleaseNotes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index acec1b89dc..e3f788866c 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -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 From 54fb918810306ca539fcd419004670a6ad15c1fa Mon Sep 17 00:00:00 2001 From: Goun Lee Date: Mon, 8 Jul 2019 10:06:04 +0900 Subject: [PATCH 3/3] More testcase update --- js/test/date/testMeridiems.js | 2 +- js/test/durfmt/testdurfmt2.js | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/js/test/date/testMeridiems.js b/js/test/date/testMeridiems.js index 1faaa02d8b..11eae4e0bd 100644 --- a/js/test/date/testMeridiems.js +++ b/js/test/date/testMeridiems.js @@ -1894,7 +1894,7 @@ 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-Arab-PK"}); test.ok(fmt !== null); diff --git a/js/test/durfmt/testdurfmt2.js b/js/test/durfmt/testdurfmt2.js index 86f9b5ca2a..627b3ae8e8 100644 --- a/js/test/durfmt/testdurfmt2.js +++ b/js/test/durfmt/testdurfmt2.js @@ -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 ਦਿਨ'); @@ -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 ਸਕਿੰਟ'); @@ -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) {