summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/build/config/locales.gni
blob: 1d57b877dcf73616be3d11afabaf9086aea225ea (plain)
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/chromeos/ui_mode.gni")

# This file creates the |locales| which is the set of current
# locales based on the current platform. Locales in this list are formated
# based on what .pak files expect.
# The |locales| variable *may* contain pseudolocales, depending on the
# |enable_pseudolocales| flag.
# If you specifically want to have the locales variable with or without
# pseudolocales, then use |locales_with_pseudolocales| or
# |locales_without_pseudolocales|.

# The following additional platform specific lists are created:
# - |android_bundle_locales_as_resources| locales formatted for XML output names
# - |locales_as_mac_outputs| formated for mac output bundles
# - |ios_packed_locales| subset for iOS
# - |ios_packed_locales_as_mac_outputs| subset for iOS output

# Chrome on iOS only ships with a subset of the locales supported by other
# version of Chrome as the corresponding locales are not supported by the
# operating system (but for simplicity, the corresponding .pak files are
# still generated).
ios_unsupported_locales = [
  "am",
  "bn",
  "et",
  "fil",
  "gu",
  "kn",
  "lv",
  "ml",
  "mr",
  "sl",
  "sw",
  "ta",
  "te",
]

# These list are defined even when not building for Android or iOS for the
# sake of build/locale_tool.py. Ensure that GN doesn't complain about them
# being unused.
not_needed([ "ios_unsupported_locales" ])

# Superset of all locales used in Chrome with platform specific changes noted.
all_chrome_locales = [
  "af",
  "am",
  "ar",
  "as",
  "az",
  "be",
  "bg",
  "bn",
  "bs",
  "ca",
  "cs",
  "da",
  "de",
  "el",
  "en-GB",
  "en-US",
  "es",
  "es-419",  # "es-MX" in iOS (Mexico vs Latin America) "es-US" on Android
  "et",
  "eu",
  "fa",
  "fi",
  "fil",  # "tl" in .xml but "fil" in TC and .pak
  "fr",
  "fr-CA",
  "gl",
  "gu",
  "he",  # "iw" in .xml and TC but "he" in .pak
  "hi",
  "hr",
  "hu",
  "hy",
  "id",  # "in" in .xml but "id" in TC and .pak
  "is",
  "it",
  "ja",
  "ka",
  "kk",
  "km",
  "kn",
  "ko",
  "ky",
  "lo",
  "lt",
  "lv",
  "mk",
  "ml",
  "mn",
  "mr",
  "ms",
  "my",
  "nb",  # "no" in TC but "nb" in .xml and .pak
  "ne",
  "nl",
  "or",
  "pa",
  "pl",
  "pt-BR",  # just "pt" in iOS
  "pt-PT",
  "ro",
  "ru",
  "si",
  "sk",
  "sl",
  "sq",
  "sr",
  "sr-Latn",  # -b+sr+Latn in .xml
  "sv",
  "sw",
  "ta",
  "te",
  "th",
  "tr",
  "uk",
  "ur",
  "uz",
  "vi",
  "zh-CN",
  "zh-HK",
  "zh-TW",
  "zu",
]

# New locales added to Chrome Android bundle builds.
android_bundle_only_locales = [
  "af",
  "as",
  "az",
  "be",
  "bs",
  "eu",
  "fr-CA",
  "gl",
  "hy",
  "is",
  "ka",
  "kk",
  "km",
  "ky",
  "lo",
  "mk",
  "mn",
  "my",
  "ne",
  "or",
  "pa",
  "si",
  "sq",
  "sr-Latn",
  "ur",
  "uz",
  "zh-HK",
  "zu",
]

# New locales added to ChromeOS builds.
chromeos_only_locales = [ "is" ]

if (is_android) {
  locales = all_chrome_locales

  # List for Android locale names in .xml exports. Note: needs to stay in sync
  # with |ToAndroidLocaleName| in build/android/gyp/util/resource_utils.py.
  #  - add r: (e.g. zh-HK -> zh-rHK )
  android_bundle_locales_as_resources = []
  foreach(_locale, locales) {
    android_bundle_locales_as_resources +=
        [ string_replace(_locale, "-", "-r") ]
  }

  #  - remove en-US
  #  - swap: (he, id, en-419, fil) -> (iw, in, es-rUS, tl)
  #  - sr-rLatn -> -b+sr+Latn
  android_bundle_locales_as_resources -= [
    "en-rUS",
    "es-r419",
    "fil",
    "he",
    "id",
    "sr-rLatn",
  ]
  android_bundle_locales_as_resources += [
    "b+sr+Latn",
    "es-rUS",
    "in",
    "iw",
    "tl",
  ]
} else if (is_chromeos_ash || is_chromeos_lacros) {
  # In ChromeOS we support a few more locales than standard Chrome.
  locales =
      all_chrome_locales - android_bundle_only_locales + chromeos_only_locales
} else {
  # Change if other platforms support more locales.
  locales = all_chrome_locales - android_bundle_only_locales
}

# Chrome on iOS uses different names for "es-419" and "pt-BR" (called
# respectively "es-MX" and "pt" on iOS).
if (is_ios) {
  locales -= [
    "es-419",
    "pt-BR",
  ]
  locales += [
    "es-MX",
    "pt",
  ]
}

pseudolocales = [
  "ar-XB",
  "en-XA",
]
locales_without_pseudolocales = locales
locales_with_pseudolocales = locales + pseudolocales

declare_args() {
  # We want to give pseudolocales to everyone except end-users (devs & QA).
  enable_pseudolocales = !is_official_build
}

if (enable_pseudolocales) {
  # Note that this only packages the locales in, and doesn't add the ui to enable them.
  locales += pseudolocales
}

# Same as the locales list but in the format Mac expects for output files:
# it uses underscores instead of hyphens, and "en" instead of "en-US".
locales_as_mac_outputs = []
foreach(locale, locales) {
  if (locale == "en-US") {
    locales_as_mac_outputs += [ "en" ]
  } else {
    locales_as_mac_outputs += [ string_replace(locale, "-", "_") ]
  }
}

if (is_ios) {
  ios_packed_locales = locales - ios_unsupported_locales
  ios_packed_locales_as_mac_outputs =
      locales_as_mac_outputs - ios_unsupported_locales
}