@luftborn/custom-elements 2.12.3 → 2.12.5

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.
package/demo/index.min.js CHANGED
@@ -4940,6 +4940,9 @@ var CustomFormatDateFieldElement = /** @class */ (function (_super) {
4940
4940
  CustomFormatDateFieldElement.prototype.initChildInputs = function () {
4941
4941
  var _a;
4942
4942
  this.date = _super.prototype.getChildInput.call(this, '#date-field');
4943
+ if (!this.date) {
4944
+ return;
4945
+ }
4943
4946
  this.date.id = "date-field-" + Date.now();
4944
4947
  this.pickerTrigger = this.getChildElement('#picker-trigger');
4945
4948
  this.dateFormat = CustomDatepickerUtils_1.supportedDateFormats.includes(this.dateFormat) ? this.dateFormat : CustomDatepickerUtils_1.defaultDateFormat;
@@ -7905,92 +7908,34 @@ var Translator = /** @class */ (function () {
7905
7908
  }
7906
7909
  Translator.Translate = function (key, language) {
7907
7910
  if (language === void 0) { language = 'da'; }
7908
- language = language.toLowerCase();
7909
- var isSupportedLanguage = Translator.langauges.indexOf(language) != -1;
7911
+ var isSupportedLanguage = Object.keys(this.languaeDictionaries).includes(language);
7910
7912
  if (!isSupportedLanguage) {
7911
7913
  language = 'da';
7912
7914
  }
7913
- switch (language) {
7914
- case 'da':
7915
- return this.danishDictionary.get(key);
7916
- case 'en':
7917
- return this.englishDictionary.get(key);
7918
- case 'cs':
7919
- return this.czechDictionary.get(key);
7920
- case 'de':
7921
- return this.germanDictionary.get(key);
7922
- case 'el':
7923
- return this.greekDictionary.get(key);
7924
- case 'es':
7925
- return this.spanishDictionary.get(key);
7926
- case 'et':
7927
- return this.estonianDictionary.get(key);
7928
- case 'fi':
7929
- return this.finnishDictionary.get(key);
7930
- case 'fr':
7931
- return this.frenchDictionary.get(key);
7932
- case 'hu':
7933
- return this.hungarianDictionary.get(key);
7934
- case 'is':
7935
- return this.icelandicDictionary.get(key);
7936
- case 'it':
7937
- return this.italianDictionary.get(key);
7938
- case 'lt':
7939
- return this.latvianDictionary.get(key);
7940
- case 'lv':
7941
- return this.lituanianDictionary.get(key);
7942
- case 'nl':
7943
- return this.dutchDictionary.get(key);
7944
- case 'no':
7945
- return this.norwegianDictionary.get(key);
7946
- case 'pl':
7947
- return this.polishDictionary.get(key);
7948
- case 'pt':
7949
- return this.portugueseDictionary.get(key);
7950
- case 'sv':
7951
- return this.swedishDictionary.get(key);
7952
- }
7953
- };
7954
- Translator.langauges = [
7955
- 'en',
7956
- 'da',
7957
- 'cs',
7958
- 'de',
7959
- 'el',
7960
- 'es',
7961
- 'et',
7962
- 'fi',
7963
- 'fr',
7964
- 'hu',
7965
- 'is',
7966
- 'it',
7967
- 'lt',
7968
- 'lv',
7969
- 'nl',
7970
- 'no',
7971
- 'pl',
7972
- 'pt',
7973
- 'sv',
7974
- ];
7975
- Translator.danishDictionary = new DanishDictionary_1.default();
7976
- Translator.englishDictionary = new EnglishDictionary_1.default();
7977
- Translator.czechDictionary = new CzechDictionary_1.default();
7978
- Translator.germanDictionary = new GermanDictionary_1.default();
7979
- Translator.greekDictionary = new GreekDictionary_1.default();
7980
- Translator.spanishDictionary = new SpanishDictionary_1.default();
7981
- Translator.estonianDictionary = new EstonianDictionary_1.default();
7982
- Translator.finnishDictionary = new FinnishDictionary_1.default();
7983
- Translator.frenchDictionary = new FrenchDictionary_1.default();
7984
- Translator.hungarianDictionary = new HungarianDictionary_1.default();
7985
- Translator.icelandicDictionary = new IcelandicDictionary_1.default();
7986
- Translator.italianDictionary = new ItalianDictionary_1.default();
7987
- Translator.latvianDictionary = new LatvianDictionary_1.default();
7988
- Translator.lituanianDictionary = new LituanianDictionary_1.default();
7989
- Translator.dutchDictionary = new DutchDictionary_1.default();
7990
- Translator.norwegianDictionary = new NorwegianDictionary_1.default();
7991
- Translator.polishDictionary = new PolishDictionary_1.default();
7992
- Translator.portugueseDictionary = new PortugueseDictionary_1.default();
7993
- Translator.swedishDictionary = new SwedishDictionary_1.default();
7915
+ var dictionary = this.languaeDictionaries[language];
7916
+ return dictionary.get(key);
7917
+ };
7918
+ Translator.languaeDictionaries = {
7919
+ 'da': new DanishDictionary_1.default(),
7920
+ 'en': new EnglishDictionary_1.default(),
7921
+ 'cs': new CzechDictionary_1.default(),
7922
+ 'de': new GermanDictionary_1.default(),
7923
+ 'el': new GreekDictionary_1.default(),
7924
+ 'es': new SpanishDictionary_1.default(),
7925
+ 'et': new EstonianDictionary_1.default(),
7926
+ 'fi': new FinnishDictionary_1.default(),
7927
+ 'fr': new FrenchDictionary_1.default(),
7928
+ 'hu': new HungarianDictionary_1.default(),
7929
+ 'is': new IcelandicDictionary_1.default(),
7930
+ 'it': new ItalianDictionary_1.default(),
7931
+ 'lv': new LatvianDictionary_1.default(),
7932
+ 'lt': new LituanianDictionary_1.default(),
7933
+ 'nl': new DutchDictionary_1.default(),
7934
+ 'no': new NorwegianDictionary_1.default(),
7935
+ 'pl': new PolishDictionary_1.default(),
7936
+ 'pt': new PortugueseDictionary_1.default(),
7937
+ 'sv': new SwedishDictionary_1.default(),
7938
+ };
7994
7939
  return Translator;
7995
7940
  }());
7996
7941
  exports.default = Translator;