-
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathlocale-replacements.js
More file actions
118 lines (105 loc) · 1.84 KB
/
Copy pathlocale-replacements.js
File metadata and controls
118 lines (105 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/**
Language-specific replacement rules.
Keys are BCP-47 language tags (or their prefixes).
Values are arrays of [from, to] replacement pairs.
These replacements take precedence over the default replacements when a matching locale is specified.
*/
// Shared Danish/Norwegian replacements
const danishNorwegianReplacements = [
['æ', 'ae'],
['Æ', 'Ae'],
['ø', 'oe'],
['Ø', 'Oe'],
['å', 'aa'],
['Å', 'Aa'],
];
const localeReplacements = {
// Swedish
sv: [
['ä', 'a'],
['Ä', 'A'],
['ö', 'o'],
['Ö', 'O'],
['å', 'a'],
['Å', 'A'],
],
// Danish
da: danishNorwegianReplacements,
// Norwegian Bokmål
nb: danishNorwegianReplacements,
// German
de: [
['ä', 'ae'],
['Ä', 'Ae'],
['ö', 'oe'],
['Ö', 'Oe'],
['ü', 'ue'],
['Ü', 'Ue'],
['ß', 'ss'],
['ẞ', 'Ss'],
],
// Turkish
tr: [
['â', 'a'],
['Â', 'A'],
['ç', 'c'],
['Ç', 'C'],
['ğ', 'g'],
['Ğ', 'G'],
['ı', 'i'],
['İ', 'I'],
['î', 'i'],
['Î', 'I'],
['ö', 'o'],
['Ö', 'O'],
['û', 'u'],
['Û', 'U'],
['ü', 'u'],
['Ü', 'U'],
['ş', 's'],
['Ş', 'S'],
],
// Hungarian
hu: [
['ű', 'u'],
['Ű', 'U'],
['ö', 'o'],
['Ö', 'O'],
['ü', 'u'],
['Ü', 'U'],
['á', 'a'],
['Á', 'A'],
['é', 'e'],
['É', 'E'],
['í', 'i'],
['Í', 'I'],
['ó', 'o'],
['Ó', 'O'],
['ú', 'u'],
['Ú', 'U'],
],
// Serbian
sr: [
['ђ', 'dj'],
['Ђ', 'Dj'],
['џ', 'dz'],
['Џ', 'Dz'],
['љ', 'lj'],
['Љ', 'Lj'],
['њ', 'nj'],
['Њ', 'Nj'],
['ћ', 'c'],
['Ћ', 'C'],
['ч', 'ch'],
['Ч', 'Ch'],
['ш', 'sh'],
['Ш', 'Sh'],
['ж', 'zh'],
['Ж', 'Zh'],
],
};
// Convert all locale replacements to Maps at module load time
for (const locale of Object.keys(localeReplacements)) {
localeReplacements[locale] = new Map(localeReplacements[locale]);
}
export default localeReplacements;