@schukai/monster 4.38.9 → 4.39.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.
@@ -13,17 +13,17 @@
13
13
  import { instanceSymbol } from "../../constants.mjs";
14
14
  import { addAttributeToken } from "../../dom/attributes.mjs";
15
15
  import {
16
- ATTRIBUTE_ERRORMESSAGE,
17
- ATTRIBUTE_ROLE,
16
+ ATTRIBUTE_ERRORMESSAGE,
17
+ ATTRIBUTE_ROLE,
18
18
  } from "../../dom/constants.mjs";
19
19
  import { CustomControl } from "../../dom/customcontrol.mjs";
20
20
  import {
21
- CustomElement,
22
- updaterTransformerMethodsSymbol,
21
+ CustomElement,
22
+ updaterTransformerMethodsSymbol,
23
23
  } from "../../dom/customelement.mjs";
24
24
  import {
25
- assembleMethodSymbol,
26
- registerCustomElement,
25
+ assembleMethodSymbol,
26
+ registerCustomElement,
27
27
  } from "../../dom/customelement.mjs";
28
28
  import { findTargetElementFromEvent } from "../../dom/events.mjs";
29
29
  import { isFunction, isObject } from "../../types/is.mjs";
@@ -40,30 +40,35 @@ export { LocalePicker };
40
40
  /**
41
41
  * @private
42
42
  * @type {symbol}
43
+ * Reference to the main picker element
43
44
  */
44
45
  const localePickerElementSymbol = Symbol("localePickerElement");
45
46
 
46
47
  /**
47
48
  * @private
48
49
  * @type {symbol}
50
+ * Reference to the other languages select element
49
51
  */
50
52
  const otherLanguagesElementSymbol = Symbol("otherLanguagesElement");
51
53
 
52
54
  /**
53
55
  * @private
54
56
  * @type {symbol}
57
+ * Reference to the language button element
55
58
  */
56
59
  const buttonLanguageElementSymbol = Symbol("buttonLanguageElement");
57
60
 
58
61
  /**
59
62
  * @private
60
63
  * @type {symbol}
64
+ * Reference to the 'no thanks' button element
61
65
  */
62
66
  const buttonNoThanksElementSymbol = Symbol("buttonNoThanksElement");
63
67
 
64
68
  /**
65
69
  * @private
66
70
  * @type {symbol}
71
+ * Stores detected languages
67
72
  */
68
73
  const detectedLanguagesSymbol = Symbol("detectedLanguages");
69
74
 
@@ -82,584 +87,589 @@ const detectedLanguagesSymbol = Symbol("detectedLanguages");
82
87
  * @summary A beautiful LocalePicker that can make your life easier and also looks good.
83
88
  */
84
89
  class LocalePicker extends CustomElement {
85
- /**
86
- * This method is called by the `instanceof` operator.
87
- * @returns {symbol}
88
- */
89
- static get [instanceSymbol]() {
90
- return Symbol.for(
91
- "@schukai/monster/components/accessibility/locale-picker@@instance",
92
- );
93
- }
94
-
95
- /**
96
- *
97
- * @return {LocalePicker}
98
- */
99
- [assembleMethodSymbol]() {
100
- super[assembleMethodSymbol]();
101
- initControlReferences.call(this);
102
- initEventHandler.call(this);
103
-
104
- return this;
105
- }
106
-
107
- /**
108
- * To set the options via the HTML Tag, the attribute `data-monster-options` must be used.
109
- * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
110
- *
111
- * The individual configuration values can be found in the table.
112
- *
113
- * @property {Object} templates Template definitions
114
- * @property {string} templates.main Main template
115
- * @property {Object} labels Label definitions
116
- * @property {string} labels.headline Headline
117
- * @property {string} labels.text Text
118
- * @property {string} labels.button-label Button label
119
- * @property {string} labels.button-no-thanks Button no thanks
120
- * @property {string} labels.headline-other Headline other languages
121
- * @property {Function} callbacks.getTranslation Callback to get the translation for the labels
122
- * @property {Object} features Features
123
- * @property {boolean} features.removeOnSelected Remove the element when a language is selected
124
- * @property {boolean} features.showAlways Show the element always
125
- * @property {boolean} disabled Disabled state
126
- */
127
- get defaults() {
128
- return Object.assign({}, super.defaults, {
129
- templates: {
130
- main: getTemplate(),
131
- },
132
- labels: {
133
- headline: "Welcome to our Website",
134
- text: "This page is currently displayed in ${currentLabel}. However, we also offer this page in your preferred language. Would you like to switch?",
135
- "button-label": "Switch to ${preferred.label}",
136
- "button-no-thanks": "No, thanks",
137
- "headline-other": "Other languages",
138
- },
139
-
140
- callbacks: {
141
- getTranslation: getTranslations,
142
- },
143
-
144
- disabled: false,
145
- features: {
146
- removeOnSelected: false,
147
- showAlways: false,
148
- },
149
- });
150
- }
151
-
152
- /**
153
- * Private method that provides a mapping of transformer methods keyed by their names.
154
- * These transformer methods define custom transformations for given input values.
155
- *
156
- * @private
157
- * @return {Object} An object containing transformer methods for internal use.
158
- */
159
- [updaterTransformerMethodsSymbol]() {
160
- return {
161
- "replace-placeholder": (value) => {
162
- const formatter = new Formatter(this[detectedLanguagesSymbol]);
163
- return formatter.format(value);
164
- },
165
- };
166
- }
167
-
168
- /**
169
- * Lifecycle method that is called when the custom element is appended into a document-connected element.
170
- * Invokes the parent class's connectedCallback method and retrieves the user's preferred language.
171
- * Logs the preferred language to the console.
172
- *
173
- * @return {void}
174
- */
175
- connectedCallback() {
176
- super.connectedCallback();
177
-
178
- this[detectedLanguagesSymbol] = detectUserLanguagePreference();
179
-
180
- if (
181
- !isObject(this[detectedLanguagesSymbol]?.preferred) &&
182
- this.getOption("features.showAlways") !== true
183
- ) {
184
- this.hide();
185
-
186
- if (this.getOption("features.removeOnSelected")) {
187
- this.remove();
188
- }
189
- return;
190
- }
191
-
192
- if (!isObject(this[detectedLanguagesSymbol]?.preferred)) {
193
- this[detectedLanguagesSymbol].preferred = {
194
- fullLang: "en",
195
- baseLang: "en",
196
- label: "English",
197
- };
198
- }
199
-
200
- const stored = localStorage.getItem(buildStorageKey.call(this));
201
- if (stored && this.getOption("features.showAlways") !== true) {
202
- if (this.getOption("features.removeOnSelected")) {
203
- this.remove();
204
- }
205
- return;
206
- }
207
-
208
- this.show();
209
-
210
- if (
211
- this[otherLanguagesElementSymbol] instanceof HTMLElement &&
212
- this[detectedLanguagesSymbol].offerable &&
213
- this[detectedLanguagesSymbol].offerable.length > 1
214
- ) {
215
- this[otherLanguagesElementSymbol].classList.remove("hidden");
216
- this[otherLanguagesElementSymbol].setOption(
217
- "mapping.labelTemplate",
218
- "${label}",
219
- );
220
- this[otherLanguagesElementSymbol].setOption(
221
- "mapping.valueTemplate",
222
- "${href}",
223
- );
224
- this[otherLanguagesElementSymbol].importOptions(
225
- this[detectedLanguagesSymbol]?.offerable || [],
226
- );
227
- }
228
-
229
- if (
230
- this[detectedLanguagesSymbol].offerable &&
231
- this[detectedLanguagesSymbol].offerable.length > 0
232
- ) {
233
- const getTranslationCallback = this.getOption("callbacks.getTranslation");
234
- if (isFunction(getTranslationCallback)) {
235
- const translations = getTranslationCallback(
236
- this[detectedLanguagesSymbol].offerable[0].baseLang,
237
- );
238
-
239
- this.setOption("labels", translations.labels);
240
- if (this[otherLanguagesElementSymbol]) {
241
- this[otherLanguagesElementSymbol].setOption(
242
- "labels.select-an-option",
243
- translations.selectAnOption,
244
- );
245
- }
246
- }
247
- }
248
- }
249
-
250
- /**
251
- * Resets the locale picker by removing the stored value from the local storage.
252
- *
253
- * @returns {LocalePicker}
254
- */
255
- reset() {
256
- localStorage.removeItem(buildStorageKey.call(this));
257
- this.show();
258
- return this;
259
- }
260
-
261
- /**
262
- * Hides the locale picker.
263
- *
264
- * @returns {LocalePicker}
265
- */
266
- hide() {
267
- this.style.display = "none";
268
-
269
- if (!this[localePickerElementSymbol]) {
270
- return this;
271
- }
272
-
273
- this[localePickerElementSymbol].style.display = "none";
274
- return this;
275
- }
276
-
277
- /**
278
- * Shows the locale picker.
279
- * @returns {LocalePicker}
280
- */
281
- show() {
282
- this.style.display = "block";
283
-
284
- if (!this[localePickerElementSymbol]) {
285
- return this;
286
- }
287
-
288
- this[localePickerElementSymbol].style.display = "block";
289
- return this;
290
- }
291
-
292
- /**
293
- * @return {string}
294
- */
295
- static getTag() {
296
- return "monster-locale-picker";
297
- }
298
-
299
- /**
300
- * @return {CSSStyleSheet[]}
301
- */
302
- static getCSSStyleSheet() {
303
- return [LocalePickerStyleSheet];
304
- }
90
+ /**
91
+ * This method is called by the `instanceof` operator.
92
+ * @returns {symbol}
93
+ */
94
+ static get [instanceSymbol]() {
95
+ return Symbol.for(
96
+ "@schukai/monster/components/accessibility/locale-picker@@instance",
97
+ );
98
+ }
99
+
100
+ /**
101
+ * Initializes the component.
102
+ * @return {LocalePicker}
103
+ */
104
+ [assembleMethodSymbol]() {
105
+ super[assembleMethodSymbol]();
106
+ initControlReferences.call(this);
107
+ initEventHandler.call(this);
108
+
109
+ return this;
110
+ }
111
+
112
+ /**
113
+ * To set the options via the HTML Tag, the attribute `data-monster-options` must be used.
114
+ * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
115
+ *
116
+ * The individual configuration values can be found in the table.
117
+ *
118
+ * @property {Object} templates Template definitions
119
+ * @property {string} templates.main Main template
120
+ * @property {Object} labels Label definitions
121
+ * @property {string} labels.headline Headline
122
+ * @property {string} labels.text Text
123
+ * @property {string} labels.button-label Button label
124
+ * @property {string} labels.button-no-thanks Button no thanks
125
+ * @property {string} labels.headline-other Headline other languages
126
+ * @property {Function} callbacks.getTranslation Callback to get the translation for the labels
127
+ * @property {Object} features Features
128
+ * @property {boolean} features.removeOnSelected Remove the element when a language is selected
129
+ * @property {boolean} features.showAlways Show the element always
130
+ * @property {boolean} disabled Disabled state
131
+ */
132
+ get defaults() {
133
+ return Object.assign({}, super.defaults, {
134
+ templates: {
135
+ main: getTemplate(),
136
+ },
137
+ labels: {
138
+ headline: "Welcome to our Website",
139
+ text: "This page is currently displayed in ${currentLabel}. However, we also offer this page in your preferred language. Would you like to switch?",
140
+ "button-label": "Switch to ${preferred.label}",
141
+ "button-no-thanks": "No, thanks",
142
+ "headline-other": "Other languages",
143
+ },
144
+
145
+ callbacks: {
146
+ getTranslation: getTranslations,
147
+ },
148
+
149
+ disabled: false,
150
+ features: {
151
+ removeOnSelected: false,
152
+ showAlways: false,
153
+ },
154
+ });
155
+ }
156
+
157
+ /**
158
+ * Private method that provides a mapping of transformer methods keyed by their names.
159
+ * These transformer methods define custom transformations for given input values.
160
+ *
161
+ * @private
162
+ * @return {Object} An object containing transformer methods for internal use.
163
+ */
164
+ [updaterTransformerMethodsSymbol]() {
165
+ return {
166
+ "replace-placeholder": (value) => {
167
+ const formatter = new Formatter(this[detectedLanguagesSymbol]);
168
+ return formatter.format(value);
169
+ },
170
+ };
171
+ }
172
+
173
+ /**
174
+ * Lifecycle method that is called when the custom element is appended into a document-connected element.
175
+ * Invokes the parent class's connectedCallback method and retrieves the user's preferred language.
176
+ * Hides or shows the picker depending on the user's language and stored session.
177
+ *
178
+ * @return {void}
179
+ */
180
+ connectedCallback() {
181
+ super.connectedCallback();
182
+
183
+ this[detectedLanguagesSymbol] = detectUserLanguagePreference();
184
+
185
+ if (
186
+ !isObject(this[detectedLanguagesSymbol]?.preferred) &&
187
+ this.getOption("features.showAlways") !== true
188
+ ) {
189
+ this.hide();
190
+
191
+ if (this.getOption("features.removeOnSelected")) {
192
+ this.remove();
193
+ }
194
+ return;
195
+ }
196
+
197
+ if (!isObject(this[detectedLanguagesSymbol]?.preferred)) {
198
+ this[detectedLanguagesSymbol].preferred = {
199
+ fullLang: "en",
200
+ baseLang: "en",
201
+ label: "English",
202
+ };
203
+ }
204
+
205
+ const stored = sessionStorage.getItem(buildStorageKey.call(this));
206
+ if (stored && this.getOption("features.showAlways") !== true) {
207
+ if (this.getOption("features.removeOnSelected")) {
208
+ this.remove();
209
+ }
210
+ return;
211
+ }
212
+
213
+ this.show();
214
+
215
+ if (
216
+ this[otherLanguagesElementSymbol] instanceof HTMLElement &&
217
+ this[detectedLanguagesSymbol].offerable &&
218
+ this[detectedLanguagesSymbol].offerable.length > 1
219
+ ) {
220
+ this[otherLanguagesElementSymbol].classList.remove("hidden");
221
+ this[otherLanguagesElementSymbol].setOption(
222
+ "mapping.labelTemplate",
223
+ "${label}",
224
+ );
225
+ this[otherLanguagesElementSymbol].setOption(
226
+ "mapping.valueTemplate",
227
+ "${href}",
228
+ );
229
+ this[otherLanguagesElementSymbol].importOptions(
230
+ this[detectedLanguagesSymbol]?.offerable || [],
231
+ );
232
+ }
233
+
234
+ if (
235
+ this[detectedLanguagesSymbol].offerable &&
236
+ this[detectedLanguagesSymbol].offerable.length > 0
237
+ ) {
238
+ const getTranslationCallback = this.getOption("callbacks.getTranslation");
239
+ if (isFunction(getTranslationCallback)) {
240
+ const translations = getTranslationCallback(
241
+ this[detectedLanguagesSymbol].offerable[0].baseLang,
242
+ );
243
+
244
+ this.setOption("labels", translations.labels);
245
+ if (this[otherLanguagesElementSymbol]) {
246
+ this[otherLanguagesElementSymbol].setOption(
247
+ "labels.select-an-option",
248
+ translations.selectAnOption,
249
+ );
250
+ }
251
+ }
252
+ }
253
+ }
254
+
255
+ /**
256
+ * Resets the locale picker by removing the stored value from the local storage.
257
+ *
258
+ * @returns {LocalePicker}
259
+ */
260
+ reset() {
261
+ sessionStorage.removeItem(buildStorageKey.call(this));
262
+ this.show();
263
+ return this;
264
+ }
265
+
266
+ /**
267
+ * Hides the locale picker.
268
+ *
269
+ * @returns {LocalePicker}
270
+ */
271
+ hide() {
272
+ this.style.display = "none";
273
+
274
+ if (!this[localePickerElementSymbol]) {
275
+ return this;
276
+ }
277
+
278
+ this[localePickerElementSymbol].style.display = "none";
279
+ return this;
280
+ }
281
+
282
+ /**
283
+ * Shows the locale picker.
284
+ * @returns {LocalePicker}
285
+ */
286
+ show() {
287
+ this.style.display = "block";
288
+
289
+ if (!this[localePickerElementSymbol]) {
290
+ return this;
291
+ }
292
+
293
+ this[localePickerElementSymbol].style.display = "block";
294
+ return this;
295
+ }
296
+
297
+ /**
298
+ * @return {string}
299
+ */
300
+ static getTag() {
301
+ return "monster-locale-picker";
302
+ }
303
+
304
+ /**
305
+ * @return {CSSStyleSheet[]}
306
+ */
307
+ static getCSSStyleSheet() {
308
+ return [LocalePickerStyleSheet];
309
+ }
310
+ }
311
+
312
+ /**
313
+ * @private
314
+ * @return {void}
315
+ * Initializes references to all relevant elements in the picker.
316
+ */
317
+ function initControlReferences() {
318
+ this[localePickerElementSymbol] = this.shadowRoot.querySelector(
319
+ `[${ATTRIBUTE_ROLE}="control"]`,
320
+ );
321
+
322
+ this[otherLanguagesElementSymbol] = this.shadowRoot.querySelector(
323
+ `[${ATTRIBUTE_ROLE}="other-languages"]`,
324
+ );
325
+
326
+ this[buttonNoThanksElementSymbol] = this.shadowRoot.querySelector(
327
+ `[${ATTRIBUTE_ROLE}="button-no-thanks"]`,
328
+ );
329
+
330
+ this[buttonLanguageElementSymbol] = this.shadowRoot.querySelector(
331
+ `[${ATTRIBUTE_ROLE}="button-language"]`,
332
+ );
305
333
  }
306
334
 
307
335
  /**
308
336
  * @private
309
337
  * @return {initEventHandler}
338
+ * Initializes all event handlers for the picker.
310
339
  */
311
340
  function initEventHandler() {
312
- const self = this;
313
- const element = this[localePickerElementSymbol];
314
-
315
- const type = "click";
316
-
317
- element.addEventListener(type, function (event) {
318
- const callback = self.getOption("actions.click");
319
-
320
- fireCustomEvent(self, "monster-locale-picker-clicked", {
321
- element: self,
322
- });
323
-
324
- if (!isFunction(callback)) {
325
- return;
326
- }
327
-
328
- const element = findTargetElementFromEvent(
329
- event,
330
- ATTRIBUTE_ROLE,
331
- "control",
332
- );
333
-
334
- if (!(element instanceof Node && self.hasNode(element))) {
335
- return;
336
- }
337
-
338
- callback.call(self, event);
339
- });
340
-
341
- this[buttonNoThanksElementSymbol].setOption("actions.click", () => {
342
- localStorage.setItem(buildStorageKey.call(this), "1");
343
- this.hide();
344
- if (this.getOption("features.removeOnSelected")) {
345
- this.remove();
346
- }
347
- });
348
-
349
- this[buttonLanguageElementSymbol].setOption("actions.click", () => {
350
- localStorage.setItem(buildStorageKey.call(this), "1");
351
- window.location.href = this[detectedLanguagesSymbol].offerable?.[0]?.href;
352
- });
353
-
354
- this[otherLanguagesElementSymbol].addEventListener("change", (event) => {
355
- const element = findTargetElementFromEvent(
356
- event,
357
- ATTRIBUTE_ROLE,
358
- "other-languages",
359
- );
360
-
361
- if (element) {
362
- const selected = element?.value;
363
- if (selected) {
364
- localStorage.setItem(buildStorageKey.call(this), "1");
365
- window.location.href = selected;
366
- }
367
- }
368
- });
369
-
370
- return this;
341
+ const self = this;
342
+ const element = this[localePickerElementSymbol];
343
+
344
+ const type = "click";
345
+
346
+ element.addEventListener(type, function (event) {
347
+ const callback = self.getOption("actions.click");
348
+
349
+ fireCustomEvent(self, "monster-locale-picker-clicked", {
350
+ element: self,
351
+ });
352
+
353
+ if (!isFunction(callback)) {
354
+ return;
355
+ }
356
+
357
+ const element = findTargetElementFromEvent(
358
+ event,
359
+ ATTRIBUTE_ROLE,
360
+ "control",
361
+ );
362
+
363
+ if (!(element instanceof Node && self.hasNode(element))) {
364
+ return;
365
+ }
366
+
367
+ callback.call(self, event);
368
+ });
369
+
370
+ this[buttonNoThanksElementSymbol].setOption("actions.click", () => {
371
+ sessionStorage.setItem(buildStorageKey.call(this), "1");
372
+ this.hide();
373
+ if (this.getOption("features.removeOnSelected")) {
374
+ this.remove();
375
+ }
376
+ });
377
+
378
+ this[buttonLanguageElementSymbol].setOption("actions.click", () => {
379
+ sessionStorage.setItem(buildStorageKey.call(this), "1");
380
+ window.location.href = this[detectedLanguagesSymbol].offerable?.[0]?.href;
381
+ });
382
+
383
+ this[otherLanguagesElementSymbol].addEventListener("change", (event) => {
384
+ const element = findTargetElementFromEvent(
385
+ event,
386
+ ATTRIBUTE_ROLE,
387
+ "other-languages",
388
+ );
389
+
390
+ if (element) {
391
+ const selected = element?.value;
392
+ if (selected) {
393
+ sessionStorage.setItem(buildStorageKey.call(this), "1");
394
+ window.location.href = selected;
395
+ }
396
+ }
397
+ });
398
+
399
+ return this;
371
400
  }
372
401
 
373
402
  /**
374
403
  * @private
375
404
  * @returns {string}
405
+ * Builds the session storage key for the picker.
376
406
  */
377
407
  function buildStorageKey() {
378
- return "locale-picker-" + this[detectedLanguagesSymbol].current;
408
+ return "locale-picker-" + this[detectedLanguagesSymbol].current;
379
409
  }
380
410
 
381
411
  /**
382
412
  * @private
383
413
  * @param lang
384
414
  * @returns {Object}
415
+ * Returns translations for the given language.
385
416
  */
386
417
  function getTranslations(lang) {
387
- const map = {
388
- en: {
389
- headline: "Welcome to our Website",
390
- text: "This page is currently displayed in ${currentLabel}. However, we also offer this page in your preferred language. Would you like to switch?",
391
- "button-label": "Switch to ${preferred.label}",
392
- "button-no-thanks": "No, thanks",
393
- "headline-other": "Other languages",
394
- },
395
- de: {
396
- headline: "Willkommen auf unserer Webseite",
397
- text: "Diese Seite wird aktuell auf ${currentLabel} angezeigt. Wir bieten jedoch auch diese Seite in Ihrer bevorzugten Sprache an. Möchten Sie wechseln?",
398
- "button-label": "Wechseln zu ${preferred.label}",
399
- "button-no-thanks": "Nein, danke",
400
- "headline-other": "Andere Sprachen",
401
- },
402
- fr: {
403
- headline: "Bienvenue sur notre site web",
404
- text: "Cette page est actuellement affichée en ${currentLabel}. Cependant, nous proposons également cette page dans votre langue préférée. Souhaitez-vous changer?",
405
- "button-label": "Changer pour ${preferred.label}",
406
- "button-no-thanks": "Non, merci",
407
- "headline-other": "Autres langues",
408
- },
409
- es: {
410
- headline: "Bienvenido a nuestro sitio web",
411
- text: "Esta página se muestra actualmente en ${currentLabel}. Sin embargo, también ofrecemos esta página en su idioma preferido. ¿Le gustaría cambiar?",
412
- "button-label": "Cambiar a ${preferred.label}",
413
- "button-no-thanks": "No, gracias",
414
- "headline-other": "Otros idiomas",
415
- },
416
- it: {
417
- headline: "Benvenuti sul nostro sito web",
418
- text: "Questa pagina è attualmente visualizzata in ${currentLabel}. Tuttavia, offriamo anche questa pagina nella tua lingua preferita. Vuoi cambiare?",
419
- "button-label": "Cambia nella ${preferred.label}",
420
- "button-no-thanks": "No, grazie",
421
- "headline-other": "Altre lingue",
422
- },
423
- pt: {
424
- headline: "Bem-vindo ao nosso site",
425
- text: "Esta página está atualmente exibida em ${currentLabel}. No entanto, também oferecemos esta página no seu idioma preferido. Gostaria de mudar?",
426
- "button-label": "Mudar para ${preferred.label}",
427
- "button-no-thanks": "Não, obrigado",
428
- "headline-other": "Outros idiomas",
429
- },
430
- nl: {
431
- headline: "Welkom op onze website",
432
- text: "Deze pagina wordt momenteel weergegeven in ${currentLabel}. We bieden deze pagina echter ook aan in uw voorkeurstaal. Wilt u overschakelen?",
433
- "button-label": "Overschakelen naar ${preferred.label}",
434
- "button-no-thanks": "Nee, bedankt",
435
- "headline-other": "Andere talen",
436
- },
437
- pl: {
438
- headline: "Witamy na naszej stronie",
439
- text: "Ta strona jest obecnie wyświetlana po ${currentLabel}. Oferujemy jednak również tę stronę w Twoim preferowanym języku. Czy chcesz przełączyć?",
440
- "button-label": "Przełącz na ${preferred.label}",
441
- "button-no-thanks": "Nie, dziękuję",
442
- "headline-other": "Inne języki",
443
- },
444
- ru: {
445
- headline: "Добро пожаловать на наш сайт",
446
- text: "Эта страница в настоящее время отображается на ${currentLabel}. Однако мы также предлагаем эту страницу на вашем предпочтительном языке. Хотите переключиться?",
447
- "button-label": "Переключиться на ${preferred.label}",
448
- "button-no-thanks": "Нет, спасибо",
449
- "headline-other": "Другие языки",
450
- },
451
- cs: {
452
- headline: "Vítejte na našem webu",
453
- text: "Tato stránka je aktuálně zobrazena v ${currentLabel}. Nabízíme však tuto stránku také ve vašem preferovaném jazyce. Chcete přejít?",
454
- "button-label": "Přejít na ${preferred.label}",
455
- "button-no-thanks": "Ne, děkuji",
456
- "headline-other": "Další jazyky",
457
- },
458
- sk: {
459
- headline: "Vitajte na našej webovej stránke",
460
- text: "Táto stránka je v súčasnosti zobrazená v ${currentLabel}. Ponúkame však túto stránku aj vo vašom preferovanom jazyku. Chcete prejsť?",
461
- "button-label": "Prepnúť na ${preferred.label}",
462
- "button-no-thanks": "Nie, ďakujem",
463
- "headline-other": "Iné jazyky",
464
- },
465
-
466
- bg: {
467
- headline: "Добре дошли на нашия уебсайт",
468
- text: "Тази страница в момента се показва на ${currentLabel}. Въпреки това, предлагаме също тази страница на Вашия предпочитан език. Желаете ли да превключите?",
469
- "button-label": "Превключете на ${preferred.label}",
470
- "button-no-thanks": "Не, благодаря",
471
- "headline-other": "Други езици",
472
- },
473
- hr: {
474
- headline: "Dobrodošli na našu web stranicu",
475
- text: "Ova stranica trenutno je prikazana na ${currentLabel}. Međutim, nudimo i ovu stranicu na vašem preferiranom jeziku. Želite li prebaciti?",
476
- "button-label": "Prebaci na ${preferred.label}",
477
- "button-no-thanks": "Ne, hvala",
478
- "headline-other": "Drugi jezici",
479
- },
480
- fi: {
481
- headline: "Tervetuloa verkkosivustollemme",
482
- text: "Tämä sivu on tällä hetkellä näkyvissä ${currentLabel}. Tarjoamme kuitenkin tätä sivua myös suosimallasi kielellä. Haluaisitko vaihtaa?",
483
- "button-label": "Vaihda ${preferred.label}",
484
- "button-no-thanks": "Ei kiitos",
485
- "headline-other": "Muut kielet",
486
- },
487
- sv: {
488
- headline: "Välkommen till vår webbplats",
489
- text: "Denna sida visas för närvarande på ${currentLabel}. Vi erbjuder dock även denna sida på ditt föredragna språk. Skulle du vilja byta?",
490
- "button-label": "Byt till ${preferred.label}",
491
- "button-no-thanks": "Nej tack",
492
- "headline-other": "Andra språk",
493
- },
494
- el: {
495
- headline: "Καλώς ήρθατε στην ιστοσελίδα μας",
496
- text: "Αυτή η σελίδα εμφανίζεται προς το παρόν στα ${currentLabel}. Ωστόσο, προσφέρουμε επίσης αυτή τη σελίδα στην προτιμώμενη γλώσσα σας. Θα θέλατε να αλλάξετε;",
497
- "button-label": "Αλλαγή σε ${preferred.label}",
498
- "button-no-thanks": "Όχι, ευχαριστώ",
499
- "headline-other": "Άλλες γλώσσες",
500
- },
501
- hu: {
502
- headline: "Üdvözöljük weboldalunkon",
503
- text: "Ez az oldal jelenleg ${currentLabel} nyelven jelenik meg. Azonban kínáljuk ezt az oldalt a preferált nyelvén is. Szeretne váltani?",
504
- "button-label": "Váltás ${preferred.label} nyelvre",
505
- "button-no-thanks": "Nem, köszönöm",
506
- "headline-other": "További nyelvek",
507
- },
508
- ro: {
509
- headline: "Bine ați venit pe site-ul nostru",
510
- text: "Această pagină este afișată în prezent în ${currentLabel}. Totuși, oferim de asemenea această pagină în limba dumneavoastră preferată. Doriți să schimbați?",
511
- "button-label": "Schimbați în ${preferred.label}",
512
- "button-no-thanks": "Nu, mulțumesc",
513
- "headline-other": "Alte limbi",
514
- },
515
- da: {
516
- headline: "Velkommen til vores hjemmeside",
517
- text: "Denne side vises i øjeblikket på ${currentLabel}. Vi tilbyder dog også denne side på dit foretrukne sprog. Vil du skifte?",
518
- "button-label": "Skift til ${preferred.label}",
519
- "button-no-thanks": "Nej tak",
520
- "headline-other": "Andre sprog",
521
- },
522
- no: {
523
- headline: "Velkommen til vår nettside",
524
- text: "Denne siden vises for øyeblikket på ${currentLabel}. Vi tilbyr imidlertid også denne siden på ditt foretrukne språk. Ønsker du å bytte?",
525
- "button-label": "Bytt til ${preferred.label}",
526
- "button-no-thanks": "Nei, takk",
527
- "headline-other": "Andre språk",
528
- },
529
- hi: {
530
- headline: "हमारी वेबसाइट पर आपका स्वागत है",
531
- text: "यह पृष्ठ वर्तमान में ${currentLabel} में प्रदर्शित हो रहा है। हालांकि, हम इस पृष्ठ को आपकी पसंदीदा भाषा में भी प्रदान करते हैं। क्या आप स्विच करना चाहेंगे?",
532
- "button-label": "${preferred.label} में स्विच करें",
533
- "button-no-thanks": "नहीं, धन्यवाद",
534
- "headline-other": "अन्य भाषाएँ",
535
- },
536
- bn: {
537
- headline: "আমাদের ওয়েবসাইটে আপনাকে স্বাগতম",
538
- text: "এই পৃষ্ঠাটি বর্তমানে ${currentLabel} প্রদর্শিত হচ্ছে। তবে, আমরা এই পৃষ্ঠাটি আপনার পছন্দের ভাষায়ও অফার করি। আপনি কি সুইচ করতে চান?",
539
- "button-label": "${preferred.label}-এ সুইচ করুন",
540
- "button-no-thanks": "না, ধন্যবাদ",
541
- "headline-other": "অন্যান্য ভাষাসমূহ",
542
- },
543
- ta: {
544
- headline: "எங்கள் இணையதளத்திற்கு வருக",
545
- text: "இந்த பக்கம் தற்போது ${currentLabel} என்ற மொழியில் காட்சியளிக்கப்படுகிறது. எனினும், நாங்கள் இந்த பக்கத்தை உங்கள் விருப்ப மொழியிலும் வழங்குகிறோம். நீங்கள் மாற்ற விரும்புகிறீர்களா?",
546
- "button-label": "${preferred.label}-க்கு மாற்றவும்",
547
- "button-no-thanks": "இல்லை, நன்றி",
548
- "headline-other": "மற்ற மொழிகள்",
549
- },
550
- te: {
551
- headline: "మా వెబ్‌సైట్‌కు స్వాగతం",
552
- text: "ఈ పేజీ ప్రస్తుతం ${currentLabel}లో ప్రదర్శితం అవుతున్నది. అయితే, మేము ఈ పేజీని మీ ఇష్టపడే భాషలో కూడా అందిస్తున్నాము. మీరు మార్చాలనుకుంటున్నారా?",
553
- "button-label": "${preferred.label}కి మార్చండి",
554
- "button-no-thanks": "కాదు, ధన్యవాదాలు",
555
- "headline-other": "ఇతర భాషలు",
556
- },
557
- mr: {
558
- headline: "आपले आमच्या वेबसाइटवर स्वागत आहे",
559
- text: "हे पान सध्या ${currentLabel}मध्ये दाखविले जात आहे. परंतु, आम्ही हे पान आपल्या पसंतीच्या भाषेतही देत आहोत. आपण स्विच करू इच्छिता का?",
560
- "button-label": "${preferred.label}मध्ये स्विच करा",
561
- "button-no-thanks": "नाही, धन्यवाद",
562
- "headline-other": "इतर भाषा",
563
- },
564
- zh: {
565
- headline: "欢迎访问我们的网站",
566
- text: "本页面当前显示为${currentLabel}。然而,我们还提供您偏好的语言版本。您想切换吗?",
567
- "button-label": "切换到${preferred.label}",
568
- "button-no-thanks": "不,谢谢",
569
- "headline-other": "其他语言",
570
- },
571
- ja: {
572
- headline: "私たちのウェブサイトへようこそ",
573
- text: "このページは現在${currentLabel}で表示されています。しかし、私たちはあなたの好みの言語でこのページを提供しています。切り替えますか?",
574
- "button-label": "${preferred.label}に切り替える",
575
- "button-no-thanks": "いいえ、結構です",
576
- "headline-other": "他の言語",
577
- },
578
- };
579
-
580
- const selectAnOption = {
581
- en: "Select a language",
582
- de: "Wählen Sie eine Sprache",
583
- fr: "Sélectionnez une langue",
584
- es: "Seleccione un idioma",
585
- it: "Seleziona una lingua",
586
- pt: "Selecione um idioma",
587
- nl: "Selecteer een taal",
588
- pl: "Wybierz język",
589
- ru: "Выберите язык",
590
- cs: "Vyberte jazyk",
591
- sk: "Vyberte jazyk",
592
- bg: "Изберете език",
593
- hr: "Odaberite jezik",
594
- fi: "Valitse kieli",
595
- sv: "Välj ett språk",
596
- el: "Επιλέξτε γλώσσα",
597
- hu: "Válasszon egy nyelvet",
598
- ro: "Selectați o limbă",
599
- da: "Vælg et sprog",
600
- no: "Velg et språk",
601
- hi: "एक भाषा चुनें",
602
- bn: "একটি ভাষা নির্বাচন করুন",
603
- ta: "ஒரு மொழியைத் தேர்ந்தெடுக்கவும்",
604
- te: "భాషను ఎంచుకోండి",
605
- mr: "एक भाषा निवडा",
606
- zh: "选择一种语言",
607
- ja: "言語を選択してください",
608
- };
609
-
610
- const result = {};
611
-
612
- if (map[lang]) {
613
- result["labels"] = map[lang];
614
- } else {
615
- result["labels"] = map["en"];
616
- }
617
-
618
- if (selectAnOption[lang]) {
619
- result["selectAnOption"] = selectAnOption[lang];
620
- } else {
621
- result["selectAnOption"] = selectAnOption["en"];
622
- }
623
-
624
- return result;
625
- }
626
-
627
- /**
628
- * @private
629
- * @return {void}
630
- */
631
- function initControlReferences() {
632
- this[localePickerElementSymbol] = this.shadowRoot.querySelector(
633
- `[${ATTRIBUTE_ROLE}="control"]`,
634
- );
635
-
636
- this[otherLanguagesElementSymbol] = this.shadowRoot.querySelector(
637
- `[${ATTRIBUTE_ROLE}="other-languages"]`,
638
- );
639
-
640
- this[buttonNoThanksElementSymbol] = this.shadowRoot.querySelector(
641
- `[${ATTRIBUTE_ROLE}="button-no-thanks"]`,
642
- );
643
-
644
- this[buttonLanguageElementSymbol] = this.shadowRoot.querySelector(
645
- `[${ATTRIBUTE_ROLE}="button-language"]`,
646
- );
418
+ const map = {
419
+ en: {
420
+ headline: "Welcome to our Website",
421
+ text: "This page is currently displayed in ${currentLabel}. However, we also offer this page in your preferred language. Would you like to switch?",
422
+ "button-label": "Switch to ${preferred.label}",
423
+ "button-no-thanks": "No, thanks",
424
+ "headline-other": "Other languages",
425
+ },
426
+ de: {
427
+ headline: "Willkommen auf unserer Webseite",
428
+ text: "Diese Seite wird aktuell auf ${currentLabel} angezeigt. Wir bieten jedoch auch diese Seite in Ihrer bevorzugten Sprache an. Möchten Sie wechseln?",
429
+ "button-label": "Wechseln zu ${preferred.label}",
430
+ "button-no-thanks": "Nein, danke",
431
+ "headline-other": "Andere Sprachen",
432
+ },
433
+ fr: {
434
+ headline: "Bienvenue sur notre site web",
435
+ text: "Cette page est actuellement affichée en ${currentLabel}. Cependant, nous proposons également cette page dans votre langue préférée. Souhaitez-vous changer?",
436
+ "button-label": "Changer pour ${preferred.label}",
437
+ "button-no-thanks": "Non, merci",
438
+ "headline-other": "Autres langues",
439
+ },
440
+ es: {
441
+ headline: "Bienvenido a nuestro sitio web",
442
+ text: "Esta página se muestra actualmente en ${currentLabel}. Sin embargo, también ofrecemos esta página en su idioma preferido. ¿Le gustaría cambiar?",
443
+ "button-label": "Cambiar a ${preferred.label}",
444
+ "button-no-thanks": "No, gracias",
445
+ "headline-other": "Otros idiomas",
446
+ },
447
+ it: {
448
+ headline: "Benvenuti sul nostro sito web",
449
+ text: "Questa pagina è attualmente visualizzata in ${currentLabel}. Tuttavia, offriamo anche questa pagina nella tua lingua preferita. Vuoi cambiare?",
450
+ "button-label": "Cambia nella ${preferred.label}",
451
+ "button-no-thanks": "No, grazie",
452
+ "headline-other": "Altre lingue",
453
+ },
454
+ pt: {
455
+ headline: "Bem-vindo ao nosso site",
456
+ text: "Esta página está atualmente exibida em ${currentLabel}. No entanto, também oferecemos esta página no seu idioma preferido. Gostaria de mudar?",
457
+ "button-label": "Mudar para ${preferred.label}",
458
+ "button-no-thanks": "Não, obrigado",
459
+ "headline-other": "Outros idiomas",
460
+ },
461
+ nl: {
462
+ headline: "Welkom op onze website",
463
+ text: "Deze pagina wordt momenteel weergegeven in ${currentLabel}. We bieden deze pagina echter ook aan in uw voorkeurstaal. Wilt u overschakelen?",
464
+ "button-label": "Overschakelen naar ${preferred.label}",
465
+ "button-no-thanks": "Nee, bedankt",
466
+ "headline-other": "Andere talen",
467
+ },
468
+ pl: {
469
+ headline: "Witamy na naszej stronie",
470
+ text: "Ta strona jest obecnie wyświetlana po ${currentLabel}. Oferujemy jednak również tę stronę w Twoim preferowanym języku. Czy chcesz przełączyć?",
471
+ "button-label": "Przełącz na ${preferred.label}",
472
+ "button-no-thanks": "Nie, dziękuję",
473
+ "headline-other": "Inne języki",
474
+ },
475
+ ru: {
476
+ headline: "Добро пожаловать на наш сайт",
477
+ text: "Эта страница в настоящее время отображается на ${currentLabel}. Однако мы также предлагаем эту страницу на вашем предпочтительном языке. Хотите переключиться?",
478
+ "button-label": "Переключиться на ${preferred.label}",
479
+ "button-no-thanks": "Нет, спасибо",
480
+ "headline-other": "Другие языки",
481
+ },
482
+ cs: {
483
+ headline: "Vítejte na našem webu",
484
+ text: "Tato stránka je aktuálně zobrazena v ${currentLabel}. Nabízíme však tuto stránku také ve vašem preferovaném jazyce. Chcete přejít?",
485
+ "button-label": "Přejít na ${preferred.label}",
486
+ "button-no-thanks": "Ne, děkuji",
487
+ "headline-other": "Další jazyky",
488
+ },
489
+ sk: {
490
+ headline: "Vitajte na našej webovej stránke",
491
+ text: "Táto stránka je v súčasnosti zobrazená v ${currentLabel}. Ponúkame však túto stránku aj vo vašom preferovanom jazyku. Chcete prejsť?",
492
+ "button-label": "Prepnúť na ${preferred.label}",
493
+ "button-no-thanks": "Nie, ďakujem",
494
+ "headline-other": "Iné jazyky",
495
+ },
496
+
497
+ bg: {
498
+ headline: "Добре дошли на нашия уебсайт",
499
+ text: "Тази страница в момента се показва на ${currentLabel}. Въпреки това, предлагаме също тази страница на Вашия предпочитан език. Желаете ли да превключите?",
500
+ "button-label": "Превключете на ${preferred.label}",
501
+ "button-no-thanks": "Не, благодаря",
502
+ "headline-other": "Други езици",
503
+ },
504
+ hr: {
505
+ headline: "Dobrodošli na našu web stranicu",
506
+ text: "Ova stranica trenutno je prikazana na ${currentLabel}. Međutim, nudimo i ovu stranicu na vašem preferiranom jeziku. Želite li prebaciti?",
507
+ "button-label": "Prebaci na ${preferred.label}",
508
+ "button-no-thanks": "Ne, hvala",
509
+ "headline-other": "Drugi jezici",
510
+ },
511
+ fi: {
512
+ headline: "Tervetuloa verkkosivustollemme",
513
+ text: "Tämä sivu on tällä hetkellä näkyvissä ${currentLabel}. Tarjoamme kuitenkin tätä sivua myös suosimallasi kielellä. Haluaisitko vaihtaa?",
514
+ "button-label": "Vaihda ${preferred.label}",
515
+ "button-no-thanks": "Ei kiitos",
516
+ "headline-other": "Muut kielet",
517
+ },
518
+ sv: {
519
+ headline: "Välkommen till vår webbplats",
520
+ text: "Denna sida visas för närvarande på ${currentLabel}. Vi erbjuder dock även denna sida på ditt föredragna språk. Skulle du vilja byta?",
521
+ "button-label": "Byt till ${preferred.label}",
522
+ "button-no-thanks": "Nej tack",
523
+ "headline-other": "Andra språk",
524
+ },
525
+ el: {
526
+ headline: "Καλώς ήρθατε στην ιστοσελίδα μας",
527
+ text: "Αυτή η σελίδα εμφανίζεται προς το παρόν στα ${currentLabel}. Ωστόσο, προσφέρουμε επίσης αυτή τη σελίδα στην προτιμώμενη γλώσσα σας. Θα θέλατε να αλλάξετε;",
528
+ "button-label": "Αλλαγή σε ${preferred.label}",
529
+ "button-no-thanks": "Όχι, ευχαριστώ",
530
+ "headline-other": "Άλλες γλώσσες",
531
+ },
532
+ hu: {
533
+ headline: "Üdvözöljük weboldalunkon",
534
+ text: "Ez az oldal jelenleg ${currentLabel} nyelven jelenik meg. Azonban kínáljuk ezt az oldalt a preferált nyelvén is. Szeretne váltani?",
535
+ "button-label": "Váltás ${preferred.label} nyelvre",
536
+ "button-no-thanks": "Nem, köszönöm",
537
+ "headline-other": "További nyelvek",
538
+ },
539
+ ro: {
540
+ headline: "Bine ați venit pe site-ul nostru",
541
+ text: "Această pagină este afișată în prezent în ${currentLabel}. Totuși, oferim de asemenea această pagină în limba dumneavoastră preferată. Doriți să schimbați?",
542
+ "button-label": "Schimbați în ${preferred.label}",
543
+ "button-no-thanks": "Nu, mulțumesc",
544
+ "headline-other": "Alte limbi",
545
+ },
546
+ da: {
547
+ headline: "Velkommen til vores hjemmeside",
548
+ text: "Denne side vises i øjeblikket på ${currentLabel}. Vi tilbyder dog også denne side på dit foretrukne sprog. Vil du skifte?",
549
+ "button-label": "Skift til ${preferred.label}",
550
+ "button-no-thanks": "Nej tak",
551
+ "headline-other": "Andre sprog",
552
+ },
553
+ no: {
554
+ headline: "Velkommen til vår nettside",
555
+ text: "Denne siden vises for øyeblikket på ${currentLabel}. Vi tilbyr imidlertid også denne siden på ditt foretrukne språk. Ønsker du å bytte?",
556
+ "button-label": "Bytt til ${preferred.label}",
557
+ "button-no-thanks": "Nei, takk",
558
+ "headline-other": "Andre språk",
559
+ },
560
+ hi: {
561
+ headline: "हमारी वेबसाइट पर आपका स्वागत है",
562
+ text: "यह पृष्ठ वर्तमान में ${currentLabel} में प्रदर्शित हो रहा है। हालांकि, हम इस पृष्ठ को आपकी पसंदीदा भाषा में भी प्रदान करते हैं। क्या आप स्विच करना चाहेंगे?",
563
+ "button-label": "${preferred.label} में स्विच करें",
564
+ "button-no-thanks": "नहीं, धन्यवाद",
565
+ "headline-other": "अन्य भाषाएँ",
566
+ },
567
+ bn: {
568
+ headline: "আমাদের ওয়েবসাইটে আপনাকে স্বাগতম",
569
+ text: "এই পৃষ্ঠাটি বর্তমানে ${currentLabel} প্রদর্শিত হচ্ছে। তবে, আমরা এই পৃষ্ঠাটি আপনার পছন্দের ভাষায়ও অফার করি। আপনি কি সুইচ করতে চান?",
570
+ "button-label": "${preferred.label}-এ সুইচ করুন",
571
+ "button-no-thanks": "না, ধন্যবাদ",
572
+ "headline-other": "অন্যান্য ভাষাসমূহ",
573
+ },
574
+ ta: {
575
+ headline: "எங்கள் இணையதளத்திற்கு வருக",
576
+ text: "இந்த பக்கம் தற்போது ${currentLabel} என்ற மொழியில் காட்சியளிக்கப்படுகிறது. எனினும், நாங்கள் இந்த பக்கத்தை உங்கள் விருப்ப மொழியிலும் வழங்குகிறோம். நீங்கள் மாற்ற விரும்புகிறீர்களா?",
577
+ "button-label": "${preferred.label}-க்கு மாற்றவும்",
578
+ "button-no-thanks": "இல்லை, நன்றி",
579
+ "headline-other": "மற்ற மொழிகள்",
580
+ },
581
+ te: {
582
+ headline: "మా వెబ్‌సైట్‌కు స్వాగతం",
583
+ text: "ఈ పేజీ ప్రస్తుతం ${currentLabel}లో ప్రదర్శితం అవుతున్నది. అయితే, మేము ఈ పేజీని మీ ఇష్టపడే భాషలో కూడా అందిస్తున్నాము. మీరు మార్చాలనుకుంటున్నారా?",
584
+ "button-label": "${preferred.label}కి మార్చండి",
585
+ "button-no-thanks": "కాదు, ధన్యవాదాలు",
586
+ "headline-other": "ఇతర భాషలు",
587
+ },
588
+ mr: {
589
+ headline: "आपले आमच्या वेबसाइटवर स्वागत आहे",
590
+ text: "हे पान सध्या ${currentLabel}मध्ये दाखविले जात आहे. परंतु, आम्ही हे पान आपल्या पसंतीच्या भाषेतही देत आहोत. आपण स्विच करू इच्छिता का?",
591
+ "button-label": "${preferred.label}मध्ये स्विच करा",
592
+ "button-no-thanks": "नाही, धन्यवाद",
593
+ "headline-other": "इतर भाषा",
594
+ },
595
+ zh: {
596
+ headline: "欢迎访问我们的网站",
597
+ text: "本页面当前显示为${currentLabel}。然而,我们还提供您偏好的语言版本。您想切换吗?",
598
+ "button-label": "切换到${preferred.label}",
599
+ "button-no-thanks": "不,谢谢",
600
+ "headline-other": "其他语言",
601
+ },
602
+ ja: {
603
+ headline: "私たちのウェブサイトへようこそ",
604
+ text: "このページは現在${currentLabel}で表示されています。しかし、私たちはあなたの好みの言語でこのページを提供しています。切り替えますか?",
605
+ "button-label": "${preferred.label}に切り替える",
606
+ "button-no-thanks": "いいえ、結構です",
607
+ "headline-other": "他の言語",
608
+ },
609
+ };
610
+
611
+ const selectAnOption = {
612
+ en: "Select a language",
613
+ de: "Wählen Sie eine Sprache",
614
+ fr: "Sélectionnez une langue",
615
+ es: "Seleccione un idioma",
616
+ it: "Seleziona una lingua",
617
+ pt: "Selecione um idioma",
618
+ nl: "Selecteer een taal",
619
+ pl: "Wybierz język",
620
+ ru: "Выберите язык",
621
+ cs: "Vyberte jazyk",
622
+ sk: "Vyberte jazyk",
623
+ bg: "Изберете език",
624
+ hr: "Odaberite jezik",
625
+ fi: "Valitse kieli",
626
+ sv: "Välj ett språk",
627
+ el: "Επιλέξτε γλώσσα",
628
+ hu: "Válasszon egy nyelvet",
629
+ ro: "Selectați o limbă",
630
+ da: "Vælg et sprog",
631
+ no: "Velg et språk",
632
+ hi: "एक भाषा चुनें",
633
+ bn: "একটি ভাষা নির্বাচন করুন",
634
+ ta: "ஒரு மொழியைத் தேர்ந்தெடுக்கவும்",
635
+ te: "భాషను ఎంచుకోండి",
636
+ mr: "एक भाषा निवडा",
637
+ zh: "选择一种语言",
638
+ ja: "言語を選択してください",
639
+ };
640
+
641
+ const result = {};
642
+
643
+ if (map[lang]) {
644
+ result["labels"] = map[lang];
645
+ } else {
646
+ result["labels"] = map["en"];
647
+ }
648
+
649
+ if (selectAnOption[lang]) {
650
+ result["selectAnOption"] = selectAnOption[lang];
651
+ } else {
652
+ result["selectAnOption"] = selectAnOption["en"];
653
+ }
654
+
655
+ return result;
647
656
  }
648
657
 
649
658
  /**
650
659
  * @private
651
660
  * @return {string}
661
+ * Returns the template for the component.
652
662
  */
653
663
  function getTemplate() {
654
- // language=HTML
655
- return `
664
+ // language=HTML
665
+ return `
656
666
  <div data-monster-role="control" part="control">
657
667
  <h2 data-monster-role="headline" part="headline" data-monster-replace="path:labels.headline"></h2>
658
- <p data-monster-replace="path:labels.text | call:replace-placeholder"></p>
668
+ <p part="text" data-monster-replace="path:labels.text | call:replace-placeholder"></p>
659
669
  <div data-monster-role="container" part="container">
660
- <monster-button data-monster-role="button-language"
670
+ <monster-button data-monster-role="button-language" part="button-language"
661
671
  data-monster-replace="path:labels.button-label | call:replace-placeholder"></monster-button>
662
- <monster-button data-monster-role="button-no-thanks"
672
+ <monster-button data-monster-role="button-no-thanks" part="button-no-thanks"
663
673
  data-monster-replace="path:labels.button-no-thanks | call:replace-placeholder"></monster-button>
664
674
  <monster-select class="hidden" data-monster-role="other-languages"></monster-select>
665
675
  </div>