Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 695c54c

Browse files
fix(i18n): escape all chars above \u007f in locale files
Modify the script that writes the locales so all characters above \u007f are escaped Includes the updated locale files after running the closureI18nExtractor. Closes #2417
1 parent 363e4cb commit 695c54c

File tree

250 files changed

+4601
-4585
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

250 files changed

+4601
-4585
lines changed

i18n/spec/closureI18nExtractorSpec.js

+11
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,14 @@ describe("pluralExtractor", function() {
248248
})
249249
});
250250

251+
describe("serializeContent", function() {
252+
it("should not make any modifications to the content of the locale", function() {
253+
var serializedContent = closureI18nExtractor.serializeContent(newTestLocaleInfo());
254+
expect(eval("(" + serializedContent + ")")).toEqual(newTestLocaleInfo());
255+
});
256+
it("should only have ascii characters", function() {
257+
var serializedContent = closureI18nExtractor.serializeContent(newTestLocaleInfo());
258+
expect((/[^\u0001-\u007f]/).test(serializedContent)).toBe(false);
259+
});
260+
});
261+

i18n/src/closureI18nExtractor.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ exports.pluralExtractor = pluralExtractor;
99
exports.outputLocale = outputLocale;
1010
exports.correctedLocaleId = correctedLocaleId;
1111
exports.findLocaleId = findLocaleId;
12+
exports.serializeContent = serializeContent;
1213

1314
var goog = { provide: function() {},
1415
require: function() {},
@@ -125,6 +126,12 @@ function canonicalizeForJsonStringify(unused_key, object) {
125126
return result;
126127
}
127128

129+
function serializeContent(localeObj) {
130+
return JSON.stringify(localeObj, canonicalizeForJsonStringify, ' ')
131+
.replace(new RegExp('[\\u007f-\\uffff]', 'g'), function(c) { return '\\u'+('0000'+c.charCodeAt(0).toString(16)).slice(-4); })
132+
.replace(/"@@|@@"/g, '');
133+
}
134+
128135
function outputLocale(localeInfo, localeID) {
129136
var fallBackID = localeID.match(/[A-Za-z]+/)[0],
130137
localeObj = localeInfo[localeID],
@@ -167,9 +174,7 @@ function outputLocale(localeInfo, localeID) {
167174
id: localeObj.id
168175
};
169176

170-
var content = JSON.stringify(localeInfo[localeID], canonicalizeForJsonStringify, ' ')
171-
.replace(//g, '\\u00A4')
172-
.replace(/"@@|@@"/g, '');
177+
var content = serializeContent(localeInfo[localeID]);
173178

174179
return prefix + content + suffix;
175180
}

src/ngLocale/angular-locale_af-na.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ $provide.value("$locale", {
6464
"NUMBER_FORMATS": {
6565
"CURRENCY_SYM": "R",
6666
"DECIMAL_SEP": ",",
67-
"GROUP_SEP": " ",
67+
"GROUP_SEP": "\u00a0",
6868
"PATTERNS": {
6969
"0": {
7070
"gSize": 3,
@@ -85,9 +85,9 @@ $provide.value("$locale", {
8585
"maxFrac": 2,
8686
"minFrac": 2,
8787
"minInt": 1,
88-
"negPre": "(\u00A4",
88+
"negPre": "(\u00a4",
8989
"negSuf": ")",
90-
"posPre": "\u00A4",
90+
"posPre": "\u00a4",
9191
"posSuf": ""
9292
}
9393
}

src/ngLocale/angular-locale_af-za.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ $provide.value("$locale", {
6464
"NUMBER_FORMATS": {
6565
"CURRENCY_SYM": "R",
6666
"DECIMAL_SEP": ",",
67-
"GROUP_SEP": " ",
67+
"GROUP_SEP": "\u00a0",
6868
"PATTERNS": {
6969
"0": {
7070
"gSize": 3,
@@ -85,9 +85,9 @@ $provide.value("$locale", {
8585
"maxFrac": 2,
8686
"minFrac": 2,
8787
"minInt": 1,
88-
"negPre": "(\u00A4",
88+
"negPre": "(\u00a4",
8989
"negSuf": ")",
90-
"posPre": "\u00A4",
90+
"posPre": "\u00a4",
9191
"posSuf": ""
9292
}
9393
}

src/ngLocale/angular-locale_af.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ $provide.value("$locale", {
6464
"NUMBER_FORMATS": {
6565
"CURRENCY_SYM": "R",
6666
"DECIMAL_SEP": ",",
67-
"GROUP_SEP": " ",
67+
"GROUP_SEP": "\u00a0",
6868
"PATTERNS": {
6969
"0": {
7070
"gSize": 3,
@@ -85,9 +85,9 @@ $provide.value("$locale", {
8585
"maxFrac": 2,
8686
"minFrac": 2,
8787
"minInt": 1,
88-
"negPre": "(\u00A4",
88+
"negPre": "(\u00a4",
8989
"negSuf": ")",
90-
"posPre": "\u00A4",
90+
"posPre": "\u00a4",
9191
"posSuf": ""
9292
}
9393
}

src/ngLocale/angular-locale_am-et.js

+42-42
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,54 @@ var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "
33
$provide.value("$locale", {
44
"DATETIME_FORMATS": {
55
"AMPMS": {
6-
"0": "ጡዋት",
7-
"1": "ከሳዓት"
6+
"0": "\u1321\u12cb\u1275",
7+
"1": "\u12a8\u1233\u12d3\u1275"
88
},
99
"DAY": {
10-
"0": "እሑድ",
11-
"1": "ሰኞ",
12-
"2": "ማክሰኞ",
13-
"3": "ረቡዕ",
14-
"4": "ሐሙስ",
15-
"5": "ዓርብ",
16-
"6": "ቅዳሜ"
10+
"0": "\u12a5\u1211\u12f5",
11+
"1": "\u1230\u129e",
12+
"2": "\u121b\u12ad\u1230\u129e",
13+
"3": "\u1228\u1261\u12d5",
14+
"4": "\u1210\u1219\u1235",
15+
"5": "\u12d3\u122d\u1265",
16+
"6": "\u1245\u12f3\u121c"
1717
},
1818
"MONTH": {
19-
"0": "ጃንዩወሪ",
20-
"1": "ፌብሩወሪ",
21-
"2": "ማርች",
22-
"3": "ኤፕረል",
23-
"4": "ሜይ",
24-
"5": "ጁን",
25-
"6": "ጁላይ",
26-
"7": "ኦገስት",
27-
"8": "ሴፕቴምበር",
28-
"9": "ኦክተውበር",
29-
"10": "ኖቬምበር",
30-
"11": "ዲሴምበር"
19+
"0": "\u1303\u1295\u12e9\u12c8\u122a",
20+
"1": "\u134c\u1265\u1229\u12c8\u122a",
21+
"2": "\u121b\u122d\u127d",
22+
"3": "\u12a4\u1355\u1228\u120d",
23+
"4": "\u121c\u12ed",
24+
"5": "\u1301\u1295",
25+
"6": "\u1301\u120b\u12ed",
26+
"7": "\u12a6\u1308\u1235\u1275",
27+
"8": "\u1234\u1355\u1274\u121d\u1260\u122d",
28+
"9": "\u12a6\u12ad\u1270\u12cd\u1260\u122d",
29+
"10": "\u1296\u126c\u121d\u1260\u122d",
30+
"11": "\u12f2\u1234\u121d\u1260\u122d"
3131
},
3232
"SHORTDAY": {
33-
"0": "እሑድ",
34-
"1": "ሰኞ",
35-
"2": "ማክሰ",
36-
"3": "ረቡዕ",
37-
"4": "ሐሙስ",
38-
"5": "ዓርብ",
39-
"6": "ቅዳሜ"
33+
"0": "\u12a5\u1211\u12f5",
34+
"1": "\u1230\u129e",
35+
"2": "\u121b\u12ad\u1230",
36+
"3": "\u1228\u1261\u12d5",
37+
"4": "\u1210\u1219\u1235",
38+
"5": "\u12d3\u122d\u1265",
39+
"6": "\u1245\u12f3\u121c"
4040
},
4141
"SHORTMONTH": {
42-
"0": "ጃንዩ",
43-
"1": "ፌብሩ",
44-
"2": "ማርች",
45-
"3": "ኤፕረ",
46-
"4": "ሜይ",
47-
"5": "ጁን",
48-
"6": "ጁላይ",
49-
"7": "ኦገስ",
50-
"8": "ሴፕቴ",
51-
"9": "ኦክተ",
52-
"10": "ኖቬም",
53-
"11": "ዲሴም"
42+
"0": "\u1303\u1295\u12e9",
43+
"1": "\u134c\u1265\u1229",
44+
"2": "\u121b\u122d\u127d",
45+
"3": "\u12a4\u1355\u1228",
46+
"4": "\u121c\u12ed",
47+
"5": "\u1301\u1295",
48+
"6": "\u1301\u120b\u12ed",
49+
"7": "\u12a6\u1308\u1235",
50+
"8": "\u1234\u1355\u1274",
51+
"9": "\u12a6\u12ad\u1270",
52+
"10": "\u1296\u126c\u121d",
53+
"11": "\u12f2\u1234\u121d"
5454
},
5555
"fullDate": "EEEE, d MMMM y",
5656
"longDate": "d MMMM y",
@@ -85,9 +85,9 @@ $provide.value("$locale", {
8585
"maxFrac": 2,
8686
"minFrac": 2,
8787
"minInt": 1,
88-
"negPre": "(\u00A4",
88+
"negPre": "(\u00a4",
8989
"negSuf": ")",
90-
"posPre": "\u00A4",
90+
"posPre": "\u00a4",
9191
"posSuf": ""
9292
}
9393
}

src/ngLocale/angular-locale_am.js

+42-42
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,54 @@ var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "
33
$provide.value("$locale", {
44
"DATETIME_FORMATS": {
55
"AMPMS": {
6-
"0": "ጡዋት",
7-
"1": "ከሳዓት"
6+
"0": "\u1321\u12cb\u1275",
7+
"1": "\u12a8\u1233\u12d3\u1275"
88
},
99
"DAY": {
10-
"0": "እሑድ",
11-
"1": "ሰኞ",
12-
"2": "ማክሰኞ",
13-
"3": "ረቡዕ",
14-
"4": "ሐሙስ",
15-
"5": "ዓርብ",
16-
"6": "ቅዳሜ"
10+
"0": "\u12a5\u1211\u12f5",
11+
"1": "\u1230\u129e",
12+
"2": "\u121b\u12ad\u1230\u129e",
13+
"3": "\u1228\u1261\u12d5",
14+
"4": "\u1210\u1219\u1235",
15+
"5": "\u12d3\u122d\u1265",
16+
"6": "\u1245\u12f3\u121c"
1717
},
1818
"MONTH": {
19-
"0": "ጃንዩወሪ",
20-
"1": "ፌብሩወሪ",
21-
"2": "ማርች",
22-
"3": "ኤፕረል",
23-
"4": "ሜይ",
24-
"5": "ጁን",
25-
"6": "ጁላይ",
26-
"7": "ኦገስት",
27-
"8": "ሴፕቴምበር",
28-
"9": "ኦክተውበር",
29-
"10": "ኖቬምበር",
30-
"11": "ዲሴምበር"
19+
"0": "\u1303\u1295\u12e9\u12c8\u122a",
20+
"1": "\u134c\u1265\u1229\u12c8\u122a",
21+
"2": "\u121b\u122d\u127d",
22+
"3": "\u12a4\u1355\u1228\u120d",
23+
"4": "\u121c\u12ed",
24+
"5": "\u1301\u1295",
25+
"6": "\u1301\u120b\u12ed",
26+
"7": "\u12a6\u1308\u1235\u1275",
27+
"8": "\u1234\u1355\u1274\u121d\u1260\u122d",
28+
"9": "\u12a6\u12ad\u1270\u12cd\u1260\u122d",
29+
"10": "\u1296\u126c\u121d\u1260\u122d",
30+
"11": "\u12f2\u1234\u121d\u1260\u122d"
3131
},
3232
"SHORTDAY": {
33-
"0": "እሑድ",
34-
"1": "ሰኞ",
35-
"2": "ማክሰ",
36-
"3": "ረቡዕ",
37-
"4": "ሐሙስ",
38-
"5": "ዓርብ",
39-
"6": "ቅዳሜ"
33+
"0": "\u12a5\u1211\u12f5",
34+
"1": "\u1230\u129e",
35+
"2": "\u121b\u12ad\u1230",
36+
"3": "\u1228\u1261\u12d5",
37+
"4": "\u1210\u1219\u1235",
38+
"5": "\u12d3\u122d\u1265",
39+
"6": "\u1245\u12f3\u121c"
4040
},
4141
"SHORTMONTH": {
42-
"0": "ጃንዩ",
43-
"1": "ፌብሩ",
44-
"2": "ማርች",
45-
"3": "ኤፕረ",
46-
"4": "ሜይ",
47-
"5": "ጁን",
48-
"6": "ጁላይ",
49-
"7": "ኦገስ",
50-
"8": "ሴፕቴ",
51-
"9": "ኦክተ",
52-
"10": "ኖቬም",
53-
"11": "ዲሴም"
42+
"0": "\u1303\u1295\u12e9",
43+
"1": "\u134c\u1265\u1229",
44+
"2": "\u121b\u122d\u127d",
45+
"3": "\u12a4\u1355\u1228",
46+
"4": "\u121c\u12ed",
47+
"5": "\u1301\u1295",
48+
"6": "\u1301\u120b\u12ed",
49+
"7": "\u12a6\u1308\u1235",
50+
"8": "\u1234\u1355\u1274",
51+
"9": "\u12a6\u12ad\u1270",
52+
"10": "\u1296\u126c\u121d",
53+
"11": "\u12f2\u1234\u121d"
5454
},
5555
"fullDate": "EEEE, d MMMM y",
5656
"longDate": "d MMMM y",
@@ -85,9 +85,9 @@ $provide.value("$locale", {
8585
"maxFrac": 2,
8686
"minFrac": 2,
8787
"minInt": 1,
88-
"negPre": "(\u00A4",
88+
"negPre": "(\u00a4",
8989
"negSuf": ")",
90-
"posPre": "\u00A4",
90+
"posPre": "\u00a4",
9191
"posSuf": ""
9292
}
9393
}

0 commit comments

Comments
 (0)