@tolgee/core 4.9.0-rc.b7a4088.0 → 4.9.2

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 (148) hide show
  1. package/dist/Constants/Global.d.ts +0 -0
  2. package/dist/Constants/ModifierKey.d.ts +0 -0
  3. package/dist/Errors/ApiHttpError.d.ts +0 -0
  4. package/dist/Observer.d.ts +0 -0
  5. package/dist/Observer.test.d.ts +0 -0
  6. package/dist/Properties.d.ts +0 -0
  7. package/dist/Properties.test.d.ts +0 -0
  8. package/dist/Tolgee.d.ts +0 -0
  9. package/dist/Tolgee.test.d.ts +0 -0
  10. package/dist/TolgeeConfig.d.ts +0 -0
  11. package/dist/TolgeeConfig.test.d.ts +0 -0
  12. package/dist/__integration/FormatterIcu.test.d.ts +0 -0
  13. package/dist/__integration/FormatterMissing.d.ts +0 -0
  14. package/dist/__integration/Tolgee.test.d.ts +0 -0
  15. package/dist/__integration/TolgeeInvisible.test.d.ts +0 -0
  16. package/dist/__integration/mockTranslations.d.ts +0 -0
  17. package/dist/__integration/testConfig.d.ts +0 -0
  18. package/dist/__testFixtures/classMock.d.ts +0 -0
  19. package/dist/__testFixtures/createElement.d.ts +0 -0
  20. package/dist/__testFixtures/createTestDom.d.ts +0 -0
  21. package/dist/__testFixtures/mocked.d.ts +0 -0
  22. package/dist/__testFixtures/setupAfterEnv.d.ts +0 -0
  23. package/dist/helpers/NodeHelper.d.ts +0 -0
  24. package/dist/helpers/TextHelper.d.ts +0 -0
  25. package/dist/helpers/TextHelper.test.d.ts +0 -0
  26. package/dist/helpers/commonTypes.d.ts +0 -0
  27. package/dist/helpers/encoderPolyfill.d.ts +0 -0
  28. package/dist/helpers/secret.d.ts +0 -0
  29. package/dist/helpers/secret.test.d.ts +0 -0
  30. package/dist/helpers/sleep.d.ts +0 -0
  31. package/dist/highlighter/HighlightFunctionsInitializer.d.ts +0 -0
  32. package/dist/highlighter/HighlightFunctionsInitializer.test.d.ts +0 -0
  33. package/dist/highlighter/MouseEventHandler.d.ts +0 -0
  34. package/dist/highlighter/MouseEventHandler.test.d.ts +0 -0
  35. package/dist/highlighter/TranslationHighlighter.d.ts +0 -0
  36. package/dist/highlighter/TranslationHighlighter.test.d.ts +0 -0
  37. package/dist/index.d.ts +0 -0
  38. package/dist/internal.d.ts +0 -0
  39. package/dist/modules/IcuFormatter.d.ts +0 -0
  40. package/dist/modules/IcuFormatter.test.d.ts +1 -0
  41. package/dist/modules/index.d.ts +0 -0
  42. package/dist/services/ApiHttpService.d.ts +0 -0
  43. package/dist/services/CoreService.d.ts +0 -0
  44. package/dist/services/CoreService.test.d.ts +0 -0
  45. package/dist/services/DependencyService.d.ts +0 -0
  46. package/dist/services/DependencyService.test.d.ts +0 -0
  47. package/dist/services/ElementRegistrar.d.ts +0 -0
  48. package/dist/services/ElementRegistrar.test.d.ts +0 -0
  49. package/dist/services/EventEmitter.d.ts +0 -0
  50. package/dist/services/EventService.d.ts +0 -0
  51. package/dist/services/ModuleService.d.ts +0 -0
  52. package/dist/services/ScreenshotService.d.ts +0 -0
  53. package/dist/services/Subscription.d.ts +0 -0
  54. package/dist/services/TextService.d.ts +0 -0
  55. package/dist/services/TextService.test.d.ts +0 -0
  56. package/dist/services/TranslationService.d.ts +0 -0
  57. package/dist/services/TranslationService.test.d.ts +0 -0
  58. package/dist/services/__mocks__/CoreService.d.ts +0 -0
  59. package/dist/tolgee.cjs.js +23 -3
  60. package/dist/tolgee.cjs.js.map +1 -1
  61. package/dist/tolgee.cjs.min.js +1 -1
  62. package/dist/tolgee.cjs.min.js.map +1 -1
  63. package/dist/tolgee.esm.min.mjs +1 -1
  64. package/dist/tolgee.esm.min.mjs.map +1 -1
  65. package/dist/tolgee.esm.mjs +23 -3
  66. package/dist/tolgee.esm.mjs.map +1 -1
  67. package/dist/tolgee.umd.js +23 -3
  68. package/dist/tolgee.umd.js.map +1 -1
  69. package/dist/tolgee.umd.min.js +1 -1
  70. package/dist/tolgee.umd.min.js.map +1 -1
  71. package/dist/toolsManager/Messages.d.ts +0 -0
  72. package/dist/toolsManager/Messages.test.d.ts +0 -0
  73. package/dist/toolsManager/PluginManager.d.ts +0 -0
  74. package/dist/toolsManager/PluginManager.test.d.ts +0 -0
  75. package/dist/types/DTOs.d.ts +0 -0
  76. package/dist/types/apiSchema.generated.d.ts +0 -0
  77. package/dist/types.d.ts +0 -0
  78. package/dist/wrappers/AbstractWrapper.d.ts +0 -0
  79. package/dist/wrappers/NodeHandler.d.ts +0 -0
  80. package/dist/wrappers/WrappedHandler.d.ts +0 -0
  81. package/dist/wrappers/invisible/AttributeHandler.d.ts +0 -0
  82. package/dist/wrappers/invisible/Coder.d.ts +0 -0
  83. package/dist/wrappers/invisible/ContentHandler.d.ts +0 -0
  84. package/dist/wrappers/invisible/CoreHandler.d.ts +0 -0
  85. package/dist/wrappers/invisible/InvisibleWrapper.d.ts +0 -0
  86. package/dist/wrappers/invisible/ValueMemory.d.ts +0 -0
  87. package/dist/wrappers/invisible/ValueMemory.test.d.ts +0 -0
  88. package/dist/wrappers/text/AttributeHandler.d.ts +0 -0
  89. package/dist/wrappers/text/AttributeHandler.test.d.ts +0 -0
  90. package/dist/wrappers/text/Coder.d.ts +0 -0
  91. package/dist/wrappers/text/Coder.test.d.ts +0 -0
  92. package/dist/wrappers/text/ContentHandler.d.ts +0 -0
  93. package/dist/wrappers/text/ContentHandler.test.d.ts +0 -0
  94. package/dist/wrappers/text/CoreHandler.d.ts +0 -0
  95. package/dist/wrappers/text/CoreHandler.test.d.ts +0 -0
  96. package/dist/wrappers/text/TextWrapper.d.ts +0 -0
  97. package/lib/Constants/Global.d.ts +0 -0
  98. package/lib/Constants/ModifierKey.d.ts +0 -0
  99. package/lib/Errors/ApiHttpError.d.ts +0 -0
  100. package/lib/Observer.d.ts +0 -0
  101. package/lib/Properties.d.ts +0 -0
  102. package/lib/Tolgee.d.ts +0 -0
  103. package/lib/TolgeeConfig.d.ts +0 -0
  104. package/lib/helpers/NodeHelper.d.ts +0 -0
  105. package/lib/helpers/TextHelper.d.ts +0 -0
  106. package/lib/helpers/commonTypes.d.ts +0 -0
  107. package/lib/helpers/encoderPolyfill.d.ts +0 -0
  108. package/lib/helpers/secret.d.ts +0 -0
  109. package/lib/helpers/sleep.d.ts +0 -0
  110. package/lib/highlighter/HighlightFunctionsInitializer.d.ts +0 -0
  111. package/lib/highlighter/MouseEventHandler.d.ts +0 -0
  112. package/lib/highlighter/TranslationHighlighter.d.ts +0 -0
  113. package/lib/index.d.ts +0 -0
  114. package/lib/modules/IcuFormatter.d.ts +0 -0
  115. package/lib/modules/index.d.ts +0 -0
  116. package/lib/services/ApiHttpService.d.ts +0 -0
  117. package/lib/services/CoreService.d.ts +0 -0
  118. package/lib/services/DependencyService.d.ts +0 -0
  119. package/lib/services/ElementRegistrar.d.ts +0 -0
  120. package/lib/services/EventEmitter.d.ts +0 -0
  121. package/lib/services/EventService.d.ts +0 -0
  122. package/lib/services/ModuleService.d.ts +0 -0
  123. package/lib/services/ScreenshotService.d.ts +0 -0
  124. package/lib/services/Subscription.d.ts +0 -0
  125. package/lib/services/TextService.d.ts +0 -0
  126. package/lib/services/TranslationService.d.ts +0 -0
  127. package/lib/toolsManager/Messages.d.ts +0 -0
  128. package/lib/toolsManager/PluginManager.d.ts +0 -0
  129. package/lib/types/DTOs.d.ts +0 -0
  130. package/lib/types/apiSchema.generated.d.ts +0 -0
  131. package/lib/types.d.ts +0 -0
  132. package/lib/wrappers/AbstractWrapper.d.ts +0 -0
  133. package/lib/wrappers/NodeHandler.d.ts +0 -0
  134. package/lib/wrappers/WrappedHandler.d.ts +0 -0
  135. package/lib/wrappers/invisible/AttributeHandler.d.ts +0 -0
  136. package/lib/wrappers/invisible/Coder.d.ts +0 -0
  137. package/lib/wrappers/invisible/ContentHandler.d.ts +0 -0
  138. package/lib/wrappers/invisible/CoreHandler.d.ts +0 -0
  139. package/lib/wrappers/invisible/InvisibleWrapper.d.ts +0 -0
  140. package/lib/wrappers/invisible/ValueMemory.d.ts +0 -0
  141. package/lib/wrappers/text/AttributeHandler.d.ts +0 -0
  142. package/lib/wrappers/text/Coder.d.ts +0 -0
  143. package/lib/wrappers/text/ContentHandler.d.ts +0 -0
  144. package/lib/wrappers/text/CoreHandler.d.ts +0 -0
  145. package/lib/wrappers/text/TextWrapper.d.ts +0 -0
  146. package/package.json +2 -2
  147. package/src/modules/IcuFormatter.test.ts +21 -0
  148. package/src/modules/IcuFormatter.ts +24 -2
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/Tolgee.d.ts CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/index.d.ts CHANGED
File without changes
File without changes
File without changes
@@ -0,0 +1 @@
1
+ export {};
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1791,7 +1791,7 @@ var PluginManager = /** @class */ (function () {
1791
1791
  this.handshake = function () {
1792
1792
  var sharedConfiguration = __assign(__assign({}, _this.properties), { config: __assign(__assign({}, _this.properties.config), {
1793
1793
  //remove properties, which cannot be sent by window.postMessage
1794
- staticData: undefined, targetElement: undefined, _targetElement: undefined, ui: undefined }), uiPresent: Boolean(_this.properties.config.ui), uiVersion: "4.9.0-rc.b7a4088.0" });
1794
+ staticData: undefined, targetElement: undefined, _targetElement: undefined, ui: undefined }), uiPresent: Boolean(_this.properties.config.ui), uiVersion: "4.9.2" });
1795
1795
  var timer = null;
1796
1796
  var ping = function () {
1797
1797
  _this.messages.send('TOLGEE_READY', sharedConfiguration);
@@ -7116,12 +7116,32 @@ var IntlMessageFormat = IntlMessageFormat$1;
7116
7116
  var _a;
7117
7117
  var IcuFormatter = (_a = /** @class */ (function () {
7118
7118
  function class_1() {
7119
- this.cache = new Map();
7119
+ this.locales = new Map();
7120
7120
  }
7121
+ class_1.prototype.isLocaleValid = function (locale) {
7122
+ try {
7123
+ return Boolean(Intl.NumberFormat.supportedLocalesOf(locale).length);
7124
+ }
7125
+ catch (_a) {
7126
+ return false;
7127
+ }
7128
+ };
7129
+ class_1.prototype.getLocale = function (language) {
7130
+ if (!this.locales.get(language)) {
7131
+ var localeCandidate = String(language).replace(/[^a-zA-Z]/g, '-');
7132
+ while (!this.isLocaleValid(localeCandidate)) {
7133
+ localeCandidate =
7134
+ localeCandidate.split('-').slice(0, -1).join('-') || 'en';
7135
+ }
7136
+ this.locales.set(language, localeCandidate);
7137
+ }
7138
+ return this.locales.get(language);
7139
+ };
7121
7140
  class_1.prototype.format = function (_a) {
7122
7141
  var translation = _a.translation, language = _a.language, params = _a.params;
7123
7142
  var ignoreTag = !Object.values(params).find(function (p) { return typeof p === 'function'; });
7124
- return new IntlMessageFormat(translation, language, undefined, {
7143
+ var locale = this.getLocale(language);
7144
+ return new IntlMessageFormat(translation, locale, undefined, {
7125
7145
  ignoreTag: ignoreTag,
7126
7146
  }).format(params);
7127
7147
  };