@strapi/i18n 0.0.0-experimental.a65a85fdea97faae8679d3ffc5f9d79af61abd26 → 0.0.0

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