@strapi/i18n 0.0.0 → 5.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/README.md +17 -1
  2. package/dist/_chunks/SettingsPage-B73NO_8-.js +585 -0
  3. package/dist/_chunks/SettingsPage-B73NO_8-.js.map +1 -0
  4. package/dist/_chunks/SettingsPage-pvdzbKEM.mjs +565 -0
  5. package/dist/_chunks/SettingsPage-pvdzbKEM.mjs.map +1 -0
  6. package/dist/_chunks/de-9eCAqqrB.mjs +66 -0
  7. package/dist/_chunks/de-9eCAqqrB.mjs.map +1 -0
  8. package/dist/_chunks/de-DtWiGdHl.js +66 -0
  9. package/dist/_chunks/de-DtWiGdHl.js.map +1 -0
  10. package/dist/_chunks/dk-2qBjxt-P.mjs +66 -0
  11. package/dist/_chunks/dk-2qBjxt-P.mjs.map +1 -0
  12. package/dist/_chunks/dk-D8C-casx.js +66 -0
  13. package/dist/_chunks/dk-D8C-casx.js.map +1 -0
  14. package/dist/_chunks/en-BuBc6LKZ.js +69 -0
  15. package/dist/_chunks/en-BuBc6LKZ.js.map +1 -0
  16. package/dist/_chunks/en-CnrTsjWS.mjs +69 -0
  17. package/dist/_chunks/en-CnrTsjWS.mjs.map +1 -0
  18. package/dist/_chunks/es-DS-XFGSw.js +66 -0
  19. package/dist/_chunks/es-DS-XFGSw.js.map +1 -0
  20. package/dist/_chunks/es-DlmMVaBG.mjs +66 -0
  21. package/dist/_chunks/es-DlmMVaBG.mjs.map +1 -0
  22. package/dist/_chunks/fr-3S6ke71d.mjs +66 -0
  23. package/dist/_chunks/fr-3S6ke71d.mjs.map +1 -0
  24. package/dist/_chunks/fr-BTjekDpq.js +66 -0
  25. package/dist/_chunks/fr-BTjekDpq.js.map +1 -0
  26. package/dist/_chunks/index-kcYwoCdE.js +1082 -0
  27. package/dist/_chunks/index-kcYwoCdE.js.map +1 -0
  28. package/dist/_chunks/index-lckTPHiZ.mjs +1058 -0
  29. package/dist/_chunks/index-lckTPHiZ.mjs.map +1 -0
  30. package/dist/_chunks/ko-DmcGUBQ3.js +65 -0
  31. package/dist/_chunks/ko-DmcGUBQ3.js.map +1 -0
  32. package/dist/_chunks/ko-qTjQ8IMw.mjs +65 -0
  33. package/dist/_chunks/ko-qTjQ8IMw.mjs.map +1 -0
  34. package/dist/_chunks/pl-B67TSHqT.mjs +66 -0
  35. package/dist/_chunks/pl-B67TSHqT.mjs.map +1 -0
  36. package/dist/_chunks/pl-Cn5RYonZ.js +66 -0
  37. package/dist/_chunks/pl-Cn5RYonZ.js.map +1 -0
  38. package/dist/_chunks/ru-BMBgVL3s.js +68 -0
  39. package/dist/_chunks/ru-BMBgVL3s.js.map +1 -0
  40. package/dist/_chunks/ru-hagMa57T.mjs +68 -0
  41. package/dist/_chunks/ru-hagMa57T.mjs.map +1 -0
  42. package/dist/_chunks/tr-CarUU76c.js +66 -0
  43. package/dist/_chunks/tr-CarUU76c.js.map +1 -0
  44. package/dist/_chunks/tr-Dw_jmkG-.mjs +66 -0
  45. package/dist/_chunks/tr-Dw_jmkG-.mjs.map +1 -0
  46. package/dist/_chunks/zh-57YM4amO.mjs +66 -0
  47. package/dist/_chunks/zh-57YM4amO.mjs.map +1 -0
  48. package/dist/_chunks/zh-CukOviB0.js +66 -0
  49. package/dist/_chunks/zh-CukOviB0.js.map +1 -0
  50. package/dist/_chunks/zh-Hans-DSHIXAa3.js +57 -0
  51. package/dist/_chunks/zh-Hans-DSHIXAa3.js.map +1 -0
  52. package/dist/_chunks/zh-Hans-Dyc-aR-h.mjs +57 -0
  53. package/dist/_chunks/zh-Hans-Dyc-aR-h.mjs.map +1 -0
  54. package/dist/admin/index.js +6 -0
  55. package/dist/admin/index.js.map +1 -0
  56. package/dist/admin/index.mjs +7 -0
  57. package/dist/admin/index.mjs.map +1 -0
  58. package/dist/admin/src/components/CMHeaderActions.d.ts +4 -0
  59. package/dist/admin/src/components/CMListViewModalsAdditionalInformation.d.ts +4 -0
  60. package/dist/admin/src/components/CheckboxConfirmation.d.ts +20 -0
  61. package/dist/admin/src/components/CreateLocale.d.ts +29 -0
  62. package/dist/admin/src/components/DeleteLocale.d.ts +5 -0
  63. package/dist/admin/src/components/EditLocale.d.ts +13 -0
  64. package/dist/admin/src/components/Initializer.d.ts +5 -0
  65. package/dist/admin/src/components/LocaleListCell.d.ts +9 -0
  66. package/dist/admin/src/components/LocalePicker.d.ts +2 -0
  67. package/dist/admin/src/components/LocaleTable.d.ts +11 -0
  68. package/dist/admin/src/constants.d.ts +22 -0
  69. package/dist/admin/src/contentManagerHooks/editView.d.ts +6 -0
  70. package/dist/admin/src/contentManagerHooks/listView.d.ts +22 -0
  71. package/dist/admin/src/contentReleasesHooks/releaseDetailsView.d.ts +36 -0
  72. package/dist/admin/src/hooks/useI18n.d.ts +16 -0
  73. package/dist/admin/src/index.d.ts +16 -0
  74. package/dist/admin/src/middlewares/extendCTBAttributeInitialData.d.ts +4 -0
  75. package/dist/admin/src/middlewares/extendCTBInitialData.d.ts +4 -0
  76. package/dist/admin/src/middlewares/rbac-middleware.d.ts +3 -0
  77. package/dist/admin/src/pages/SettingsPage.d.ts +3 -0
  78. package/dist/admin/src/pluginId.d.ts +1 -0
  79. package/dist/admin/src/services/api.d.ts +3 -0
  80. package/dist/admin/src/services/locales.d.ts +4 -0
  81. package/dist/admin/src/types.d.ts +9 -0
  82. package/dist/admin/src/utils/baseQuery.d.ts +20 -0
  83. package/dist/admin/src/utils/fields.d.ts +7 -0
  84. package/dist/admin/src/utils/getTranslation.d.ts +2 -0
  85. package/dist/admin/src/utils/prefixPluginTranslations.d.ts +3 -0
  86. package/dist/admin/src/utils/schemas.d.ts +24 -0
  87. package/dist/admin/src/utils/strings.d.ts +2 -0
  88. package/dist/server/index.js +3522 -0
  89. package/dist/server/index.js.map +1 -0
  90. package/dist/server/index.mjs +3503 -0
  91. package/dist/server/index.mjs.map +1 -0
  92. package/dist/server/src/bootstrap.d.ts +6 -0
  93. package/dist/server/src/bootstrap.d.ts.map +1 -0
  94. package/dist/server/src/constants/index.d.ts +15 -0
  95. package/dist/server/src/constants/index.d.ts.map +1 -0
  96. package/dist/server/src/content-types/index.d.ts +37 -0
  97. package/dist/server/src/content-types/index.d.ts.map +1 -0
  98. package/dist/server/src/content-types/locale/index.d.ts +35 -0
  99. package/dist/server/src/content-types/locale/index.d.ts.map +1 -0
  100. package/dist/server/src/controllers/content-types.d.ts +6 -0
  101. package/dist/server/src/controllers/content-types.d.ts.map +1 -0
  102. package/dist/server/src/controllers/index.d.ts +10 -0
  103. package/dist/server/src/controllers/index.d.ts.map +1 -0
  104. package/dist/server/src/controllers/iso-locales.d.ts +4 -0
  105. package/dist/server/src/controllers/iso-locales.d.ts.map +1 -0
  106. package/dist/server/src/controllers/locales.d.ts +4 -0
  107. package/dist/server/src/controllers/locales.d.ts.map +1 -0
  108. package/dist/server/src/controllers/validate-locale-creation.d.ts +4 -0
  109. package/dist/server/src/controllers/validate-locale-creation.d.ts.map +1 -0
  110. package/dist/server/src/domain/locale.d.ts +11 -0
  111. package/dist/server/src/domain/locale.d.ts.map +1 -0
  112. package/dist/server/src/graphql.d.ts +8 -0
  113. package/dist/server/src/graphql.d.ts.map +1 -0
  114. package/dist/server/src/index.d.ts +148 -0
  115. package/dist/server/src/index.d.ts.map +1 -0
  116. package/dist/server/src/migrations/content-type/disable/index.d.ts +3 -0
  117. package/dist/server/src/migrations/content-type/disable/index.d.ts.map +1 -0
  118. package/dist/server/src/migrations/content-type/enable/index.d.ts +3 -0
  119. package/dist/server/src/migrations/content-type/enable/index.d.ts.map +1 -0
  120. package/dist/server/src/register.d.ts +6 -0
  121. package/dist/server/src/register.d.ts.map +1 -0
  122. package/dist/server/src/routes/admin.d.ts +18 -0
  123. package/dist/server/src/routes/admin.d.ts.map +1 -0
  124. package/dist/server/src/routes/content-api.d.ts +10 -0
  125. package/dist/server/src/routes/content-api.d.ts.map +1 -0
  126. package/dist/server/src/routes/index.d.ts +28 -0
  127. package/dist/server/src/routes/index.d.ts.map +1 -0
  128. package/dist/server/src/services/content-types.d.ts +13 -0
  129. package/dist/server/src/services/content-types.d.ts.map +1 -0
  130. package/dist/server/src/services/entity-service-decorator.d.ts +29 -0
  131. package/dist/server/src/services/entity-service-decorator.d.ts.map +1 -0
  132. package/dist/server/src/services/index.d.ts +71 -0
  133. package/dist/server/src/services/index.d.ts.map +1 -0
  134. package/dist/server/src/services/iso-locales.d.ts +10 -0
  135. package/dist/server/src/services/iso-locales.d.ts.map +1 -0
  136. package/dist/server/src/services/locales.d.ts +17 -0
  137. package/dist/server/src/services/locales.d.ts.map +1 -0
  138. package/dist/server/src/services/localizations.d.ts +8 -0
  139. package/dist/server/src/services/localizations.d.ts.map +1 -0
  140. package/dist/server/src/services/metrics.d.ts +8 -0
  141. package/dist/server/src/services/metrics.d.ts.map +1 -0
  142. package/dist/server/src/services/permissions/actions.d.ts +16 -0
  143. package/dist/server/src/services/permissions/actions.d.ts.map +1 -0
  144. package/dist/server/src/services/permissions/conditions.d.ts +15 -0
  145. package/dist/server/src/services/permissions/conditions.d.ts.map +1 -0
  146. package/dist/server/src/services/permissions/engine.d.ts +6 -0
  147. package/dist/server/src/services/permissions/engine.d.ts.map +1 -0
  148. package/dist/server/src/services/permissions/sections-builder.d.ts +6 -0
  149. package/dist/server/src/services/permissions/sections-builder.d.ts.map +1 -0
  150. package/dist/server/src/services/permissions.d.ts +28 -0
  151. package/dist/server/src/services/permissions.d.ts.map +1 -0
  152. package/dist/server/src/utils/index.d.ts +43 -0
  153. package/dist/server/src/utils/index.d.ts.map +1 -0
  154. package/dist/server/src/validation/content-types.d.ts +3 -0
  155. package/dist/server/src/validation/content-types.d.ts.map +1 -0
  156. package/dist/server/src/validation/locales.d.ts +12 -0
  157. package/dist/server/src/validation/locales.d.ts.map +1 -0
  158. package/dist/shared/contracts/content-manager.d.ts +27 -0
  159. package/dist/shared/contracts/iso-locales.d.ts +21 -0
  160. package/dist/shared/contracts/locales.d.ts +77 -0
  161. package/dist/shared/contracts/shared.d.ts +6 -0
  162. package/package.json +83 -4
  163. package/strapi-server.js +3 -0
@@ -0,0 +1,3522 @@
1
+ "use strict";
2
+ const _ = require("lodash");
3
+ const fp = require("lodash/fp");
4
+ const utils = require("@strapi/utils");
5
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule)
8
+ return e;
9
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
10
+ if (e) {
11
+ for (const k in e) {
12
+ if (k !== "default") {
13
+ const d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: () => e[k]
17
+ });
18
+ }
19
+ }
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+ const ___default = /* @__PURE__ */ _interopDefault(_);
25
+ const utils__namespace = /* @__PURE__ */ _interopNamespace(utils);
26
+ const getCoreStore = () => {
27
+ return strapi.store({ type: "plugin", name: "i18n" });
28
+ };
29
+ const getService = (name) => {
30
+ return strapi.plugin("i18n").service(name);
31
+ };
32
+ const registerModelsHooks = () => {
33
+ strapi.db.lifecycles.subscribe({
34
+ models: ["plugin::i18n.locale"],
35
+ async afterCreate() {
36
+ await getService("permissions").actions.syncSuperAdminPermissionsWithLocales();
37
+ },
38
+ async afterDelete() {
39
+ await getService("permissions").actions.syncSuperAdminPermissionsWithLocales();
40
+ }
41
+ });
42
+ strapi.documents.use(async (context, next) => {
43
+ const schema2 = context.contentType;
44
+ if (!["create", "update", "discardDraft", "publish"].includes(context.action)) {
45
+ return next();
46
+ }
47
+ if (!getService("content-types").isLocalizedContentType(schema2)) {
48
+ return next();
49
+ }
50
+ const { getNestedPopulateOfNonLocalizedAttributes: getNestedPopulateOfNonLocalizedAttributes2 } = getService("content-types");
51
+ const attributesToPopulate = getNestedPopulateOfNonLocalizedAttributes2(schema2.uid);
52
+ const result = await next();
53
+ let resultID;
54
+ if (Array.isArray(result?.entries)) {
55
+ resultID = result.entries[0].id;
56
+ } else if (result?.id) {
57
+ resultID = result.id;
58
+ } else {
59
+ return result;
60
+ }
61
+ if (attributesToPopulate.length > 0) {
62
+ const populatedResult = await strapi.db.query(schema2.uid).findOne({ where: { id: resultID }, populate: attributesToPopulate });
63
+ await getService("localizations").syncNonLocalizedAttributes(populatedResult, schema2);
64
+ }
65
+ return result;
66
+ });
67
+ };
68
+ const bootstrap = async ({ strapi: strapi2 }) => {
69
+ const { sendDidInitializeEvent: sendDidInitializeEvent2 } = getService("metrics");
70
+ const { decorator: decorator2 } = getService("entity-service-decorator");
71
+ const { initDefaultLocale: initDefaultLocale2 } = getService("locales");
72
+ const { sectionsBuilder, actions: actions2, engine } = getService("permissions");
73
+ strapi2.entityService.decorate(decorator2);
74
+ await initDefaultLocale2();
75
+ sectionsBuilder.registerLocalesPropertyHandler();
76
+ await actions2.registerI18nActions();
77
+ actions2.registerI18nActionsHooks();
78
+ actions2.updateActionsProperties();
79
+ engine.registerI18nPermissionsHandlers();
80
+ registerModelsHooks();
81
+ sendDidInitializeEvent2();
82
+ };
83
+ const { ApplicationError: ApplicationError$3 } = utils.errors;
84
+ const validateLocaleCreation = async (ctx, next) => {
85
+ const { model } = ctx.params;
86
+ const { query } = ctx.request;
87
+ if (!ctx.request.body) {
88
+ ctx.request.body = {};
89
+ }
90
+ const body = ctx.request.body;
91
+ const { getValidLocale: getValidLocale2, isLocalizedContentType: isLocalizedContentType2 } = getService("content-types");
92
+ const modelDef = strapi.getModel(model);
93
+ if (!isLocalizedContentType2(modelDef)) {
94
+ return next();
95
+ }
96
+ const locale2 = fp.get("locale", query) || fp.get("locale", body) || void 0;
97
+ ctx.request.query = {};
98
+ let entityLocale;
99
+ try {
100
+ entityLocale = await getValidLocale2(locale2);
101
+ } catch (e) {
102
+ throw new ApplicationError$3("This locale doesn't exist");
103
+ }
104
+ body.locale = entityLocale;
105
+ if (modelDef.kind === "singleType") {
106
+ const entity = await strapi.entityService.findMany(modelDef.uid, {
107
+ locale: entityLocale
108
+ });
109
+ ctx.request.query.locale = body.locale;
110
+ if (entity) {
111
+ return next();
112
+ }
113
+ }
114
+ return next();
115
+ };
116
+ const { ValidationError } = utils.errors;
117
+ const LOCALE_SCALAR_TYPENAME = "I18NLocaleCode";
118
+ const LOCALE_ARG_PLUGIN_NAME = "I18NLocaleArg";
119
+ const graphqlProvider = ({ strapi: strapi2 }) => ({
120
+ register() {
121
+ const { service: getGraphQLService } = strapi2.plugin("graphql");
122
+ const { service: getI18NService } = strapi2.plugin("i18n");
123
+ const { isLocalizedContentType: isLocalizedContentType2 } = getI18NService("content-types");
124
+ const extensionService = getGraphQLService("extension");
125
+ extensionService.shadowCRUD("plugin::i18n.locale").disableMutations();
126
+ Object.entries(strapi2.contentTypes).forEach(([uid, ct]) => {
127
+ if (isLocalizedContentType2(ct)) {
128
+ extensionService.shadowCRUD(uid).field("locale").disableInput();
129
+ extensionService.shadowCRUD(uid).field("localizations").disableInput();
130
+ }
131
+ });
132
+ extensionService.use(({ nexus, typeRegistry }) => {
133
+ const i18nLocaleArgPlugin = getI18nLocaleArgPlugin({ nexus, typeRegistry });
134
+ const i18nLocaleScalar = getLocaleScalar({ nexus });
135
+ return {
136
+ plugins: [i18nLocaleArgPlugin],
137
+ types: [i18nLocaleScalar],
138
+ resolversConfig: {
139
+ // Modify the default scope associated to find and findOne locale queries to match the actual action name
140
+ "Query.i18NLocale": { auth: { scope: "plugin::i18n.locales.listLocales" } },
141
+ "Query.i18NLocales": { auth: { scope: "plugin::i18n.locales.listLocales" } }
142
+ }
143
+ };
144
+ });
145
+ }
146
+ });
147
+ const getLocaleScalar = ({ nexus }) => {
148
+ const { service: getI18NService } = strapi.plugin("i18n");
149
+ const locales2 = getI18NService("iso-locales").getIsoLocales();
150
+ return nexus.scalarType({
151
+ name: LOCALE_SCALAR_TYPENAME,
152
+ description: "A string used to identify an i18n locale",
153
+ serialize: fp.identity,
154
+ parseValue: fp.identity,
155
+ parseLiteral(ast) {
156
+ if (ast.kind !== "StringValue") {
157
+ throw new ValidationError("Locale cannot represent non string type");
158
+ }
159
+ const isValidLocale = ast.value === "*" || locales2.find(fp.propEq("code", ast.value));
160
+ if (!isValidLocale) {
161
+ throw new ValidationError("Unknown locale supplied");
162
+ }
163
+ return ast.value;
164
+ }
165
+ });
166
+ };
167
+ const getI18nLocaleArgPlugin = ({ nexus, typeRegistry }) => {
168
+ const { service: getI18NService } = strapi.plugin("i18n");
169
+ const { isLocalizedContentType: isLocalizedContentType2 } = getI18NService("content-types");
170
+ return nexus.plugin({
171
+ name: LOCALE_ARG_PLUGIN_NAME,
172
+ onAddOutputField(config) {
173
+ const { parentType } = config;
174
+ if (parentType !== "Query" && parentType !== "Mutation") {
175
+ return;
176
+ }
177
+ let contentType;
178
+ if (config?.extensions?.strapi?.contentType) {
179
+ contentType = config.extensions.strapi.contentType;
180
+ } else {
181
+ const registryType = typeRegistry.get(config.type);
182
+ if (!registryType) {
183
+ return;
184
+ }
185
+ contentType = registryType.config.contentType;
186
+ }
187
+ if (!isLocalizedContentType2(contentType)) {
188
+ return;
189
+ }
190
+ if (!config.args) {
191
+ config.args = {};
192
+ }
193
+ config.args.locale = nexus.arg({
194
+ type: LOCALE_SCALAR_TYPENAME,
195
+ description: "The locale to use for the query"
196
+ });
197
+ }
198
+ });
199
+ };
200
+ const isoLocales = [
201
+ {
202
+ code: "af",
203
+ name: "Afrikaans (af)"
204
+ },
205
+ {
206
+ code: "af-NA",
207
+ name: "Afrikaans (Namibia) (af-NA)"
208
+ },
209
+ {
210
+ code: "af-ZA",
211
+ name: "Afrikaans (South Africa) (af-ZA)"
212
+ },
213
+ {
214
+ code: "agq",
215
+ name: "Aghem (agq)"
216
+ },
217
+ {
218
+ code: "agq-CM",
219
+ name: "Aghem (Cameroon) (agq-CM)"
220
+ },
221
+ {
222
+ code: "ak",
223
+ name: "Akan (ak)"
224
+ },
225
+ {
226
+ code: "ak-GH",
227
+ name: "Akan (Ghana) (ak-GH)"
228
+ },
229
+ {
230
+ code: "sq",
231
+ name: "Albanian (sq)"
232
+ },
233
+ {
234
+ code: "sq-AL",
235
+ name: "Albanian (Albania) (sq-AL)"
236
+ },
237
+ {
238
+ code: "am",
239
+ name: "Amharic (am)"
240
+ },
241
+ {
242
+ code: "am-ET",
243
+ name: "Amharic (Ethiopia) (am-ET)"
244
+ },
245
+ {
246
+ code: "aig",
247
+ name: "Antigua and Barbuda Creole English"
248
+ },
249
+ {
250
+ code: "ar",
251
+ name: "Arabic (ar)"
252
+ },
253
+ {
254
+ code: "ar-DZ",
255
+ name: "Arabic (Algeria) (ar-DZ)"
256
+ },
257
+ {
258
+ code: "ar-BH",
259
+ name: "Arabic (Bahrain) (ar-BH)"
260
+ },
261
+ {
262
+ code: "ar-EG",
263
+ name: "Arabic (Egypt) (ar-EG)"
264
+ },
265
+ {
266
+ code: "ar-IQ",
267
+ name: "Arabic (Iraq) (ar-IQ)"
268
+ },
269
+ {
270
+ code: "ar-JO",
271
+ name: "Arabic (Jordan) (ar-JO)"
272
+ },
273
+ {
274
+ code: "ar-KW",
275
+ name: "Arabic (Kuwait) (ar-KW)"
276
+ },
277
+ {
278
+ code: "ar-LB",
279
+ name: "Arabic (Lebanon) (ar-LB)"
280
+ },
281
+ {
282
+ code: "ar-LY",
283
+ name: "Arabic (Libya) (ar-LY)"
284
+ },
285
+ {
286
+ code: "ar-MA",
287
+ name: "Arabic (Morocco) (ar-MA)"
288
+ },
289
+ {
290
+ code: "ar-OM",
291
+ name: "Arabic (Oman) (ar-OM)"
292
+ },
293
+ {
294
+ code: "ar-QA",
295
+ name: "Arabic (Qatar) (ar-QA)"
296
+ },
297
+ {
298
+ code: "ar-SA",
299
+ name: "Arabic (Saudi Arabia) (ar-SA)"
300
+ },
301
+ {
302
+ code: "ar-SD",
303
+ name: "Arabic (Sudan) (ar-SD)"
304
+ },
305
+ {
306
+ code: "ar-SY",
307
+ name: "Arabic (Syria) (ar-SY)"
308
+ },
309
+ {
310
+ code: "ar-TN",
311
+ name: "Arabic (Tunisia) (ar-TN)"
312
+ },
313
+ {
314
+ code: "ar-AE",
315
+ name: "Arabic (United Arab Emirates) (ar-AE)"
316
+ },
317
+ {
318
+ code: "ar-001",
319
+ name: "Arabic (World) (ar-001)"
320
+ },
321
+ {
322
+ code: "ar-YE",
323
+ name: "Arabic (Yemen) (ar-YE)"
324
+ },
325
+ {
326
+ code: "hy",
327
+ name: "Armenian (hy)"
328
+ },
329
+ {
330
+ code: "hy-AM",
331
+ name: "Armenian (Armenia) (hy-AM)"
332
+ },
333
+ {
334
+ code: "as",
335
+ name: "Assamese (as)"
336
+ },
337
+ {
338
+ code: "as-IN",
339
+ name: "Assamese (India) (as-IN)"
340
+ },
341
+ {
342
+ code: "ast",
343
+ name: "Asturian (ast)"
344
+ },
345
+ {
346
+ code: "ast-ES",
347
+ name: "Asturian (Spain) (ast-ES)"
348
+ },
349
+ {
350
+ code: "asa",
351
+ name: "Asu (asa)"
352
+ },
353
+ {
354
+ code: "asa-TZ",
355
+ name: "Asu (Tanzania) (asa-TZ)"
356
+ },
357
+ {
358
+ code: "az",
359
+ name: "Azerbaijani (az)"
360
+ },
361
+ {
362
+ code: "az-Cyrl",
363
+ name: "Azerbaijani (Cyrillic) (az-Cyrl)"
364
+ },
365
+ {
366
+ code: "az-Cyrl-AZ",
367
+ name: "Azerbaijani (Cyrillic, Azerbaijan) (az-Cyrl-AZ)"
368
+ },
369
+ {
370
+ code: "az-Latn",
371
+ name: "Azerbaijani (Latin) (az-Latn)"
372
+ },
373
+ {
374
+ code: "az-Latn-AZ",
375
+ name: "Azerbaijani (Latin, Azerbaijan) (az-Latn-AZ)"
376
+ },
377
+ {
378
+ code: "ksf",
379
+ name: "Bafia (ksf)"
380
+ },
381
+ {
382
+ code: "ksf-CM",
383
+ name: "Bafia (Cameroon) (ksf-CM)"
384
+ },
385
+ {
386
+ code: "bah",
387
+ name: "Bahamas Creole English"
388
+ },
389
+ {
390
+ code: "bm",
391
+ name: "Bambara (bm)"
392
+ },
393
+ {
394
+ code: "bm-ML",
395
+ name: "Bambara (Mali) (bm-ML)"
396
+ },
397
+ {
398
+ code: "bas",
399
+ name: "Basaa (bas)"
400
+ },
401
+ {
402
+ code: "bas-CM",
403
+ name: "Basaa (Cameroon) (bas-CM)"
404
+ },
405
+ {
406
+ code: "eu",
407
+ name: "Basque (eu)"
408
+ },
409
+ {
410
+ code: "eu-ES",
411
+ name: "Basque (Spain) (eu-ES)"
412
+ },
413
+ {
414
+ code: "be",
415
+ name: "Belarusian (be)"
416
+ },
417
+ {
418
+ code: "be-BY",
419
+ name: "Belarusian (Belarus) (be-BY)"
420
+ },
421
+ {
422
+ code: "bem",
423
+ name: "Bemba (bem)"
424
+ },
425
+ {
426
+ code: "bem-ZM",
427
+ name: "Bemba (Zambia) (bem-ZM)"
428
+ },
429
+ {
430
+ code: "bez",
431
+ name: "Bena (bez)"
432
+ },
433
+ {
434
+ code: "bez-TZ",
435
+ name: "Bena (Tanzania) (bez-TZ)"
436
+ },
437
+ {
438
+ code: "bn",
439
+ name: "Bengali (bn)"
440
+ },
441
+ {
442
+ code: "bn-BD",
443
+ name: "Bengali (Bangladesh) (bn-BD)"
444
+ },
445
+ {
446
+ code: "bn-IN",
447
+ name: "Bengali (India) (bn-IN)"
448
+ },
449
+ {
450
+ code: "brx",
451
+ name: "Bodo (brx)"
452
+ },
453
+ {
454
+ code: "brx-IN",
455
+ name: "Bodo (India) (brx-IN)"
456
+ },
457
+ {
458
+ code: "bs",
459
+ name: "Bosnian (bs)"
460
+ },
461
+ {
462
+ code: "bs-BA",
463
+ name: "Bosnian (Bosnia and Herzegovina) (bs-BA)"
464
+ },
465
+ {
466
+ code: "br",
467
+ name: "Breton (br)"
468
+ },
469
+ {
470
+ code: "br-FR",
471
+ name: "Breton (France) (br-FR)"
472
+ },
473
+ {
474
+ code: "bg",
475
+ name: "Bulgarian (bg)"
476
+ },
477
+ {
478
+ code: "bg-BG",
479
+ name: "Bulgarian (Bulgaria) (bg-BG)"
480
+ },
481
+ {
482
+ code: "my",
483
+ name: "Burmese (my)"
484
+ },
485
+ {
486
+ code: "my-MM",
487
+ name: "Burmese (Myanmar [Burma]) (my-MM)"
488
+ },
489
+ {
490
+ code: "ca",
491
+ name: "Catalan (ca)"
492
+ },
493
+ {
494
+ code: "ca-ES",
495
+ name: "Catalan (Spain) (ca-ES)"
496
+ },
497
+ {
498
+ code: "ckb",
499
+ name: "Central Kurdish (ckb)"
500
+ },
501
+ {
502
+ code: "kmr",
503
+ name: "Northern Kurdish (kmr)"
504
+ },
505
+ {
506
+ code: "sdh",
507
+ name: "Southern Kurdish (sdh)"
508
+ },
509
+ {
510
+ code: "tzm",
511
+ name: "Central Morocco Tamazight (tzm)"
512
+ },
513
+ {
514
+ code: "tzm-Latn",
515
+ name: "Central Morocco Tamazight (Latin) (tzm-Latn)"
516
+ },
517
+ {
518
+ code: "tzm-Latn-MA",
519
+ name: "Central Morocco Tamazight (Latin, Morocco) (tzm-Latn-MA) "
520
+ },
521
+ {
522
+ code: "chr",
523
+ name: "Cherokee (chr)"
524
+ },
525
+ {
526
+ code: "chr-US",
527
+ name: "Cherokee (United States) (chr-US)"
528
+ },
529
+ {
530
+ code: "cgg",
531
+ name: "Chiga (cgg)"
532
+ },
533
+ {
534
+ code: "cgg-UG",
535
+ name: "Chiga (Uganda) (cgg-UG)"
536
+ },
537
+ {
538
+ code: "zh",
539
+ name: "Chinese (zh)"
540
+ },
541
+ {
542
+ code: "zh-Hans",
543
+ name: "Chinese (Simplified) (zh-Hans)"
544
+ },
545
+ {
546
+ code: "zh-CN",
547
+ name: "Chinese (Simplified, China) (zh-CN)"
548
+ },
549
+ {
550
+ code: "zh-Hans-CN",
551
+ name: "Chinese (Simplified, China) (zh-Hans-CN)"
552
+ },
553
+ {
554
+ code: "zh-Hans-HK",
555
+ name: "Chinese (Simplified, Hong Kong SAR China) (zh-Hans-HK)"
556
+ },
557
+ {
558
+ code: "zh-Hans-MO",
559
+ name: "Chinese (Simplified, Macau SAR China) (zh-Hans-MO) "
560
+ },
561
+ {
562
+ code: "zh-Hans-SG",
563
+ name: "Chinese (Simplified, Singapore) (zh-Hans-SG)"
564
+ },
565
+ {
566
+ code: "zh-Hant",
567
+ name: "Chinese (Traditional) (zh-Hant)"
568
+ },
569
+ {
570
+ code: "zh-Hant-HK",
571
+ name: "Chinese (Traditional, Hong Kong SAR China) (zh-Hant-HK) "
572
+ },
573
+ {
574
+ code: "zh-Hant-MO",
575
+ name: "Chinese (Traditional, Macau SAR China) (zh-Hant-MO) "
576
+ },
577
+ {
578
+ code: "zh-Hant-TW",
579
+ name: "Chinese (Traditional, Taiwan) (zh-Hant-TW)"
580
+ },
581
+ {
582
+ code: "swc",
583
+ name: "Congo Swahili (swc)"
584
+ },
585
+ {
586
+ code: "swc-CD",
587
+ name: "Congo Swahili (Congo - Kinshasa) (swc-CD)"
588
+ },
589
+ {
590
+ code: "kw",
591
+ name: "Cornish (kw)"
592
+ },
593
+ {
594
+ code: "kw-GB",
595
+ name: "Cornish (United Kingdom) (kw-GB)"
596
+ },
597
+ {
598
+ code: "hr",
599
+ name: "Croatian (hr)"
600
+ },
601
+ {
602
+ code: "hr-HR",
603
+ name: "Croatian (Croatia) (hr-HR)"
604
+ },
605
+ {
606
+ code: "cs",
607
+ name: "Czech (cs)"
608
+ },
609
+ {
610
+ code: "cs-CZ",
611
+ name: "Czech (Czech Republic) (cs-CZ)"
612
+ },
613
+ {
614
+ code: "da",
615
+ name: "Danish (da)"
616
+ },
617
+ {
618
+ code: "da-DK",
619
+ name: "Danish (Denmark) (da-DK)"
620
+ },
621
+ {
622
+ code: "dua",
623
+ name: "Duala (dua)"
624
+ },
625
+ {
626
+ code: "dua-CM",
627
+ name: "Duala (Cameroon) (dua-CM)"
628
+ },
629
+ {
630
+ code: "dv",
631
+ name: "Dhivehi (Maldives)"
632
+ },
633
+ {
634
+ code: "nl",
635
+ name: "Dutch (nl)"
636
+ },
637
+ {
638
+ code: "nl-AW",
639
+ name: "Dutch (Aruba) (nl-AW)"
640
+ },
641
+ {
642
+ code: "nl-BE",
643
+ name: "Dutch (Belgium) (nl-BE)"
644
+ },
645
+ {
646
+ code: "nl-CW",
647
+ name: "Dutch (Curaçao) (nl-CW)"
648
+ },
649
+ {
650
+ code: "nl-NL",
651
+ name: "Dutch (Netherlands) (nl-NL)"
652
+ },
653
+ {
654
+ code: "nl-SX",
655
+ name: "Dutch (Sint Maarten) (nl-SX)"
656
+ },
657
+ {
658
+ code: "ebu",
659
+ name: "Embu (ebu)"
660
+ },
661
+ {
662
+ code: "ebu-KE",
663
+ name: "Embu (Kenya) (ebu-KE)"
664
+ },
665
+ {
666
+ code: "en",
667
+ name: "English (en)"
668
+ },
669
+ {
670
+ code: "en-AI",
671
+ name: "English (Anguilla) (en-AI)"
672
+ },
673
+ {
674
+ code: "en-AS",
675
+ name: "English (American Samoa) (en-AS)"
676
+ },
677
+ {
678
+ code: "en-AU",
679
+ name: "English (Australia) (en-AU)"
680
+ },
681
+ {
682
+ code: "en-AT",
683
+ name: "English (Austria) (en-AT)"
684
+ },
685
+ {
686
+ code: "en-BB",
687
+ name: "English (Barbados) (en-BB)"
688
+ },
689
+ {
690
+ code: "en-BE",
691
+ name: "English (Belgium) (en-BE)"
692
+ },
693
+ {
694
+ code: "en-BZ",
695
+ name: "English (Belize) (en-BZ)"
696
+ },
697
+ {
698
+ code: "en-BM",
699
+ name: "English (Bermuda) (en-BM)"
700
+ },
701
+ {
702
+ code: "en-BW",
703
+ name: "English (Botswana) (en-BW)"
704
+ },
705
+ {
706
+ code: "en-IO",
707
+ name: "English (British Indian Ocean Territory) (en-IO)"
708
+ },
709
+ {
710
+ code: "en-BI",
711
+ name: "English (Burundi) (en-BI)"
712
+ },
713
+ {
714
+ code: "en-CM",
715
+ name: "English (Cameroon) (en-CM)"
716
+ },
717
+ {
718
+ code: "en-CA",
719
+ name: "English (Canada) (en-CA)"
720
+ },
721
+ {
722
+ code: "en-KY",
723
+ name: "English (Cayman Islands) (en-KY)"
724
+ },
725
+ {
726
+ code: "en-CX",
727
+ name: "English (Christmas Island) (en-CX)"
728
+ },
729
+ {
730
+ code: "en-CC",
731
+ name: "English (Cocos [Keeling] Islands) (en-CC)"
732
+ },
733
+ {
734
+ code: "en-CK",
735
+ name: "English (Cook Islands) (en-CK)"
736
+ },
737
+ {
738
+ code: "en-CY",
739
+ name: "English (Cyprus) (en-CY)"
740
+ },
741
+ {
742
+ code: "en-DK",
743
+ name: "English (Denmark) (en-DK)"
744
+ },
745
+ {
746
+ code: "en-DG",
747
+ name: "English (Diego Garcia) (en-DG)"
748
+ },
749
+ {
750
+ code: "en-DM",
751
+ name: "English (Dominica) (en-DM)"
752
+ },
753
+ {
754
+ code: "en-EG",
755
+ name: "English (Egypt) (en-EG)"
756
+ },
757
+ {
758
+ code: "en-ER",
759
+ name: "English (Eritrea) (en-ER)"
760
+ },
761
+ {
762
+ code: "en-EU",
763
+ name: "English (Europe) (en-EU)"
764
+ },
765
+ {
766
+ code: "en-FK",
767
+ name: "English (Falkland Islands) (en-FK)"
768
+ },
769
+ {
770
+ code: "en-FJ",
771
+ name: "English (Fiji) (en-FJ)"
772
+ },
773
+ {
774
+ code: "en-FI",
775
+ name: "English (Finland) (en-FI)"
776
+ },
777
+ {
778
+ code: "en-GM",
779
+ name: "English (Gambia) (en-GM)"
780
+ },
781
+ {
782
+ code: "en-DE",
783
+ name: "English (Germany) (en-DE)"
784
+ },
785
+ {
786
+ code: "en-GH",
787
+ name: "English (Ghana) (en-GH)"
788
+ },
789
+ {
790
+ code: "en-GI",
791
+ name: "English (Gibraltar) (en-GI)"
792
+ },
793
+ {
794
+ code: "en-GD",
795
+ name: "English (Grenada) (en-GD)"
796
+ },
797
+ {
798
+ code: "en-GU",
799
+ name: "English (Guam) (en-GU)"
800
+ },
801
+ {
802
+ code: "en-GG",
803
+ name: "English (Guernsey) (en-GG)"
804
+ },
805
+ {
806
+ code: "en-GY",
807
+ name: "English (Guyana) (en-GY)"
808
+ },
809
+ {
810
+ code: "en-HK",
811
+ name: "English (Hong Kong SAR China) (en-HK)"
812
+ },
813
+ {
814
+ code: "en-IN",
815
+ name: "English (India) (en-IN)"
816
+ },
817
+ {
818
+ code: "en-IE",
819
+ name: "English (Ireland) (en-IE)"
820
+ },
821
+ {
822
+ code: "en-IM",
823
+ name: "English (Isle of Man) (en-IM)"
824
+ },
825
+ {
826
+ code: "en-IL",
827
+ name: "English (Israel) (en-IL)"
828
+ },
829
+ {
830
+ code: "en-JM",
831
+ name: "English (Jamaica) (en-JM)"
832
+ },
833
+ {
834
+ code: "en-JE",
835
+ name: "English (Jersey) (en-JE)"
836
+ },
837
+ {
838
+ code: "en-KE",
839
+ name: "English (Kenya) (en-KE)"
840
+ },
841
+ {
842
+ code: "en-KI",
843
+ name: "English (Kiribati) (en-KI)"
844
+ },
845
+ {
846
+ code: "en-KW",
847
+ name: "English (Kuwait) (en-KW)"
848
+ },
849
+ {
850
+ code: "en-LS",
851
+ name: "English (Lesotho) (en-LS)"
852
+ },
853
+ {
854
+ code: "en-MO",
855
+ name: "English (Macao SAR China) (en-MO)"
856
+ },
857
+ {
858
+ code: "en-MG",
859
+ name: "English (Madagascar) (en-MG)"
860
+ },
861
+ {
862
+ code: "en-MW",
863
+ name: "English (Malawi) (en-MW)"
864
+ },
865
+ {
866
+ code: "en-MY",
867
+ name: "English (Malaysia) (en-MY)"
868
+ },
869
+ {
870
+ code: "en-MT",
871
+ name: "English (Malta) (en-MT)"
872
+ },
873
+ {
874
+ code: "en-MH",
875
+ name: "English (Marshall Islands) (en-MH)"
876
+ },
877
+ {
878
+ code: "en-MU",
879
+ name: "English (Mauritius) (en-MU)"
880
+ },
881
+ {
882
+ code: "en-FM",
883
+ name: "English (Micronesia) (en-FM)"
884
+ },
885
+ {
886
+ code: "en-MS",
887
+ name: "English (Montserrat) (en-MS)"
888
+ },
889
+ {
890
+ code: "en-NA",
891
+ name: "English (Namibia) (en-NA)"
892
+ },
893
+ {
894
+ code: "en-NR",
895
+ name: "English (Nauru) (en-NR)"
896
+ },
897
+ {
898
+ code: "en-NL",
899
+ name: "English (Netherlands) (en-NL)"
900
+ },
901
+ {
902
+ code: "en-NZ",
903
+ name: "English (New Zealand) (en-NZ)"
904
+ },
905
+ {
906
+ code: "en-NG",
907
+ name: "English (Nigeria) (en-NG)"
908
+ },
909
+ {
910
+ code: "en-NU",
911
+ name: "English (Niue) (en-NU)"
912
+ },
913
+ {
914
+ code: "en-NF",
915
+ name: "English (Norfolk Island) (en-NF)"
916
+ },
917
+ {
918
+ code: "en-MP",
919
+ name: "English (Northern Mariana Islands) (en-MP)"
920
+ },
921
+ {
922
+ code: "en-NO",
923
+ name: "English (Norway) (en-NO)"
924
+ },
925
+ {
926
+ code: "en-PA",
927
+ name: "English (Panama) (en-PA)"
928
+ },
929
+ {
930
+ code: "en-PK",
931
+ name: "English (Pakistan) (en-PK)"
932
+ },
933
+ {
934
+ code: "en-PW",
935
+ name: "English (Palau) (en-PW)"
936
+ },
937
+ {
938
+ code: "en-PG",
939
+ name: "English (Papua New Guinea) (en-PG)"
940
+ },
941
+ {
942
+ code: "en-PH",
943
+ name: "English (Philippines) (en-PH)"
944
+ },
945
+ {
946
+ code: "en-PN",
947
+ name: "English (Pitcairn Islands) (en-PN)"
948
+ },
949
+ {
950
+ code: "en-PR",
951
+ name: "English (Puerto Rico) (en-PR)"
952
+ },
953
+ {
954
+ code: "en-RW",
955
+ name: "English (Rwanda) (en-RW)"
956
+ },
957
+ {
958
+ code: "en-WS",
959
+ name: "English (Samoa) (en-WS)"
960
+ },
961
+ {
962
+ code: "en-SA",
963
+ name: "English (Saudi Arabia) (en-SA)"
964
+ },
965
+ {
966
+ code: "en-SC",
967
+ name: "English (Seychelles) (en-SC)"
968
+ },
969
+ {
970
+ code: "en-SL",
971
+ name: "English (Sierra Leone) (en-SL)"
972
+ },
973
+ {
974
+ code: "en-SG",
975
+ name: "English (Singapore) (en-SG)"
976
+ },
977
+ {
978
+ code: "en-SX",
979
+ name: "English (Sint Maarten) (en-SX)"
980
+ },
981
+ {
982
+ code: "en-SI",
983
+ name: "English (Slovenia) (en-SI)"
984
+ },
985
+ {
986
+ code: "en-SB",
987
+ name: "English (Solomon Islands) (en-SB)"
988
+ },
989
+ {
990
+ code: "en-SS",
991
+ name: "English (South Sudan) (en-SS)"
992
+ },
993
+ {
994
+ code: "en-SH",
995
+ name: "English (St Helena) (en-SH)"
996
+ },
997
+ {
998
+ code: "en-KN",
999
+ name: "English (St Kitts & Nevis) (en-KN)"
1000
+ },
1001
+ {
1002
+ code: "en-LC",
1003
+ name: "English (St Lucia) (en-LC)"
1004
+ },
1005
+ {
1006
+ code: "svc",
1007
+ name: "Vincentian Creole English"
1008
+ },
1009
+ {
1010
+ code: "vic",
1011
+ name: "Virgin Islands Creole English"
1012
+ },
1013
+ {
1014
+ code: "en-SD",
1015
+ name: "English (Sudan) (en-SD)"
1016
+ },
1017
+ {
1018
+ code: "en-SZ",
1019
+ name: "English (Swaziland) (en-SZ)"
1020
+ },
1021
+ {
1022
+ code: "en-SE",
1023
+ name: "English (Sweden) (en-SE)"
1024
+ },
1025
+ {
1026
+ code: "en-CH",
1027
+ name: "English (Switzerland) (en-CH)"
1028
+ },
1029
+ {
1030
+ code: "en-TZ",
1031
+ name: "English (Tanzania) (en-TZ)"
1032
+ },
1033
+ {
1034
+ code: "en-TK",
1035
+ name: "English (Tokelau) (en-TK)"
1036
+ },
1037
+ {
1038
+ code: "en-TO",
1039
+ name: "English (Tonga) (en-TO)"
1040
+ },
1041
+ {
1042
+ code: "en-TT",
1043
+ name: "English (Trinidad and Tobago) (en-TT)"
1044
+ },
1045
+ {
1046
+ code: "en-TV",
1047
+ name: "English (Tuvalu) (en-TV)"
1048
+ },
1049
+ {
1050
+ code: "en-ZA",
1051
+ name: "English (South Africa) (en-ZA)"
1052
+ },
1053
+ {
1054
+ code: "en-AE",
1055
+ name: "English (U.A.E.) (en-AE)"
1056
+ },
1057
+ {
1058
+ code: "en-UM",
1059
+ name: "English (U.S. Minor Outlying Islands) (en-UM)"
1060
+ },
1061
+ {
1062
+ code: "en-VI",
1063
+ name: "English (U.S. Virgin Islands) (en-VI)"
1064
+ },
1065
+ {
1066
+ code: "en-US-POSIX",
1067
+ name: "English (U.S., Computer) (en-US-POSIX)"
1068
+ },
1069
+ {
1070
+ code: "en-UG",
1071
+ name: "English (Uganda) (en-UG)"
1072
+ },
1073
+ {
1074
+ code: "en-GB",
1075
+ name: "English (United Kingdom) (en-GB)"
1076
+ },
1077
+ {
1078
+ code: "en-US",
1079
+ name: "English (United States) (en-US)"
1080
+ },
1081
+ {
1082
+ code: "en-VU",
1083
+ name: "English (Vanuatu) (en-VU)"
1084
+ },
1085
+ {
1086
+ code: "en-ZM",
1087
+ name: "English (Zambia) (en-ZM)"
1088
+ },
1089
+ {
1090
+ code: "en-ZW",
1091
+ name: "English (Zimbabwe) (en-ZW)"
1092
+ },
1093
+ {
1094
+ code: "eo",
1095
+ name: "Esperanto (eo)"
1096
+ },
1097
+ {
1098
+ code: "et",
1099
+ name: "Estonian (et)"
1100
+ },
1101
+ {
1102
+ code: "et-EE",
1103
+ name: "Estonian (Estonia) (et-EE)"
1104
+ },
1105
+ {
1106
+ code: "ee",
1107
+ name: "Ewe (ee)"
1108
+ },
1109
+ {
1110
+ code: "ee-GH",
1111
+ name: "Ewe (Ghana) (ee-GH)"
1112
+ },
1113
+ {
1114
+ code: "ee-TG",
1115
+ name: "Ewe (Togo) (ee-TG)"
1116
+ },
1117
+ {
1118
+ code: "ewo",
1119
+ name: "Ewondo (ewo)"
1120
+ },
1121
+ {
1122
+ code: "ewo-CM",
1123
+ name: "Ewondo (Cameroon) (ewo-CM)"
1124
+ },
1125
+ {
1126
+ code: "fo",
1127
+ name: "Faroese (fo)"
1128
+ },
1129
+ {
1130
+ code: "fo-FO",
1131
+ name: "Faroese (Faroe Islands) (fo-FO)"
1132
+ },
1133
+ {
1134
+ code: "fil",
1135
+ name: "Filipino (fil)"
1136
+ },
1137
+ {
1138
+ code: "fil-PH",
1139
+ name: "Filipino (Philippines) (fil-PH)"
1140
+ },
1141
+ {
1142
+ code: "fi",
1143
+ name: "Finnish (fi)"
1144
+ },
1145
+ {
1146
+ code: "fi-FI",
1147
+ name: "Finnish (Finland) (fi-FI)"
1148
+ },
1149
+ {
1150
+ code: "fr",
1151
+ name: "French (fr)"
1152
+ },
1153
+ {
1154
+ code: "fr-BE",
1155
+ name: "French (Belgium) (fr-BE)"
1156
+ },
1157
+ {
1158
+ code: "fr-BJ",
1159
+ name: "French (Benin) (fr-BJ)"
1160
+ },
1161
+ {
1162
+ code: "fr-BF",
1163
+ name: "French (Burkina Faso) (fr-BF)"
1164
+ },
1165
+ {
1166
+ code: "fr-BI",
1167
+ name: "French (Burundi) (fr-BI)"
1168
+ },
1169
+ {
1170
+ code: "fr-CM",
1171
+ name: "French (Cameroon) (fr-CM)"
1172
+ },
1173
+ {
1174
+ code: "fr-CA",
1175
+ name: "French (Canada) (fr-CA)"
1176
+ },
1177
+ {
1178
+ code: "fr-CF",
1179
+ name: "French (Central African Republic) (fr-CF)"
1180
+ },
1181
+ {
1182
+ code: "fr-TD",
1183
+ name: "French (Chad) (fr-TD)"
1184
+ },
1185
+ {
1186
+ code: "fr-KM",
1187
+ name: "French (Comoros) (fr-KM)"
1188
+ },
1189
+ {
1190
+ code: "fr-CG",
1191
+ name: "French (Congo - Brazzaville) (fr-CG)"
1192
+ },
1193
+ {
1194
+ code: "fr-CD",
1195
+ name: "French (Congo - Kinshasa) (fr-CD)"
1196
+ },
1197
+ {
1198
+ code: "fr-CI",
1199
+ name: "French (Côte d’Ivoire) (fr-CI)"
1200
+ },
1201
+ {
1202
+ code: "fr-DJ",
1203
+ name: "French (Djibouti) (fr-DJ)"
1204
+ },
1205
+ {
1206
+ code: "fr-GQ",
1207
+ name: "French (Equatorial Guinea) (fr-GQ)"
1208
+ },
1209
+ {
1210
+ code: "fr-FR",
1211
+ name: "French (France) (fr-FR)"
1212
+ },
1213
+ {
1214
+ code: "fr-GF",
1215
+ name: "French (French Guiana) (fr-GF)"
1216
+ },
1217
+ {
1218
+ code: "fr-GA",
1219
+ name: "French (Gabon) (fr-GA)"
1220
+ },
1221
+ {
1222
+ code: "fr-GP",
1223
+ name: "French (Guadeloupe) (fr-GP)"
1224
+ },
1225
+ {
1226
+ code: "fr-GN",
1227
+ name: "French (Guinea) (fr-GN)"
1228
+ },
1229
+ {
1230
+ code: "fr-LU",
1231
+ name: "French (Luxembourg) (fr-LU)"
1232
+ },
1233
+ {
1234
+ code: "fr-MG",
1235
+ name: "French (Madagascar) (fr-MG)"
1236
+ },
1237
+ {
1238
+ code: "fr-ML",
1239
+ name: "French (Mali) (fr-ML)"
1240
+ },
1241
+ {
1242
+ code: "fr-MQ",
1243
+ name: "French (Martinique) (fr-MQ)"
1244
+ },
1245
+ {
1246
+ code: "fr-YT",
1247
+ name: "French (Mayotte) (fr-YT)"
1248
+ },
1249
+ {
1250
+ code: "fr-MC",
1251
+ name: "French (Monaco) (fr-MC)"
1252
+ },
1253
+ {
1254
+ code: "fr-NE",
1255
+ name: "French (Niger) (fr-NE)"
1256
+ },
1257
+ {
1258
+ code: "fr-RW",
1259
+ name: "French (Rwanda) (fr-RW)"
1260
+ },
1261
+ {
1262
+ code: "fr-RE",
1263
+ name: "French (Réunion) (fr-RE)"
1264
+ },
1265
+ {
1266
+ code: "fr-BL",
1267
+ name: "French (Saint Barthélemy) (fr-BL)"
1268
+ },
1269
+ {
1270
+ code: "fr-MF",
1271
+ name: "French (Saint Martin) (fr-MF)"
1272
+ },
1273
+ {
1274
+ code: "fr-MU",
1275
+ name: "French (Mauritius) (fr-MU)"
1276
+ },
1277
+ {
1278
+ code: "fr-SN",
1279
+ name: "French (Senegal) (fr-SN)"
1280
+ },
1281
+ {
1282
+ code: "fr-CH",
1283
+ name: "French (Switzerland) (fr-CH)"
1284
+ },
1285
+ {
1286
+ code: "fr-TG",
1287
+ name: "French (Togo) (fr-TG)"
1288
+ },
1289
+ {
1290
+ code: "ff",
1291
+ name: "Fulah (ff)"
1292
+ },
1293
+ {
1294
+ code: "ff-SN",
1295
+ name: "Fulah (Senegal) (ff-SN)"
1296
+ },
1297
+ {
1298
+ code: "gl",
1299
+ name: "Galician (gl)"
1300
+ },
1301
+ {
1302
+ code: "gl-ES",
1303
+ name: "Galician (Spain) (gl-ES)"
1304
+ },
1305
+ {
1306
+ code: "lao",
1307
+ name: "Laotian (Laos) (lao)"
1308
+ },
1309
+ {
1310
+ code: "lg",
1311
+ name: "Ganda (lg)"
1312
+ },
1313
+ {
1314
+ code: "lg-UG",
1315
+ name: "Ganda (Uganda) (lg-UG)"
1316
+ },
1317
+ {
1318
+ code: "ka",
1319
+ name: "Georgian (ka)"
1320
+ },
1321
+ {
1322
+ code: "ka-GE",
1323
+ name: "Georgian (Georgia) (ka-GE)"
1324
+ },
1325
+ {
1326
+ code: "de",
1327
+ name: "German (de)"
1328
+ },
1329
+ {
1330
+ code: "de-AT",
1331
+ name: "German (Austria) (de-AT)"
1332
+ },
1333
+ {
1334
+ code: "de-BE",
1335
+ name: "German (Belgium) (de-BE)"
1336
+ },
1337
+ {
1338
+ code: "de-DE",
1339
+ name: "German (Germany) (de-DE)"
1340
+ },
1341
+ {
1342
+ code: "de-LI",
1343
+ name: "German (Liechtenstein) (de-LI)"
1344
+ },
1345
+ {
1346
+ code: "de-LU",
1347
+ name: "German (Luxembourg) (de-LU)"
1348
+ },
1349
+ {
1350
+ code: "de-CH",
1351
+ name: "German (Switzerland) (de-CH)"
1352
+ },
1353
+ {
1354
+ code: "el",
1355
+ name: "Greek (el)"
1356
+ },
1357
+ {
1358
+ code: "el-CY",
1359
+ name: "Greek (Cyprus) (el-CY)"
1360
+ },
1361
+ {
1362
+ code: "el-GR",
1363
+ name: "Greek (Greece) (el-GR)"
1364
+ },
1365
+ {
1366
+ code: "gu",
1367
+ name: "Gujarati (gu)"
1368
+ },
1369
+ {
1370
+ code: "gu-IN",
1371
+ name: "Gujarati (India) (gu-IN)"
1372
+ },
1373
+ {
1374
+ code: "guz",
1375
+ name: "Gusii (guz)"
1376
+ },
1377
+ {
1378
+ code: "guz-KE",
1379
+ name: "Gusii (Kenya) (guz-KE)"
1380
+ },
1381
+ {
1382
+ code: "ha",
1383
+ name: "Hausa (ha)"
1384
+ },
1385
+ {
1386
+ code: "ha-Latn",
1387
+ name: "Hausa (Latin) (ha-Latn)"
1388
+ },
1389
+ {
1390
+ code: "ha-Latn-GH",
1391
+ name: "Hausa (Latin, Ghana) (ha-Latn-GH)"
1392
+ },
1393
+ {
1394
+ code: "ha-Latn-NE",
1395
+ name: "Hausa (Latin, Niger) (ha-Latn-NE)"
1396
+ },
1397
+ {
1398
+ code: "ha-Latn-NG",
1399
+ name: "Hausa (Latin, Nigeria) (ha-Latn-NG)"
1400
+ },
1401
+ {
1402
+ code: "haw",
1403
+ name: "Hawaiian (haw)"
1404
+ },
1405
+ {
1406
+ code: "haw-US",
1407
+ name: "Hawaiian (United States) (haw-US)"
1408
+ },
1409
+ {
1410
+ code: "he",
1411
+ name: "Hebrew (he)"
1412
+ },
1413
+ {
1414
+ code: "he-IL",
1415
+ name: "Hebrew (Israel) (he-IL)"
1416
+ },
1417
+ {
1418
+ code: "hi",
1419
+ name: "Hindi (hi)"
1420
+ },
1421
+ {
1422
+ code: "hi-IN",
1423
+ name: "Hindi (India) (hi-IN)"
1424
+ },
1425
+ {
1426
+ code: "hu",
1427
+ name: "Hungarian (hu)"
1428
+ },
1429
+ {
1430
+ code: "hu-HU",
1431
+ name: "Hungarian (Hungary) (hu-HU)"
1432
+ },
1433
+ {
1434
+ code: "is",
1435
+ name: "Icelandic (is)"
1436
+ },
1437
+ {
1438
+ code: "is-IS",
1439
+ name: "Icelandic (Iceland) (is-IS)"
1440
+ },
1441
+ {
1442
+ code: "ig",
1443
+ name: "Igbo (ig)"
1444
+ },
1445
+ {
1446
+ code: "ig-NG",
1447
+ name: "Igbo (Nigeria) (ig-NG)"
1448
+ },
1449
+ {
1450
+ code: "smn",
1451
+ name: "Inari Sami"
1452
+ },
1453
+ {
1454
+ code: "smn-FI",
1455
+ name: "Inari Sami (Finland)"
1456
+ },
1457
+ {
1458
+ code: "id",
1459
+ name: "Indonesian (id)"
1460
+ },
1461
+ {
1462
+ code: "id-ID",
1463
+ name: "Indonesian (Indonesia) (id-ID)"
1464
+ },
1465
+ {
1466
+ code: "ga",
1467
+ name: "Irish (ga)"
1468
+ },
1469
+ {
1470
+ code: "ga-IE",
1471
+ name: "Irish (Ireland) (ga-IE)"
1472
+ },
1473
+ {
1474
+ code: "it",
1475
+ name: "Italian (it)"
1476
+ },
1477
+ {
1478
+ code: "it-IT",
1479
+ name: "Italian (Italy) (it-IT)"
1480
+ },
1481
+ {
1482
+ code: "it-CH",
1483
+ name: "Italian (Switzerland) (it-CH)"
1484
+ },
1485
+ {
1486
+ code: "ja",
1487
+ name: "Japanese (ja)"
1488
+ },
1489
+ {
1490
+ code: "ja-JP",
1491
+ name: "Japanese (Japan) (ja-JP)"
1492
+ },
1493
+ {
1494
+ code: "dyo",
1495
+ name: "Jola-Fonyi (dyo)"
1496
+ },
1497
+ {
1498
+ code: "dyo-SN",
1499
+ name: "Jola-Fonyi (Senegal) (dyo-SN)"
1500
+ },
1501
+ {
1502
+ code: "kea",
1503
+ name: "Kabuverdianu (kea)"
1504
+ },
1505
+ {
1506
+ code: "kea-CV",
1507
+ name: "Kabuverdianu (Cape Verde) (kea-CV)"
1508
+ },
1509
+ {
1510
+ code: "kab",
1511
+ name: "Kabyle (kab)"
1512
+ },
1513
+ {
1514
+ code: "kab-DZ",
1515
+ name: "Kabyle (Algeria) (kab-DZ)"
1516
+ },
1517
+ {
1518
+ code: "kl",
1519
+ name: "Kalaallisut (kl)"
1520
+ },
1521
+ {
1522
+ code: "kl-GL",
1523
+ name: "Kalaallisut (Greenland) (kl-GL)"
1524
+ },
1525
+ {
1526
+ code: "kln",
1527
+ name: "Kalenjin (kln)"
1528
+ },
1529
+ {
1530
+ code: "kln-KE",
1531
+ name: "Kalenjin (Kenya) (kln-KE)"
1532
+ },
1533
+ {
1534
+ code: "kam",
1535
+ name: "Kamba (kam)"
1536
+ },
1537
+ {
1538
+ code: "kam-KE",
1539
+ name: "Kamba (Kenya) (kam-KE)"
1540
+ },
1541
+ {
1542
+ code: "kn",
1543
+ name: "Kannada (kn)"
1544
+ },
1545
+ {
1546
+ code: "kn-IN",
1547
+ name: "Kannada (India) (kn-IN)"
1548
+ },
1549
+ {
1550
+ code: "kaa",
1551
+ name: "Kara-Kalpak (kaa)"
1552
+ },
1553
+ {
1554
+ code: "kk",
1555
+ name: "Kazakh (kk)"
1556
+ },
1557
+ {
1558
+ code: "kk-Cyrl",
1559
+ name: "Kazakh (Cyrillic) (kk-Cyrl)"
1560
+ },
1561
+ {
1562
+ code: "kk-Cyrl-KZ",
1563
+ name: "Kazakh (Cyrillic, Kazakhstan) (kk-Cyrl-KZ)"
1564
+ },
1565
+ {
1566
+ code: "km",
1567
+ name: "Khmer (km)"
1568
+ },
1569
+ {
1570
+ code: "km-KH",
1571
+ name: "Khmer (Cambodia) (km-KH)"
1572
+ },
1573
+ {
1574
+ code: "ki",
1575
+ name: "Kikuyu (ki)"
1576
+ },
1577
+ {
1578
+ code: "ki-KE",
1579
+ name: "Kikuyu (Kenya) (ki-KE)"
1580
+ },
1581
+ {
1582
+ code: "rw",
1583
+ name: "Kinyarwanda (rw)"
1584
+ },
1585
+ {
1586
+ code: "rw-RW",
1587
+ name: "Kinyarwanda (Rwanda) (rw-RW)"
1588
+ },
1589
+ {
1590
+ code: "kok",
1591
+ name: "Konkani (kok)"
1592
+ },
1593
+ {
1594
+ code: "kok-IN",
1595
+ name: "Konkani (India) (kok-IN)"
1596
+ },
1597
+ {
1598
+ code: "ko",
1599
+ name: "Korean (ko)"
1600
+ },
1601
+ {
1602
+ code: "ko-KR",
1603
+ name: "Korean (South Korea) (ko-KR)"
1604
+ },
1605
+ {
1606
+ code: "khq",
1607
+ name: "Koyra Chiini (khq)"
1608
+ },
1609
+ {
1610
+ code: "khq-ML",
1611
+ name: "Koyra Chiini (Mali) (khq-ML)"
1612
+ },
1613
+ {
1614
+ code: "ses",
1615
+ name: "Koyraboro Senni (ses)"
1616
+ },
1617
+ {
1618
+ code: "ses-ML",
1619
+ name: "Koyraboro Senni (Mali) (ses-ML)"
1620
+ },
1621
+ {
1622
+ code: "nmg",
1623
+ name: "Kwasio (nmg)"
1624
+ },
1625
+ {
1626
+ code: "nmg-CM",
1627
+ name: "Kwasio (Cameroon) (nmg-CM)"
1628
+ },
1629
+ {
1630
+ code: "ky",
1631
+ name: "Kyrgyz (ky)"
1632
+ },
1633
+ {
1634
+ code: "lag",
1635
+ name: "Langi (lag)"
1636
+ },
1637
+ {
1638
+ code: "lag-TZ",
1639
+ name: "Langi (Tanzania) (lag-TZ)"
1640
+ },
1641
+ {
1642
+ code: "lv",
1643
+ name: "Latvian (lv)"
1644
+ },
1645
+ {
1646
+ code: "lv-LV",
1647
+ name: "Latvian (Latvia) (lv-LV)"
1648
+ },
1649
+ {
1650
+ code: "lir",
1651
+ name: "Liberian English"
1652
+ },
1653
+ {
1654
+ code: "ln",
1655
+ name: "Lingala (ln)"
1656
+ },
1657
+ {
1658
+ code: "ln-CG",
1659
+ name: "Lingala (Congo - Brazzaville) (ln-CG)"
1660
+ },
1661
+ {
1662
+ code: "ln-CD",
1663
+ name: "Lingala (Congo - Kinshasa) (ln-CD)"
1664
+ },
1665
+ {
1666
+ code: "lt",
1667
+ name: "Lithuanian (lt)"
1668
+ },
1669
+ {
1670
+ code: "lt-LT",
1671
+ name: "Lithuanian (Lithuania) (lt-LT)"
1672
+ },
1673
+ {
1674
+ code: "lu",
1675
+ name: "Luba-Katanga (lu)"
1676
+ },
1677
+ {
1678
+ code: "lu-CD",
1679
+ name: "Luba-Katanga (Congo - Kinshasa) (lu-CD)"
1680
+ },
1681
+ {
1682
+ code: "luo",
1683
+ name: "Luo (luo)"
1684
+ },
1685
+ {
1686
+ code: "luo-KE",
1687
+ name: "Luo (Kenya) (luo-KE)"
1688
+ },
1689
+ {
1690
+ code: "luy",
1691
+ name: "Luyia (luy)"
1692
+ },
1693
+ {
1694
+ code: "luy-KE",
1695
+ name: "Luyia (Kenya) (luy-KE)"
1696
+ },
1697
+ {
1698
+ code: "mk",
1699
+ name: "Macedonian (mk)"
1700
+ },
1701
+ {
1702
+ code: "mk-MK",
1703
+ name: "Macedonian (Macedonia) (mk-MK)"
1704
+ },
1705
+ {
1706
+ code: "jmc",
1707
+ name: "Machame (jmc)"
1708
+ },
1709
+ {
1710
+ code: "jmc-TZ",
1711
+ name: "Machame (Tanzania) (jmc-TZ)"
1712
+ },
1713
+ {
1714
+ code: "mgh",
1715
+ name: "Makhuwa-Meetto (mgh)"
1716
+ },
1717
+ {
1718
+ code: "mgh-MZ",
1719
+ name: "Makhuwa-Meetto (Mozambique) (mgh-MZ)"
1720
+ },
1721
+ {
1722
+ code: "kde",
1723
+ name: "Makonde (kde)"
1724
+ },
1725
+ {
1726
+ code: "kde-TZ",
1727
+ name: "Makonde (Tanzania) (kde-TZ)"
1728
+ },
1729
+ {
1730
+ code: "mg",
1731
+ name: "Malagasy (mg)"
1732
+ },
1733
+ {
1734
+ code: "mg-MG",
1735
+ name: "Malagasy (Madagascar) (mg-MG)"
1736
+ },
1737
+ {
1738
+ code: "ms",
1739
+ name: "Malay (ms)"
1740
+ },
1741
+ {
1742
+ code: "ms-BN",
1743
+ name: "Malay (Brunei) (ms-BN)"
1744
+ },
1745
+ {
1746
+ code: "ms-MY",
1747
+ name: "Malay (Malaysia) (ms-MY)"
1748
+ },
1749
+ {
1750
+ code: "ml",
1751
+ name: "Malayalam (ml)"
1752
+ },
1753
+ {
1754
+ code: "ml-IN",
1755
+ name: "Malayalam (India) (ml-IN)"
1756
+ },
1757
+ {
1758
+ code: "mt",
1759
+ name: "Maltese (mt)"
1760
+ },
1761
+ {
1762
+ code: "mt-MT",
1763
+ name: "Maltese (Malta) (mt-MT)"
1764
+ },
1765
+ {
1766
+ code: "gv",
1767
+ name: "Manx (gv)"
1768
+ },
1769
+ {
1770
+ code: "gv-GB",
1771
+ name: "Manx (United Kingdom) (gv-GB)"
1772
+ },
1773
+ {
1774
+ code: "mr",
1775
+ name: "Marathi (mr)"
1776
+ },
1777
+ {
1778
+ code: "mr-IN",
1779
+ name: "Marathi (India) (mr-IN)"
1780
+ },
1781
+ {
1782
+ code: "mas",
1783
+ name: "Masai (mas)"
1784
+ },
1785
+ {
1786
+ code: "mas-KE",
1787
+ name: "Masai (Kenya) (mas-KE)"
1788
+ },
1789
+ {
1790
+ code: "mas-TZ",
1791
+ name: "Masai (Tanzania) (mas-TZ)"
1792
+ },
1793
+ {
1794
+ code: "mer",
1795
+ name: "Meru (mer)"
1796
+ },
1797
+ {
1798
+ code: "mer-KE",
1799
+ name: "Meru (Kenya) (mer-KE)"
1800
+ },
1801
+ {
1802
+ code: "mn",
1803
+ name: "Mongolian (mn)"
1804
+ },
1805
+ {
1806
+ code: "mfe",
1807
+ name: "Morisyen (mfe)"
1808
+ },
1809
+ {
1810
+ code: "mfe-MU",
1811
+ name: "Morisyen (Mauritius) (mfe-MU)"
1812
+ },
1813
+ {
1814
+ code: "mua",
1815
+ name: "Mundang (mua)"
1816
+ },
1817
+ {
1818
+ code: "mua-CM",
1819
+ name: "Mundang (Cameroon) (mua-CM)"
1820
+ },
1821
+ {
1822
+ code: "naq",
1823
+ name: "Nama (naq)"
1824
+ },
1825
+ {
1826
+ code: "naq-NA",
1827
+ name: "Nama (Namibia) (naq-NA)"
1828
+ },
1829
+ {
1830
+ code: "ne",
1831
+ name: "Nepali (ne)"
1832
+ },
1833
+ {
1834
+ code: "ne-IN",
1835
+ name: "Nepali (India) (ne-IN)"
1836
+ },
1837
+ {
1838
+ code: "ne-NP",
1839
+ name: "Nepali (Nepal) (ne-NP)"
1840
+ },
1841
+ {
1842
+ code: "se",
1843
+ name: "Northern Sami"
1844
+ },
1845
+ {
1846
+ code: "se-FI",
1847
+ name: "Northern Sami (Finland)"
1848
+ },
1849
+ {
1850
+ code: "se-NO",
1851
+ name: "Northern Sami (Norway)"
1852
+ },
1853
+ {
1854
+ code: "se-SE",
1855
+ name: "Northern Sami (Sweden)"
1856
+ },
1857
+ {
1858
+ code: "nd",
1859
+ name: "North Ndebele (nd)"
1860
+ },
1861
+ {
1862
+ code: "nd-ZW",
1863
+ name: "North Ndebele (Zimbabwe) (nd-ZW)"
1864
+ },
1865
+ {
1866
+ code: "nb",
1867
+ name: "Norwegian Bokmål (nb)"
1868
+ },
1869
+ {
1870
+ code: "nb-NO",
1871
+ name: "Norwegian Bokmål (Norway) (nb-NO)"
1872
+ },
1873
+ {
1874
+ code: "nn",
1875
+ name: "Norwegian Nynorsk (nn)"
1876
+ },
1877
+ {
1878
+ code: "nn-NO",
1879
+ name: "Norwegian Nynorsk (Norway) (nn-NO)"
1880
+ },
1881
+ {
1882
+ code: "nus",
1883
+ name: "Nuer (nus)"
1884
+ },
1885
+ {
1886
+ code: "nus-SD",
1887
+ name: "Nuer (Sudan) (nus-SD)"
1888
+ },
1889
+ {
1890
+ code: "nyn",
1891
+ name: "Nyankole (nyn)"
1892
+ },
1893
+ {
1894
+ code: "nyn-UG",
1895
+ name: "Nyankole (Uganda) (nyn-UG)"
1896
+ },
1897
+ {
1898
+ code: "or",
1899
+ name: "Oriya (or)"
1900
+ },
1901
+ {
1902
+ code: "or-IN",
1903
+ name: "Oriya (India) (or-IN)"
1904
+ },
1905
+ {
1906
+ code: "om",
1907
+ name: "Oromo (om)"
1908
+ },
1909
+ {
1910
+ code: "om-ET",
1911
+ name: "Oromo (Ethiopia) (om-ET)"
1912
+ },
1913
+ {
1914
+ code: "om-KE",
1915
+ name: "Oromo (Kenya) (om-KE)"
1916
+ },
1917
+ {
1918
+ code: "ps",
1919
+ name: "Pashto (ps)"
1920
+ },
1921
+ {
1922
+ code: "ps-AF",
1923
+ name: "Pashto (Afghanistan) (ps-AF)"
1924
+ },
1925
+ {
1926
+ code: "fa",
1927
+ name: "Persian (fa)"
1928
+ },
1929
+ {
1930
+ code: "fa-AF",
1931
+ name: "Persian (Afghanistan) (fa-AF)"
1932
+ },
1933
+ {
1934
+ code: "fa-IR",
1935
+ name: "Persian (Iran) (fa-IR)"
1936
+ },
1937
+ {
1938
+ code: "pl",
1939
+ name: "Polish (pl)"
1940
+ },
1941
+ {
1942
+ code: "pl-PL",
1943
+ name: "Polish (Poland) (pl-PL)"
1944
+ },
1945
+ {
1946
+ code: "pt",
1947
+ name: "Portuguese (pt)"
1948
+ },
1949
+ {
1950
+ code: "pt-AO",
1951
+ name: "Portuguese (Angola) (pt-AO)"
1952
+ },
1953
+ {
1954
+ code: "pt-BR",
1955
+ name: "Portuguese (Brazil) (pt-BR)"
1956
+ },
1957
+ {
1958
+ code: "pt-GW",
1959
+ name: "Portuguese (Guinea-Bissau) (pt-GW)"
1960
+ },
1961
+ {
1962
+ code: "pt-MZ",
1963
+ name: "Portuguese (Mozambique) (pt-MZ)"
1964
+ },
1965
+ {
1966
+ code: "pt-PT",
1967
+ name: "Portuguese (Portugal) (pt-PT)"
1968
+ },
1969
+ {
1970
+ code: "pt-ST",
1971
+ name: "Portuguese (São Tomé and Príncipe) (pt-ST)"
1972
+ },
1973
+ {
1974
+ code: "pa",
1975
+ name: "Punjabi (pa)"
1976
+ },
1977
+ {
1978
+ code: "pa-Arab",
1979
+ name: "Punjabi (Arabic) (pa-Arab)"
1980
+ },
1981
+ {
1982
+ code: "pa-Arab-PK",
1983
+ name: "Punjabi (Arabic, Pakistan) (pa-Arab-PK)"
1984
+ },
1985
+ {
1986
+ code: "pa-Guru",
1987
+ name: "Punjabi (Gurmukhi) (pa-Guru)"
1988
+ },
1989
+ {
1990
+ code: "pa-Guru-IN",
1991
+ name: "Punjabi (Gurmukhi, India) (pa-Guru-IN)"
1992
+ },
1993
+ {
1994
+ code: "ro",
1995
+ name: "Romanian (ro)"
1996
+ },
1997
+ {
1998
+ code: "ro-MD",
1999
+ name: "Romanian (Moldova) (ro-MD)"
2000
+ },
2001
+ {
2002
+ code: "ro-RO",
2003
+ name: "Romanian (Romania) (ro-RO)"
2004
+ },
2005
+ {
2006
+ code: "rm",
2007
+ name: "Romansh (rm)"
2008
+ },
2009
+ {
2010
+ code: "rm-CH",
2011
+ name: "Romansh (Switzerland) (rm-CH)"
2012
+ },
2013
+ {
2014
+ code: "rof",
2015
+ name: "Rombo (rof)"
2016
+ },
2017
+ {
2018
+ code: "rof-TZ",
2019
+ name: "Rombo (Tanzania) (rof-TZ)"
2020
+ },
2021
+ {
2022
+ code: "rn",
2023
+ name: "Rundi (rn)"
2024
+ },
2025
+ {
2026
+ code: "rn-BI",
2027
+ name: "Rundi (Burundi) (rn-BI)"
2028
+ },
2029
+ {
2030
+ code: "ru",
2031
+ name: "Russian (ru)"
2032
+ },
2033
+ {
2034
+ code: "ru-MD",
2035
+ name: "Russian (Moldova) (ru-MD)"
2036
+ },
2037
+ {
2038
+ code: "ru-RU",
2039
+ name: "Russian (Russia) (ru-RU)"
2040
+ },
2041
+ {
2042
+ code: "ru-UA",
2043
+ name: "Russian (Ukraine) (ru-UA)"
2044
+ },
2045
+ {
2046
+ code: "rwk",
2047
+ name: "Rwa (rwk)"
2048
+ },
2049
+ {
2050
+ code: "rwk-TZ",
2051
+ name: "Rwa (Tanzania) (rwk-TZ)"
2052
+ },
2053
+ {
2054
+ code: "saq",
2055
+ name: "Samburu (saq)"
2056
+ },
2057
+ {
2058
+ code: "saq-KE",
2059
+ name: "Samburu (Kenya) (saq-KE)"
2060
+ },
2061
+ {
2062
+ code: "sg",
2063
+ name: "Sango (sg)"
2064
+ },
2065
+ {
2066
+ code: "sg-CF",
2067
+ name: "Sango (Central African Republic) (sg-CF)"
2068
+ },
2069
+ {
2070
+ code: "sbp",
2071
+ name: "Sangu (sbp)"
2072
+ },
2073
+ {
2074
+ code: "sbp-TZ",
2075
+ name: "Sangu (Tanzania) (sbp-TZ)"
2076
+ },
2077
+ {
2078
+ code: "sa",
2079
+ name: "Sanskrit (sa)"
2080
+ },
2081
+ {
2082
+ code: "gd",
2083
+ name: "Scottish Gaelic (gd)"
2084
+ },
2085
+ {
2086
+ code: "gd-GB",
2087
+ name: "Scottish Gaelic (United Kingdom)"
2088
+ },
2089
+ {
2090
+ code: "seh",
2091
+ name: "Sena (seh)"
2092
+ },
2093
+ {
2094
+ code: "seh-MZ",
2095
+ name: "Sena (Mozambique) (seh-MZ)"
2096
+ },
2097
+ {
2098
+ code: "sr",
2099
+ name: "Serbian (sr)"
2100
+ },
2101
+ {
2102
+ code: "sr-Cyrl",
2103
+ name: "Serbian (Cyrillic) (sr-Cyrl)"
2104
+ },
2105
+ {
2106
+ code: "sr-Cyrl-BA",
2107
+ name: "Serbian (Cyrillic, Bosnia and Herzegovina)(sr-Cyrl-BA) "
2108
+ },
2109
+ {
2110
+ code: "sr-Cyrl-ME",
2111
+ name: "Serbian (Cyrillic, Montenegro) (sr-Cyrl-ME)"
2112
+ },
2113
+ {
2114
+ code: "sr-Cyrl-RS",
2115
+ name: "Serbian (Cyrillic, Serbia) (sr-Cyrl-RS)"
2116
+ },
2117
+ {
2118
+ code: "sr-Latn",
2119
+ name: "Serbian (Latin) (sr-Latn)"
2120
+ },
2121
+ {
2122
+ code: "sr-Latn-BA",
2123
+ name: "Serbian (Latin, Bosnia and Herzegovina) (sr-Latn-BA) "
2124
+ },
2125
+ {
2126
+ code: "sr-Latn-ME",
2127
+ name: "Serbian (Latin, Montenegro) (sr-Latn-ME)"
2128
+ },
2129
+ {
2130
+ code: "sr-Latn-RS",
2131
+ name: "Serbian (Latin, Serbia) (sr-Latn-RS)"
2132
+ },
2133
+ {
2134
+ code: "ksb",
2135
+ name: "Shambala (ksb)"
2136
+ },
2137
+ {
2138
+ code: "ksb-TZ",
2139
+ name: "Shambala (Tanzania) (ksb-TZ)"
2140
+ },
2141
+ {
2142
+ code: "sn",
2143
+ name: "Shona (sn)"
2144
+ },
2145
+ {
2146
+ code: "sn-ZW",
2147
+ name: "Shona (Zimbabwe) (sn-ZW)"
2148
+ },
2149
+ {
2150
+ code: "ii",
2151
+ name: "Sichuan Yi (ii)"
2152
+ },
2153
+ {
2154
+ code: "ii-CN",
2155
+ name: "Sichuan Yi (China) (ii-CN)"
2156
+ },
2157
+ {
2158
+ code: "si",
2159
+ name: "Sinhala (si)"
2160
+ },
2161
+ {
2162
+ code: "si-LK",
2163
+ name: "Sinhala (Sri Lanka) (si-LK)"
2164
+ },
2165
+ {
2166
+ code: "sk",
2167
+ name: "Slovak (sk)"
2168
+ },
2169
+ {
2170
+ code: "sk-SK",
2171
+ name: "Slovak (Slovakia) (sk-SK)"
2172
+ },
2173
+ {
2174
+ code: "sl",
2175
+ name: "Slovenian (sl)"
2176
+ },
2177
+ {
2178
+ code: "sl-SI",
2179
+ name: "Slovenian (Slovenia) (sl-SI)"
2180
+ },
2181
+ {
2182
+ code: "xog",
2183
+ name: "Soga (xog)"
2184
+ },
2185
+ {
2186
+ code: "xog-UG",
2187
+ name: "Soga (Uganda) (xog-UG)"
2188
+ },
2189
+ {
2190
+ code: "so",
2191
+ name: "Somali (so)"
2192
+ },
2193
+ {
2194
+ code: "so-DJ",
2195
+ name: "Somali (Djibouti) (so-DJ)"
2196
+ },
2197
+ {
2198
+ code: "so-ET",
2199
+ name: "Somali (Ethiopia) (so-ET)"
2200
+ },
2201
+ {
2202
+ code: "so-KE",
2203
+ name: "Somali (Kenya) (so-KE)"
2204
+ },
2205
+ {
2206
+ code: "so-SO",
2207
+ name: "Somali (Somalia) (so-SO)"
2208
+ },
2209
+ {
2210
+ code: "es",
2211
+ name: "Spanish (es)"
2212
+ },
2213
+ {
2214
+ code: "es-AR",
2215
+ name: "Spanish (Argentina) (es-AR)"
2216
+ },
2217
+ {
2218
+ code: "es-BO",
2219
+ name: "Spanish (Bolivia) (es-BO)"
2220
+ },
2221
+ {
2222
+ code: "es-CL",
2223
+ name: "Spanish (Chile) (es-CL)"
2224
+ },
2225
+ {
2226
+ code: "es-CO",
2227
+ name: "Spanish (Colombia) (es-CO)"
2228
+ },
2229
+ {
2230
+ code: "es-CR",
2231
+ name: "Spanish (Costa Rica) (es-CR)"
2232
+ },
2233
+ {
2234
+ code: "es-DO",
2235
+ name: "Spanish (Dominican Republic) (es-DO)"
2236
+ },
2237
+ {
2238
+ code: "es-EC",
2239
+ name: "Spanish (Ecuador) (es-EC)"
2240
+ },
2241
+ {
2242
+ code: "es-SV",
2243
+ name: "Spanish (El Salvador) (es-SV)"
2244
+ },
2245
+ {
2246
+ code: "es-GQ",
2247
+ name: "Spanish (Equatorial Guinea) (es-GQ)"
2248
+ },
2249
+ {
2250
+ code: "es-GT",
2251
+ name: "Spanish (Guatemala) (es-GT)"
2252
+ },
2253
+ {
2254
+ code: "es-HN",
2255
+ name: "Spanish (Honduras) (es-HN)"
2256
+ },
2257
+ {
2258
+ code: "es-419",
2259
+ name: "Spanish (Latin America) (es-419)"
2260
+ },
2261
+ {
2262
+ code: "es-MX",
2263
+ name: "Spanish (Mexico) (es-MX)"
2264
+ },
2265
+ {
2266
+ code: "es-NI",
2267
+ name: "Spanish (Nicaragua) (es-NI)"
2268
+ },
2269
+ {
2270
+ code: "es-PA",
2271
+ name: "Spanish (Panama) (es-PA)"
2272
+ },
2273
+ {
2274
+ code: "es-PY",
2275
+ name: "Spanish (Paraguay) (es-PY)"
2276
+ },
2277
+ {
2278
+ code: "es-PE",
2279
+ name: "Spanish (Peru) (es-PE)"
2280
+ },
2281
+ {
2282
+ code: "es-PR",
2283
+ name: "Spanish (Puerto Rico) (es-PR)"
2284
+ },
2285
+ {
2286
+ code: "es-ES",
2287
+ name: "Spanish (Spain) (es-ES)"
2288
+ },
2289
+ {
2290
+ code: "es-US",
2291
+ name: "Spanish (United States) (es-US)"
2292
+ },
2293
+ {
2294
+ code: "es-UY",
2295
+ name: "Spanish (Uruguay) (es-UY)"
2296
+ },
2297
+ {
2298
+ code: "es-VE",
2299
+ name: "Spanish (Venezuela) (es-VE)"
2300
+ },
2301
+ {
2302
+ code: "sw",
2303
+ name: "Swahili (sw)"
2304
+ },
2305
+ {
2306
+ code: "sw-KE",
2307
+ name: "Swahili (Kenya) (sw-KE)"
2308
+ },
2309
+ {
2310
+ code: "sw-TZ",
2311
+ name: "Swahili (Tanzania) (sw-TZ)"
2312
+ },
2313
+ {
2314
+ code: "sv",
2315
+ name: "Swedish (sv)"
2316
+ },
2317
+ {
2318
+ code: "sv-FI",
2319
+ name: "Swedish (Finland) (sv-FI)"
2320
+ },
2321
+ {
2322
+ code: "sv-SE",
2323
+ name: "Swedish (Sweden) (sv-SE)"
2324
+ },
2325
+ {
2326
+ code: "gsw",
2327
+ name: "Swiss German (gsw)"
2328
+ },
2329
+ {
2330
+ code: "gsw-CH",
2331
+ name: "Swiss German (Switzerland) (gsw-CH)"
2332
+ },
2333
+ {
2334
+ code: "shi",
2335
+ name: "Tachelhit (shi)"
2336
+ },
2337
+ {
2338
+ code: "shi-Latn",
2339
+ name: "Tachelhit (Latin) (shi-Latn)"
2340
+ },
2341
+ {
2342
+ code: "shi-Latn-MA",
2343
+ name: "Tachelhit (Latin, Morocco) (shi-Latn-MA)"
2344
+ },
2345
+ {
2346
+ code: "shi-Tfng",
2347
+ name: "Tachelhit (Tifinagh) (shi-Tfng)"
2348
+ },
2349
+ {
2350
+ code: "shi-Tfng-MA",
2351
+ name: "Tachelhit (Tifinagh, Morocco) (shi-Tfng-MA)"
2352
+ },
2353
+ {
2354
+ code: "dav",
2355
+ name: "Taita (dav)"
2356
+ },
2357
+ {
2358
+ code: "dav-KE",
2359
+ name: "Taita (Kenya) (dav-KE)"
2360
+ },
2361
+ {
2362
+ code: "tg",
2363
+ name: "Tajik (tg)"
2364
+ },
2365
+ {
2366
+ code: "ta",
2367
+ name: "Tamil (ta)"
2368
+ },
2369
+ {
2370
+ code: "ta-IN",
2371
+ name: "Tamil (India) (ta-IN)"
2372
+ },
2373
+ {
2374
+ code: "ta-LK",
2375
+ name: "Tamil (Sri Lanka) (ta-LK)"
2376
+ },
2377
+ {
2378
+ code: "twq",
2379
+ name: "Tasawaq (twq)"
2380
+ },
2381
+ {
2382
+ code: "twq-NE",
2383
+ name: "Tasawaq (Niger) (twq-NE)"
2384
+ },
2385
+ {
2386
+ code: "mi",
2387
+ name: "Te Reo Māori (mi)"
2388
+ },
2389
+ {
2390
+ code: "te",
2391
+ name: "Telugu (te)"
2392
+ },
2393
+ {
2394
+ code: "te-IN",
2395
+ name: "Telugu (India) (te-IN)"
2396
+ },
2397
+ {
2398
+ code: "teo",
2399
+ name: "Teso (teo)"
2400
+ },
2401
+ {
2402
+ code: "teo-KE",
2403
+ name: "Teso (Kenya) (teo-KE)"
2404
+ },
2405
+ {
2406
+ code: "teo-UG",
2407
+ name: "Teso (Uganda) (teo-UG)"
2408
+ },
2409
+ {
2410
+ code: "th",
2411
+ name: "Thai (th)"
2412
+ },
2413
+ {
2414
+ code: "th-TH",
2415
+ name: "Thai (Thailand) (th-TH)"
2416
+ },
2417
+ {
2418
+ code: "bo",
2419
+ name: "Tibetan (bo)"
2420
+ },
2421
+ {
2422
+ code: "bo-CN",
2423
+ name: "Tibetan (China) (bo-CN)"
2424
+ },
2425
+ {
2426
+ code: "bo-IN",
2427
+ name: "Tibetan (India) (bo-IN)"
2428
+ },
2429
+ {
2430
+ code: "ti",
2431
+ name: "Tigrinya (ti)"
2432
+ },
2433
+ {
2434
+ code: "ti-ER",
2435
+ name: "Tigrinya (Eritrea) (ti-ER)"
2436
+ },
2437
+ {
2438
+ code: "ti-ET",
2439
+ name: "Tigrinya (Ethiopia) (ti-ET)"
2440
+ },
2441
+ {
2442
+ code: "to",
2443
+ name: "Tongan (to)"
2444
+ },
2445
+ {
2446
+ code: "to-TO",
2447
+ name: "Tongan (Tonga) (to-TO)"
2448
+ },
2449
+ {
2450
+ code: "tr",
2451
+ name: "Turkish (tr)"
2452
+ },
2453
+ {
2454
+ code: "tk",
2455
+ name: "Turkmen (tk)"
2456
+ },
2457
+ {
2458
+ code: "tr-TR",
2459
+ name: "Turkish (Turkey) (tr-TR)"
2460
+ },
2461
+ {
2462
+ code: "tch",
2463
+ name: "Turks And Caicos Creole English"
2464
+ },
2465
+ {
2466
+ code: "uk",
2467
+ name: "Ukrainian (uk)"
2468
+ },
2469
+ {
2470
+ code: "uk-UA",
2471
+ name: "Ukrainian (Ukraine) (uk-UA)"
2472
+ },
2473
+ {
2474
+ code: "ur",
2475
+ name: "Urdu (ur)"
2476
+ },
2477
+ {
2478
+ code: "ur-IN",
2479
+ name: "Urdu (India) (ur-IN)"
2480
+ },
2481
+ {
2482
+ code: "ur-PK",
2483
+ name: "Urdu (Pakistan) (ur-PK)"
2484
+ },
2485
+ {
2486
+ code: "ug",
2487
+ name: "Uyghur"
2488
+ },
2489
+ {
2490
+ code: "ug-CN",
2491
+ name: "Uyghur (China)"
2492
+ },
2493
+ {
2494
+ code: "uz",
2495
+ name: "Uzbek (uz)"
2496
+ },
2497
+ {
2498
+ code: "uz-Arab",
2499
+ name: "Uzbek (Arabic) (uz-Arab)"
2500
+ },
2501
+ {
2502
+ code: "uz-Arab-AF",
2503
+ name: "Uzbek (Arabic, Afghanistan) (uz-Arab-AF)"
2504
+ },
2505
+ {
2506
+ code: "uz-Cyrl",
2507
+ name: "Uzbek (Cyrillic) (uz-Cyrl)"
2508
+ },
2509
+ {
2510
+ code: "uz-Cyrl-UZ",
2511
+ name: "Uzbek (Cyrillic, Uzbekistan) (uz-Cyrl-UZ)"
2512
+ },
2513
+ {
2514
+ code: "uz-Latn",
2515
+ name: "Uzbek (Latin) (uz-Latn)"
2516
+ },
2517
+ {
2518
+ code: "uz-Latn-UZ",
2519
+ name: "Uzbek (Latin, Uzbekistan) (uz-Latn-UZ)"
2520
+ },
2521
+ {
2522
+ code: "vai",
2523
+ name: "Vai (vai)"
2524
+ },
2525
+ {
2526
+ code: "vai-Latn",
2527
+ name: "Vai (Latin) (vai-Latn)"
2528
+ },
2529
+ {
2530
+ code: "vai-Latn-LR",
2531
+ name: "Vai (Latin, Liberia) (vai-Latn-LR)"
2532
+ },
2533
+ {
2534
+ code: "vai-Vaii",
2535
+ name: "Vai (Vai) (vai-Vaii)"
2536
+ },
2537
+ {
2538
+ code: "vai-Vaii-LR",
2539
+ name: "Vai (Vai, Liberia) (vai-Vaii-LR)"
2540
+ },
2541
+ {
2542
+ code: "val",
2543
+ name: "Valencian (val)"
2544
+ },
2545
+ {
2546
+ code: "val-ES",
2547
+ name: "Valencian (Spain) (val-ES)"
2548
+ },
2549
+ {
2550
+ code: "ca-ES-valencia",
2551
+ name: "Valencian (Spain Catalan) (ca-ES-valencia)"
2552
+ },
2553
+ {
2554
+ code: "vi",
2555
+ name: "Vietnamese (vi)"
2556
+ },
2557
+ {
2558
+ code: "vi-VN",
2559
+ name: "Vietnamese (Vietnam) (vi-VN)"
2560
+ },
2561
+ {
2562
+ code: "vun",
2563
+ name: "Vunjo (vun)"
2564
+ },
2565
+ {
2566
+ code: "vun-TZ",
2567
+ name: "Vunjo (Tanzania) (vun-TZ)"
2568
+ },
2569
+ {
2570
+ code: "cy",
2571
+ name: "Welsh (cy)"
2572
+ },
2573
+ {
2574
+ code: "cy-GB",
2575
+ name: "Welsh (United Kingdom) (cy-GB)"
2576
+ },
2577
+ {
2578
+ code: "yav",
2579
+ name: "Yangben (yav)"
2580
+ },
2581
+ {
2582
+ code: "yav-CM",
2583
+ name: "Yangben (Cameroon) (yav-CM)"
2584
+ },
2585
+ {
2586
+ code: "yo",
2587
+ name: "Yoruba (yo)"
2588
+ },
2589
+ {
2590
+ code: "yo-NG",
2591
+ name: "Yoruba (Nigeria) (yo-NG)"
2592
+ },
2593
+ {
2594
+ code: "dje",
2595
+ name: "Zarma (dje)"
2596
+ },
2597
+ {
2598
+ code: "dje-NE",
2599
+ name: "Zarma (Niger) (dje-NE)"
2600
+ },
2601
+ {
2602
+ code: "zu",
2603
+ name: "Zulu (zu)"
2604
+ },
2605
+ {
2606
+ code: "zu-ZA",
2607
+ name: "Zulu (South Africa) (zu-ZA)"
2608
+ }
2609
+ ];
2610
+ const getInitLocale = () => {
2611
+ const envLocaleCode = process.env.STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE;
2612
+ if (envLocaleCode) {
2613
+ const matchingLocale = isoLocales.find(({ code }) => code === envLocaleCode);
2614
+ if (!matchingLocale) {
2615
+ throw new Error(
2616
+ "Unknown locale code provided in the environment variable STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE"
2617
+ );
2618
+ }
2619
+ return { ...matchingLocale };
2620
+ }
2621
+ return {
2622
+ code: "en",
2623
+ name: "English (en)"
2624
+ };
2625
+ };
2626
+ const DEFAULT_LOCALE = getInitLocale();
2627
+ const enableContentType = async ({ oldContentTypes, contentTypes: contentTypes2 }) => {
2628
+ const { isLocalizedContentType: isLocalizedContentType2 } = getService("content-types");
2629
+ const { getDefaultLocale: getDefaultLocale2 } = getService("locales");
2630
+ if (!oldContentTypes) {
2631
+ return;
2632
+ }
2633
+ for (const uid in contentTypes2) {
2634
+ if (!oldContentTypes[uid]) {
2635
+ continue;
2636
+ }
2637
+ const oldContentType = oldContentTypes[uid];
2638
+ const contentType = contentTypes2[uid];
2639
+ if (!isLocalizedContentType2(oldContentType) && isLocalizedContentType2(contentType)) {
2640
+ const defaultLocale = await getDefaultLocale2() || DEFAULT_LOCALE.code;
2641
+ await strapi.db.query(uid).updateMany({
2642
+ where: { locale: null },
2643
+ data: { locale: defaultLocale }
2644
+ });
2645
+ }
2646
+ }
2647
+ };
2648
+ const disableContentType = async ({ oldContentTypes, contentTypes: contentTypes2 }) => {
2649
+ const { isLocalizedContentType: isLocalizedContentType2 } = getService("content-types");
2650
+ const { getDefaultLocale: getDefaultLocale2 } = getService("locales");
2651
+ if (!oldContentTypes) {
2652
+ return;
2653
+ }
2654
+ for (const uid in contentTypes2) {
2655
+ if (!oldContentTypes[uid]) {
2656
+ continue;
2657
+ }
2658
+ const oldContentType = oldContentTypes[uid];
2659
+ const contentType = contentTypes2[uid];
2660
+ if (isLocalizedContentType2(oldContentType) && !isLocalizedContentType2(contentType)) {
2661
+ const defaultLocale = await getDefaultLocale2() || DEFAULT_LOCALE.code;
2662
+ await Promise.all([
2663
+ // Delete all entities that are not in the default locale
2664
+ strapi.db.query(uid).deleteMany({
2665
+ where: { locale: { $ne: defaultLocale } }
2666
+ }),
2667
+ // Set locale to null for the rest
2668
+ strapi.db.query(uid).updateMany({
2669
+ where: { locale: { $eq: defaultLocale } },
2670
+ data: { locale: null }
2671
+ })
2672
+ ]);
2673
+ }
2674
+ }
2675
+ };
2676
+ const register = ({ strapi: strapi2 }) => {
2677
+ extendContentTypes(strapi2);
2678
+ addContentManagerLocaleMiddleware(strapi2);
2679
+ addContentTypeSyncHooks(strapi2);
2680
+ };
2681
+ const addContentManagerLocaleMiddleware = (strapi2) => {
2682
+ strapi2.server.router.use("/content-manager/collection-types/:model", (ctx, next) => {
2683
+ if (ctx.method === "POST" || ctx.method === "PUT") {
2684
+ return validateLocaleCreation(ctx, next);
2685
+ }
2686
+ return next();
2687
+ });
2688
+ strapi2.server.router.use("/content-manager/single-types/:model", (ctx, next) => {
2689
+ if (ctx.method === "POST" || ctx.method === "PUT") {
2690
+ return validateLocaleCreation(ctx, next);
2691
+ }
2692
+ return next();
2693
+ });
2694
+ };
2695
+ const addContentTypeSyncHooks = (strapi2) => {
2696
+ strapi2.hook("strapi::content-types.beforeSync").register(disableContentType);
2697
+ strapi2.hook("strapi::content-types.afterSync").register(enableContentType);
2698
+ };
2699
+ const extendContentTypes = (strapi2) => {
2700
+ Object.values(strapi2.contentTypes).forEach((contentType) => {
2701
+ const { attributes: attributes2 } = contentType;
2702
+ ___default.default.set(attributes2, "locale", {
2703
+ writable: true,
2704
+ private: false,
2705
+ configurable: false,
2706
+ visible: false,
2707
+ type: "string"
2708
+ });
2709
+ });
2710
+ if (strapi2.plugin("graphql")) {
2711
+ graphqlProvider({ strapi: strapi2 }).register();
2712
+ }
2713
+ };
2714
+ const info = {
2715
+ singularName: "locale",
2716
+ pluralName: "locales",
2717
+ collectionName: "locales",
2718
+ displayName: "Locale",
2719
+ description: ""
2720
+ };
2721
+ const options = {};
2722
+ const pluginOptions = {
2723
+ "content-manager": {
2724
+ visible: false
2725
+ },
2726
+ "content-type-builder": {
2727
+ visible: false
2728
+ }
2729
+ };
2730
+ const attributes = {
2731
+ name: {
2732
+ type: "string",
2733
+ min: 1,
2734
+ max: 50,
2735
+ configurable: false
2736
+ },
2737
+ code: {
2738
+ type: "string",
2739
+ unique: true,
2740
+ configurable: false
2741
+ }
2742
+ };
2743
+ const schema = {
2744
+ info,
2745
+ options,
2746
+ pluginOptions,
2747
+ attributes
2748
+ };
2749
+ const locale = {
2750
+ schema
2751
+ };
2752
+ const contentTypes$1 = {
2753
+ locale
2754
+ };
2755
+ const actions = ["create", "read", "update", "delete"].map((uid) => ({
2756
+ section: "settings",
2757
+ category: "Internationalization",
2758
+ subCategory: "Locales",
2759
+ pluginName: "i18n",
2760
+ displayName: fp.capitalize(uid),
2761
+ uid: `locale.${uid}`
2762
+ }));
2763
+ const addLocalesPropertyIfNeeded = ({ value: action }) => {
2764
+ const {
2765
+ section,
2766
+ options: { applyToProperties }
2767
+ } = action;
2768
+ if (section !== "contentTypes") {
2769
+ return;
2770
+ }
2771
+ if (fp.isArray(applyToProperties) && applyToProperties.includes("locales")) {
2772
+ return;
2773
+ }
2774
+ action.options.applyToProperties = fp.isArray(applyToProperties) ? applyToProperties.concat("locales") : ["locales"];
2775
+ };
2776
+ const shouldApplyLocalesPropertyToSubject = ({ property, subject }) => {
2777
+ if (property === "locales") {
2778
+ const model = strapi.getModel(subject);
2779
+ return getService("content-types").isLocalizedContentType(model);
2780
+ }
2781
+ return true;
2782
+ };
2783
+ const addAllLocalesToPermissions = async (permissions2) => {
2784
+ const { actionProvider } = strapi.service("admin::permission");
2785
+ const { find: findAllLocales } = getService("locales");
2786
+ const allLocales = await findAllLocales();
2787
+ const allLocalesCode = allLocales.map(fp.prop("code"));
2788
+ return Promise.all(
2789
+ permissions2.map(async (permission) => {
2790
+ const { action, subject } = permission;
2791
+ const appliesToLocalesProperty = await actionProvider.appliesToProperty(
2792
+ "locales",
2793
+ action,
2794
+ subject
2795
+ );
2796
+ if (!appliesToLocalesProperty) {
2797
+ return permission;
2798
+ }
2799
+ const oldPermissionProperties = fp.getOr({}, "properties", permission);
2800
+ return { ...permission, properties: { ...oldPermissionProperties, locales: allLocalesCode } };
2801
+ })
2802
+ );
2803
+ };
2804
+ const syncSuperAdminPermissionsWithLocales = async () => {
2805
+ const roleService = strapi.service("admin::role");
2806
+ const permissionService = strapi.service("admin::permission");
2807
+ const superAdminRole = await roleService.getSuperAdmin();
2808
+ if (!superAdminRole) {
2809
+ return;
2810
+ }
2811
+ const superAdminPermissions = await permissionService.findMany({
2812
+ where: {
2813
+ role: {
2814
+ id: superAdminRole.id
2815
+ }
2816
+ }
2817
+ });
2818
+ const newSuperAdminPermissions = await addAllLocalesToPermissions(superAdminPermissions);
2819
+ await roleService.assignPermissions(superAdminRole.id, newSuperAdminPermissions);
2820
+ };
2821
+ const registerI18nActions = async () => {
2822
+ const { actionProvider } = strapi.service("admin::permission");
2823
+ await actionProvider.registerMany(actions);
2824
+ };
2825
+ const registerI18nActionsHooks = () => {
2826
+ const { actionProvider } = strapi.service("admin::permission");
2827
+ const { hooks } = strapi.service("admin::role");
2828
+ actionProvider.hooks.appliesPropertyToSubject.register(shouldApplyLocalesPropertyToSubject);
2829
+ hooks.willResetSuperAdminPermissions.register(addAllLocalesToPermissions);
2830
+ };
2831
+ const updateActionsProperties = () => {
2832
+ const { actionProvider } = strapi.service("admin::permission");
2833
+ actionProvider.hooks.willRegister.register(addLocalesPropertyIfNeeded);
2834
+ actionProvider.values().forEach((action) => addLocalesPropertyIfNeeded({ value: action }));
2835
+ };
2836
+ const i18nActionsService = {
2837
+ actions,
2838
+ registerI18nActions,
2839
+ registerI18nActionsHooks,
2840
+ updateActionsProperties,
2841
+ syncSuperAdminPermissionsWithLocales
2842
+ };
2843
+ const localesPropertyHandler = async ({ action, section }) => {
2844
+ const { actionProvider } = strapi.service("admin::permission");
2845
+ const locales2 = await getService("locales").find();
2846
+ if (fp.isEmpty(locales2)) {
2847
+ return;
2848
+ }
2849
+ for (const subject of section.subjects) {
2850
+ const applies = await actionProvider.appliesToProperty("locales", action.actionId, subject.uid);
2851
+ const hasLocalesProperty = subject.properties.find(
2852
+ (property) => property.value === "locales"
2853
+ );
2854
+ if (applies && !hasLocalesProperty) {
2855
+ subject.properties.push({
2856
+ label: "Locales",
2857
+ value: "locales",
2858
+ children: locales2.map(({ name, code }) => ({ label: name || code, value: code }))
2859
+ });
2860
+ }
2861
+ }
2862
+ };
2863
+ const registerLocalesPropertyHandler = () => {
2864
+ const { sectionsBuilder } = strapi.service("admin::permission");
2865
+ sectionsBuilder.addHandler("singleTypes", localesPropertyHandler);
2866
+ sectionsBuilder.addHandler("collectionTypes", localesPropertyHandler);
2867
+ };
2868
+ const sectionsBuilderService = {
2869
+ localesPropertyHandler,
2870
+ registerLocalesPropertyHandler
2871
+ };
2872
+ const willRegisterPermission = (context) => {
2873
+ const { permission, condition, user } = context;
2874
+ const { subject, properties } = permission;
2875
+ const isSuperAdmin = strapi.service("admin::role").hasSuperAdminRole(user);
2876
+ if (isSuperAdmin) {
2877
+ return;
2878
+ }
2879
+ const { locales: locales2 } = properties || {};
2880
+ const { isLocalizedContentType: isLocalizedContentType2 } = getService("content-types");
2881
+ if (!subject) {
2882
+ return;
2883
+ }
2884
+ const ct = strapi.contentTypes[subject];
2885
+ if (!isLocalizedContentType2(ct)) {
2886
+ return;
2887
+ }
2888
+ if (locales2 === null) {
2889
+ return;
2890
+ }
2891
+ condition.and({
2892
+ locale: {
2893
+ $in: locales2 || []
2894
+ }
2895
+ });
2896
+ };
2897
+ const registerI18nPermissionsHandlers = () => {
2898
+ const { engine } = strapi.service("admin::permission");
2899
+ engine.hooks["before-register.permission"].register(willRegisterPermission);
2900
+ };
2901
+ const engineService = {
2902
+ willRegisterPermission,
2903
+ registerI18nPermissionsHandlers
2904
+ };
2905
+ const permissions = () => ({
2906
+ actions: i18nActionsService,
2907
+ sectionsBuilder: sectionsBuilderService,
2908
+ engine: engineService
2909
+ });
2910
+ const sendDidInitializeEvent = async () => {
2911
+ const { isLocalizedContentType: isLocalizedContentType2 } = getService("content-types");
2912
+ const numberOfContentTypes = fp.reduce(
2913
+ (sum, contentType) => isLocalizedContentType2(contentType) ? sum + 1 : sum,
2914
+ 0
2915
+ )(strapi.contentTypes);
2916
+ await strapi.telemetry.send("didInitializeI18n", { groupProperties: { numberOfContentTypes } });
2917
+ };
2918
+ const sendDidUpdateI18nLocalesEvent = async () => {
2919
+ const numberOfLocales = await getService("locales").count();
2920
+ await strapi.telemetry.send("didUpdateI18nLocales", {
2921
+ groupProperties: { numberOfLocales }
2922
+ });
2923
+ };
2924
+ const metrics = () => ({
2925
+ sendDidInitializeEvent,
2926
+ sendDidUpdateI18nLocalesEvent
2927
+ });
2928
+ const syncNonLocalizedAttributes = async (sourceEntry, model) => {
2929
+ const { copyNonLocalizedAttributes: copyNonLocalizedAttributes2 } = getService("content-types");
2930
+ const nonLocalizedAttributes = copyNonLocalizedAttributes2(model, sourceEntry);
2931
+ if (fp.isEmpty(nonLocalizedAttributes)) {
2932
+ return;
2933
+ }
2934
+ const uid = model.uid;
2935
+ const documentId = sourceEntry.documentId;
2936
+ const locale2 = sourceEntry.locale;
2937
+ const status = sourceEntry?.publishedAt ? "published" : "draft";
2938
+ const localeEntriesToUpdate = await strapi.db.query(uid).findMany({
2939
+ where: {
2940
+ documentId,
2941
+ publishedAt: status === "published" ? { $ne: null } : null,
2942
+ locale: { $ne: locale2 }
2943
+ },
2944
+ select: ["locale", "id"]
2945
+ });
2946
+ const entryData = await strapi.documents(uid).omitComponentData(nonLocalizedAttributes);
2947
+ await utils.async.map(localeEntriesToUpdate, async (entry) => {
2948
+ const transformedData = await strapi.documents.utils.transformData(
2949
+ fp.cloneDeep(nonLocalizedAttributes),
2950
+ {
2951
+ uid,
2952
+ status,
2953
+ locale: entry.locale,
2954
+ allowMissingId: true
2955
+ }
2956
+ );
2957
+ const componentData = await strapi.documents(uid).updateComponents(entry, transformedData);
2958
+ await strapi.db.query(uid).update({
2959
+ where: {
2960
+ documentId,
2961
+ publishedAt: status === "published" ? { $ne: null } : null,
2962
+ locale: { $eq: entry.locale }
2963
+ },
2964
+ // The data we send to the update function is the entry data merged with
2965
+ // the updated component data
2966
+ data: Object.assign(fp.cloneDeep(entryData), componentData)
2967
+ });
2968
+ });
2969
+ };
2970
+ const localizations = () => ({
2971
+ syncNonLocalizedAttributes
2972
+ });
2973
+ const find = (params = {}) => strapi.db.query("plugin::i18n.locale").findMany({ where: params });
2974
+ const findById = (id) => strapi.db.query("plugin::i18n.locale").findOne({ where: { id } });
2975
+ const findByCode = (code) => strapi.db.query("plugin::i18n.locale").findOne({ where: { code } });
2976
+ const count = (params = {}) => strapi.db.query("plugin::i18n.locale").count({ where: params });
2977
+ const create = async (locale2) => {
2978
+ const result = await strapi.db.query("plugin::i18n.locale").create({ data: locale2 });
2979
+ getService("metrics").sendDidUpdateI18nLocalesEvent();
2980
+ return result;
2981
+ };
2982
+ const update = async (params, updates) => {
2983
+ const result = await strapi.db.query("plugin::i18n.locale").update({ where: params, data: updates });
2984
+ getService("metrics").sendDidUpdateI18nLocalesEvent();
2985
+ return result;
2986
+ };
2987
+ const deleteFn = async ({ id }) => {
2988
+ const localeToDelete = await findById(id);
2989
+ if (localeToDelete) {
2990
+ await deleteAllLocalizedEntriesFor({ locale: localeToDelete.code });
2991
+ const result = await strapi.db.query("plugin::i18n.locale").delete({ where: { id } });
2992
+ getService("metrics").sendDidUpdateI18nLocalesEvent();
2993
+ return result;
2994
+ }
2995
+ return localeToDelete;
2996
+ };
2997
+ const setDefaultLocale = ({ code }) => getCoreStore().set({ key: "default_locale", value: code });
2998
+ const getDefaultLocale = () => getCoreStore().get({ key: "default_locale" });
2999
+ const setIsDefault = async (locales2) => {
3000
+ if (fp.isNil(locales2)) {
3001
+ return locales2;
3002
+ }
3003
+ const actualDefault = await getDefaultLocale();
3004
+ if (Array.isArray(locales2)) {
3005
+ return locales2.map((locale2) => ({ ...locale2, isDefault: actualDefault === locale2.code }));
3006
+ }
3007
+ return { ...locales2, isDefault: actualDefault === locales2.code };
3008
+ };
3009
+ const initDefaultLocale = async () => {
3010
+ const existingLocalesNb = await strapi.db.query("plugin::i18n.locale").count();
3011
+ if (existingLocalesNb === 0) {
3012
+ await create(DEFAULT_LOCALE);
3013
+ await setDefaultLocale({ code: DEFAULT_LOCALE.code });
3014
+ }
3015
+ };
3016
+ const deleteAllLocalizedEntriesFor = async ({ locale: locale2 }) => {
3017
+ const { isLocalizedContentType: isLocalizedContentType2 } = getService("content-types");
3018
+ const localizedModels = Object.values(strapi.contentTypes).filter(isLocalizedContentType2);
3019
+ for (const model of localizedModels) {
3020
+ await strapi.db.query(model.uid).deleteMany({ where: { locale: locale2 } });
3021
+ }
3022
+ };
3023
+ const locales = () => ({
3024
+ find,
3025
+ findById,
3026
+ findByCode,
3027
+ create,
3028
+ update,
3029
+ count,
3030
+ setDefaultLocale,
3031
+ getDefaultLocale,
3032
+ setIsDefault,
3033
+ delete: deleteFn,
3034
+ initDefaultLocale
3035
+ });
3036
+ const getIsoLocales = () => isoLocales;
3037
+ const isoLocalesService = () => ({
3038
+ getIsoLocales
3039
+ });
3040
+ const LOCALE_QUERY_FILTER = "locale";
3041
+ const SINGLE_ENTRY_ACTIONS = ["findOne", "update", "delete"];
3042
+ const BULK_ACTIONS = ["delete"];
3043
+ const paramsContain = (key, params) => {
3044
+ return fp.has(key, params.filters) || fp.isArray(params.filters) && params.filters.some((clause) => fp.has(key, clause)) || fp.isArray(fp.get("$and", params.filters)) && params.filters.$and.some((clause) => fp.has(key, clause));
3045
+ };
3046
+ const wrapParams = async (params = {}, ctx = {}) => {
3047
+ const { action } = ctx;
3048
+ if (fp.has(LOCALE_QUERY_FILTER, params)) {
3049
+ if (params[LOCALE_QUERY_FILTER] === "all") {
3050
+ return fp.omit(LOCALE_QUERY_FILTER, params);
3051
+ }
3052
+ return {
3053
+ ...fp.omit(LOCALE_QUERY_FILTER, params),
3054
+ filters: {
3055
+ $and: [{ locale: params[LOCALE_QUERY_FILTER] }].concat(params.filters || [])
3056
+ }
3057
+ };
3058
+ }
3059
+ const entityDefinedById = paramsContain("id", params) && SINGLE_ENTRY_ACTIONS.includes(action);
3060
+ const entitiesDefinedByIds = paramsContain("id.$in", params) && BULK_ACTIONS.includes(action);
3061
+ if (entityDefinedById || entitiesDefinedByIds) {
3062
+ return params;
3063
+ }
3064
+ const { getDefaultLocale: getDefaultLocale2 } = getService("locales");
3065
+ return {
3066
+ ...params,
3067
+ filters: {
3068
+ $and: [{ locale: await getDefaultLocale2() }].concat(params.filters || [])
3069
+ }
3070
+ };
3071
+ };
3072
+ const decorator = (service) => ({
3073
+ /**
3074
+ * Wraps result
3075
+ * @param {object} result - result object of query
3076
+ * @param {object} ctx - Query context
3077
+ * @param {object} ctx.model - Model that is being used
3078
+ */
3079
+ async wrapResult(result = {}, ctx = {}) {
3080
+ return service.wrapResult.call(this, result, ctx);
3081
+ },
3082
+ /**
3083
+ * Wraps query options. In particular will add default locale to query params
3084
+ * @param {object} params - Query options object (params, data, files, populate)
3085
+ * @param {object} ctx - Query context
3086
+ * @param {object} ctx.model - Model that is being used
3087
+ */
3088
+ async wrapParams(params = {}, ctx = {}) {
3089
+ const wrappedParams = await service.wrapParams.call(this, params, ctx);
3090
+ const model = strapi.getModel(ctx.uid);
3091
+ const { isLocalizedContentType: isLocalizedContentType2 } = getService("content-types");
3092
+ if (!isLocalizedContentType2(model)) {
3093
+ return wrappedParams;
3094
+ }
3095
+ return wrapParams(wrappedParams, ctx);
3096
+ },
3097
+ /**
3098
+ * Find an entry or several if fetching all locales
3099
+ * @param {string} uid - Model uid
3100
+ * @param {object} opts - Query options object (params, data, files, populate)
3101
+ */
3102
+ async findMany(uid, opts) {
3103
+ const model = strapi.getModel(uid);
3104
+ const { isLocalizedContentType: isLocalizedContentType2 } = getService("content-types");
3105
+ if (!isLocalizedContentType2(model)) {
3106
+ return service.findMany.call(this, uid, opts);
3107
+ }
3108
+ const { kind } = model;
3109
+ if (kind === "singleType") {
3110
+ if (opts[LOCALE_QUERY_FILTER] === "all") {
3111
+ const wrappedParams = await this.wrapParams(opts, { uid, action: "findMany" });
3112
+ const query = strapi.get("query-params").transform(uid, wrappedParams);
3113
+ const entities = await strapi.db.query(uid).findMany(query);
3114
+ return this.wrapResult(entities, { uid, action: "findMany" });
3115
+ }
3116
+ return service.findMany.call(this, uid, opts);
3117
+ }
3118
+ return service.findMany.call(this, uid, opts);
3119
+ }
3120
+ });
3121
+ const entityServiceDecorator = () => ({
3122
+ decorator,
3123
+ wrapParams
3124
+ });
3125
+ const {
3126
+ isRelationalAttribute,
3127
+ getVisibleAttributes,
3128
+ isTypedAttribute,
3129
+ getScalarAttributes,
3130
+ getRelationalAttributes
3131
+ } = utils.contentTypes;
3132
+ const { ApplicationError: ApplicationError$2 } = utils.errors;
3133
+ const hasLocalizedOption = (modelOrAttribute) => {
3134
+ return fp.prop("pluginOptions.i18n.localized", modelOrAttribute) === true;
3135
+ };
3136
+ const getValidLocale = async (locale2) => {
3137
+ const localesService = getService("locales");
3138
+ if (fp.isNil(locale2)) {
3139
+ return localesService.getDefaultLocale();
3140
+ }
3141
+ const foundLocale = await localesService.findByCode(locale2);
3142
+ if (!foundLocale) {
3143
+ throw new ApplicationError$2("Locale not found");
3144
+ }
3145
+ return locale2;
3146
+ };
3147
+ const isLocalizedAttribute = (attribute) => {
3148
+ return hasLocalizedOption(attribute) || isRelationalAttribute(attribute) || isTypedAttribute(attribute, "uid");
3149
+ };
3150
+ const isLocalizedContentType = (model) => {
3151
+ return hasLocalizedOption(model);
3152
+ };
3153
+ const getNonLocalizedAttributes = (model) => {
3154
+ return getVisibleAttributes(model).filter(
3155
+ (attrName) => !isLocalizedAttribute(model.attributes[attrName])
3156
+ );
3157
+ };
3158
+ const removeId = (value) => {
3159
+ if (typeof value === "object" && fp.has("id", value)) {
3160
+ delete value.id;
3161
+ }
3162
+ };
3163
+ const removeIds = (model) => (entry) => removeIdsMut(model, fp.cloneDeep(entry));
3164
+ const removeIdsMut = (model, entry) => {
3165
+ if (fp.isNil(entry)) {
3166
+ return entry;
3167
+ }
3168
+ removeId(entry);
3169
+ ___default.default.forEach(model.attributes, (attr, attrName) => {
3170
+ const value = entry[attrName];
3171
+ if (attr.type === "dynamiczone" && fp.isArray(value)) {
3172
+ value.forEach((compo) => {
3173
+ if (fp.has("__component", compo)) {
3174
+ const model2 = strapi.components[compo.__component];
3175
+ removeIdsMut(model2, compo);
3176
+ }
3177
+ });
3178
+ } else if (attr.type === "component") {
3179
+ const model2 = strapi.components[attr.component];
3180
+ if (fp.isArray(value)) {
3181
+ value.forEach((compo) => removeIdsMut(model2, compo));
3182
+ } else {
3183
+ removeIdsMut(model2, value);
3184
+ }
3185
+ }
3186
+ });
3187
+ return entry;
3188
+ };
3189
+ const copyNonLocalizedAttributes = (model, entry) => {
3190
+ const nonLocalizedAttributes = getNonLocalizedAttributes(model);
3191
+ return fp.pipe(fp.pick(nonLocalizedAttributes), removeIds(model))(entry);
3192
+ };
3193
+ const getLocalizedAttributes = (model) => {
3194
+ return getVisibleAttributes(model).filter(
3195
+ (attrName) => isLocalizedAttribute(model.attributes[attrName])
3196
+ );
3197
+ };
3198
+ const fillNonLocalizedAttributes = (entry, relatedEntry, { model }) => {
3199
+ if (fp.isNil(relatedEntry)) {
3200
+ return;
3201
+ }
3202
+ const modelDef = strapi.getModel(model);
3203
+ const relatedEntryCopy = copyNonLocalizedAttributes(modelDef, relatedEntry);
3204
+ ___default.default.forEach(relatedEntryCopy, (value, field) => {
3205
+ if (fp.isNil(entry[field])) {
3206
+ entry[field] = value;
3207
+ }
3208
+ });
3209
+ };
3210
+ const getNestedPopulateOfNonLocalizedAttributes = (modelUID) => {
3211
+ const schema2 = strapi.getModel(modelUID);
3212
+ const scalarAttributes = getScalarAttributes(schema2);
3213
+ const nonLocalizedAttributes = getNonLocalizedAttributes(schema2);
3214
+ const allAttributes = [...scalarAttributes, ...nonLocalizedAttributes];
3215
+ if (schema2.modelType === "component") {
3216
+ allAttributes.push(...getRelationalAttributes(schema2));
3217
+ }
3218
+ const currentAttributesToPopulate = allAttributes.filter((value, index2, self) => {
3219
+ return self.indexOf(value) === index2 && self.lastIndexOf(value) === index2;
3220
+ });
3221
+ const attributesToPopulate = [...currentAttributesToPopulate];
3222
+ for (const attrName of currentAttributesToPopulate) {
3223
+ const attr = schema2.attributes[attrName];
3224
+ if (attr.type === "component") {
3225
+ const nestedPopulate = getNestedPopulateOfNonLocalizedAttributes(attr.component).map(
3226
+ (nestedAttr) => `${attrName}.${nestedAttr}`
3227
+ );
3228
+ attributesToPopulate.push(...nestedPopulate);
3229
+ } else if (attr.type === "dynamiczone") {
3230
+ attr.components.forEach((componentName) => {
3231
+ const nestedPopulate = getNestedPopulateOfNonLocalizedAttributes(componentName).map(
3232
+ (nestedAttr) => `${attrName}.${nestedAttr}`
3233
+ );
3234
+ attributesToPopulate.push(...nestedPopulate);
3235
+ });
3236
+ }
3237
+ }
3238
+ return attributesToPopulate;
3239
+ };
3240
+ const contentTypes = () => ({
3241
+ isLocalizedContentType,
3242
+ getValidLocale,
3243
+ getLocalizedAttributes,
3244
+ getNonLocalizedAttributes,
3245
+ copyNonLocalizedAttributes,
3246
+ fillNonLocalizedAttributes,
3247
+ getNestedPopulateOfNonLocalizedAttributes
3248
+ });
3249
+ const services = {
3250
+ permissions,
3251
+ metrics,
3252
+ localizations,
3253
+ locales,
3254
+ "iso-locales": isoLocalesService,
3255
+ "entity-service-decorator": entityServiceDecorator,
3256
+ "content-types": contentTypes
3257
+ };
3258
+ const admin = {
3259
+ type: "admin",
3260
+ routes: [
3261
+ {
3262
+ method: "GET",
3263
+ path: "/iso-locales",
3264
+ handler: "iso-locales.listIsoLocales",
3265
+ config: {
3266
+ policies: [
3267
+ "admin::isAuthenticatedAdmin",
3268
+ {
3269
+ name: "plugin::content-manager.hasPermissions",
3270
+ config: { actions: ["plugin::i18n.locale.read"] }
3271
+ }
3272
+ ]
3273
+ }
3274
+ },
3275
+ {
3276
+ method: "GET",
3277
+ path: "/locales",
3278
+ handler: "locales.listLocales",
3279
+ config: {
3280
+ policies: ["admin::isAuthenticatedAdmin"]
3281
+ }
3282
+ },
3283
+ {
3284
+ method: "POST",
3285
+ path: "/locales",
3286
+ handler: "locales.createLocale",
3287
+ config: {
3288
+ policies: [
3289
+ "admin::isAuthenticatedAdmin",
3290
+ {
3291
+ name: "plugin::content-manager.hasPermissions",
3292
+ config: { actions: ["plugin::i18n.locale.create"] }
3293
+ }
3294
+ ]
3295
+ }
3296
+ },
3297
+ {
3298
+ method: "PUT",
3299
+ path: "/locales/:id",
3300
+ handler: "locales.updateLocale",
3301
+ config: {
3302
+ policies: [
3303
+ "admin::isAuthenticatedAdmin",
3304
+ {
3305
+ name: "plugin::content-manager.hasPermissions",
3306
+ config: { actions: ["plugin::i18n.locale.update"] }
3307
+ }
3308
+ ]
3309
+ }
3310
+ },
3311
+ {
3312
+ method: "DELETE",
3313
+ path: "/locales/:id",
3314
+ handler: "locales.deleteLocale",
3315
+ config: {
3316
+ policies: [
3317
+ "admin::isAuthenticatedAdmin",
3318
+ {
3319
+ name: "plugin::content-manager.hasPermissions",
3320
+ config: { actions: ["plugin::i18n.locale.delete"] }
3321
+ }
3322
+ ]
3323
+ }
3324
+ },
3325
+ {
3326
+ method: "POST",
3327
+ path: "/content-manager/actions/get-non-localized-fields",
3328
+ handler: "content-types.getNonLocalizedAttributes",
3329
+ config: {
3330
+ policies: ["admin::isAuthenticatedAdmin"]
3331
+ }
3332
+ }
3333
+ ]
3334
+ };
3335
+ const contentApi = {
3336
+ type: "content-api",
3337
+ routes: [
3338
+ {
3339
+ method: "GET",
3340
+ path: "/locales",
3341
+ handler: "locales.listLocales"
3342
+ }
3343
+ ]
3344
+ };
3345
+ const routes = {
3346
+ admin,
3347
+ "content-api": contentApi
3348
+ };
3349
+ const allowedLocaleCodes = isoLocales.map(fp.prop("code"));
3350
+ const createLocaleSchema = utils.yup.object().shape({
3351
+ name: utils.yup.string().max(50).nullable(),
3352
+ code: utils.yup.string().oneOf(allowedLocaleCodes).required(),
3353
+ isDefault: utils.yup.boolean().required()
3354
+ }).noUnknown();
3355
+ const updateLocaleSchema = utils.yup.object().shape({
3356
+ name: utils.yup.string().min(1).max(50).nullable(),
3357
+ isDefault: utils.yup.boolean()
3358
+ }).noUnknown();
3359
+ const validateCreateLocaleInput = utils.validateYupSchema(createLocaleSchema);
3360
+ const validateUpdateLocaleInput = utils.validateYupSchema(updateLocaleSchema);
3361
+ const formatLocale = (locale2) => {
3362
+ return {
3363
+ ...locale2,
3364
+ name: locale2.name || null
3365
+ };
3366
+ };
3367
+ const { setCreatorFields } = utils__namespace;
3368
+ const { ApplicationError: ApplicationError$1 } = utils__namespace.errors;
3369
+ const sanitizeLocale = (locale2) => {
3370
+ const model = strapi.getModel("plugin::i18n.locale");
3371
+ return strapi.contentAPI.sanitize.output(locale2, model);
3372
+ };
3373
+ const controller$2 = {
3374
+ async listLocales(ctx) {
3375
+ const localesService = getService("locales");
3376
+ const locales2 = await localesService.find();
3377
+ const sanitizedLocales = await sanitizeLocale(locales2);
3378
+ ctx.body = await localesService.setIsDefault(sanitizedLocales);
3379
+ },
3380
+ async createLocale(ctx) {
3381
+ const { user } = ctx.state;
3382
+ const body = ctx.request.body;
3383
+ const { isDefault, ...localeToCreate } = body;
3384
+ await validateCreateLocaleInput(body);
3385
+ const localesService = getService("locales");
3386
+ const existingLocale = await localesService.findByCode(body.code);
3387
+ if (existingLocale) {
3388
+ throw new ApplicationError$1("This locale already exists");
3389
+ }
3390
+ const localeToPersist = setCreatorFields({ user })(formatLocale(localeToCreate));
3391
+ const locale2 = await localesService.create(localeToPersist);
3392
+ if (isDefault) {
3393
+ await localesService.setDefaultLocale(locale2);
3394
+ }
3395
+ const sanitizedLocale = await sanitizeLocale(locale2);
3396
+ ctx.body = await localesService.setIsDefault(sanitizedLocale);
3397
+ },
3398
+ async updateLocale(ctx) {
3399
+ const { user } = ctx.state;
3400
+ const { id } = ctx.params;
3401
+ const body = ctx.request.body;
3402
+ const { isDefault, ...updates } = body;
3403
+ await validateUpdateLocaleInput(body);
3404
+ const localesService = getService("locales");
3405
+ const existingLocale = await localesService.findById(id);
3406
+ if (!existingLocale) {
3407
+ return ctx.notFound("locale.notFound");
3408
+ }
3409
+ const allowedParams = ["name"];
3410
+ const cleanUpdates = setCreatorFields({ user, isEdition: true })(fp.pick(allowedParams, updates));
3411
+ const updatedLocale = await localesService.update({ id }, cleanUpdates);
3412
+ if (isDefault) {
3413
+ await localesService.setDefaultLocale(updatedLocale);
3414
+ }
3415
+ const sanitizedLocale = await sanitizeLocale(updatedLocale);
3416
+ ctx.body = await localesService.setIsDefault(sanitizedLocale);
3417
+ },
3418
+ async deleteLocale(ctx) {
3419
+ const { id } = ctx.params;
3420
+ const localesService = getService("locales");
3421
+ const existingLocale = await localesService.findById(id);
3422
+ if (!existingLocale) {
3423
+ return ctx.notFound("locale.notFound");
3424
+ }
3425
+ const defaultLocaleCode = await localesService.getDefaultLocale();
3426
+ if (existingLocale.code === defaultLocaleCode) {
3427
+ throw new ApplicationError$1("Cannot delete the default locale");
3428
+ }
3429
+ await localesService.delete({ id });
3430
+ const sanitizedLocale = await sanitizeLocale(existingLocale);
3431
+ ctx.body = await localesService.setIsDefault(sanitizedLocale);
3432
+ }
3433
+ };
3434
+ const validateGetNonLocalizedAttributesSchema = utils.yup.object().shape({
3435
+ model: utils.yup.string().required(),
3436
+ id: utils.yup.mixed().when("model", {
3437
+ is: (model) => fp.get("kind", strapi.contentType(model)) === "singleType",
3438
+ then: utils.yup.strapiID().nullable(),
3439
+ otherwise: utils.yup.strapiID().required()
3440
+ }),
3441
+ locale: utils.yup.string().required()
3442
+ }).noUnknown().required();
3443
+ const validateGetNonLocalizedAttributesInput = utils.validateYupSchema(
3444
+ validateGetNonLocalizedAttributesSchema
3445
+ );
3446
+ const { ApplicationError } = utils.errors;
3447
+ const { PUBLISHED_AT_ATTRIBUTE } = utils.contentTypes.constants;
3448
+ const getLocalesProperty = fp.getOr([], "properties.locales");
3449
+ const getFieldsProperty = fp.prop("properties.fields");
3450
+ const getFirstLevelPath = fp.map((path) => path.split(".")[0]);
3451
+ const controller$1 = {
3452
+ async getNonLocalizedAttributes(ctx) {
3453
+ const { user } = ctx.state;
3454
+ const body = ctx.request.body;
3455
+ const { model, id, locale: locale2 } = body;
3456
+ await validateGetNonLocalizedAttributesInput({ model, id, locale: locale2 });
3457
+ const {
3458
+ copyNonLocalizedAttributes: copyNonLocalizedAttributes2,
3459
+ isLocalizedContentType: isLocalizedContentType2,
3460
+ getNestedPopulateOfNonLocalizedAttributes: getNestedPopulateOfNonLocalizedAttributes2
3461
+ } = getService("content-types");
3462
+ const {
3463
+ default: { READ_ACTION, CREATE_ACTION }
3464
+ } = strapi.service("admin::constants");
3465
+ const modelDef = strapi.contentType(model);
3466
+ const attributesToPopulate = getNestedPopulateOfNonLocalizedAttributes2(model);
3467
+ if (!isLocalizedContentType2(modelDef)) {
3468
+ throw new ApplicationError(`Model ${model} is not localized`);
3469
+ }
3470
+ const params = modelDef.kind === "singleType" ? {} : { id };
3471
+ const entity = await strapi.db.query(model).findOne({ where: params, populate: attributesToPopulate });
3472
+ if (!entity) {
3473
+ return ctx.notFound();
3474
+ }
3475
+ const permissions2 = await strapi.admin.services.permission.findMany({
3476
+ where: {
3477
+ action: [READ_ACTION, CREATE_ACTION],
3478
+ subject: model,
3479
+ role: {
3480
+ id: user.roles.map(fp.prop("id"))
3481
+ }
3482
+ }
3483
+ });
3484
+ const localePermissions = permissions2.filter((perm) => getLocalesProperty(perm).includes(locale2)).map(getFieldsProperty);
3485
+ const permittedFields = fp.pipe(fp.flatten, getFirstLevelPath, fp.uniq)(localePermissions);
3486
+ const nonLocalizedFields = copyNonLocalizedAttributes2(modelDef, entity);
3487
+ const sanitizedNonLocalizedFields = fp.pick(permittedFields, nonLocalizedFields);
3488
+ const availableLocalesResult = await strapi.plugins["content-manager"].service("document-metadata").getMetadata(model, entity, {
3489
+ availableLocales: true
3490
+ });
3491
+ const availableLocales = availableLocalesResult.availableLocales.map(
3492
+ (localeResult) => fp.pick(["id", "locale", PUBLISHED_AT_ATTRIBUTE], localeResult)
3493
+ );
3494
+ ctx.body = {
3495
+ nonLocalizedFields: sanitizedNonLocalizedFields,
3496
+ localizations: availableLocales.concat(
3497
+ fp.pick(["id", "locale", PUBLISHED_AT_ATTRIBUTE], entity)
3498
+ )
3499
+ };
3500
+ }
3501
+ };
3502
+ const controller = {
3503
+ listIsoLocales(ctx) {
3504
+ const isoLocalesService2 = getService("iso-locales");
3505
+ ctx.body = isoLocalesService2.getIsoLocales();
3506
+ }
3507
+ };
3508
+ const controllers = {
3509
+ locales: controller$2,
3510
+ "iso-locales": controller,
3511
+ "content-types": controller$1
3512
+ };
3513
+ const index = () => ({
3514
+ register,
3515
+ bootstrap,
3516
+ routes,
3517
+ controllers,
3518
+ contentTypes: contentTypes$1,
3519
+ services
3520
+ });
3521
+ module.exports = index;
3522
+ //# sourceMappingURL=index.js.map