@everymatrix/casino-tournaments-limited-controller 1.39.0 → 1.39.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-tournaments-limited-controller",
3
- "version": "1.39.0",
3
+ "version": "1.39.1",
4
4
  "main": "dist/casino-tournaments-limited-controller.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "d3dbfca9fcdc2d9df9a01f60f283ed699ec828fb"
38
+ "gitHead": "cc6e3a021c852cb2734662bef9ef45190de4bfa9"
39
39
  }
@@ -11,7 +11,7 @@
11
11
  matchStatusFromApiToView,
12
12
  } from "./util";
13
13
 
14
- import { setLocale, setLocaleWhenInit, _ } from './i18n'
14
+ import { setLocale, setLocaleWhenInit, _, addNewMessages } from './i18n'
15
15
 
16
16
  import {
17
17
  onMountMessageLifeCycle,
@@ -37,6 +37,21 @@
37
37
 
38
38
  export let clientstyling:string = '';
39
39
  export let clientstylingurl:string = '';
40
+ export let translationurl:string = '';
41
+
42
+ const setTranslationUrl = ():void => {
43
+ let url:string = translationurl;
44
+
45
+ fetch(url).then((res:any) => res.json())
46
+ .then((res) => {
47
+ Object.keys(res).forEach((item:any):void => {
48
+ addNewMessages(item, res[item]);
49
+ });
50
+ setTabTexts();
51
+ }).catch((err:any) => {
52
+ console.log(err);
53
+ });
54
+ }
40
55
 
41
56
  let customStylingContainer: HTMLElement;
42
57
  let displayNone:boolean = false;
@@ -185,10 +200,10 @@
185
200
 
186
201
  const setTabTexts = () => {
187
202
  setTimeout(() => {
188
- const text = TRANSLATIONS[lang]['tournamentsLimitedController']
189
- postMessageTabLocaleTextUpdate('Scheduled', text['Scheduled'])
190
- postMessageTabLocaleTextUpdate('Ongoing', text['Ongoing'])
191
- postMessageTabLocaleTextUpdate('Finished', `${text[`Finished`]} (${text['last']} 48h)`)
203
+ const getText = (key) => $_(`tournamentsLimitedController.${key}`)
204
+ postMessageTabLocaleTextUpdate('Scheduled', getText('Scheduled'))
205
+ postMessageTabLocaleTextUpdate('Ongoing', getText('Ongoing'))
206
+ postMessageTabLocaleTextUpdate('Finished', `${getText(`Finished`)} (${getText('last')} 48h)`)
192
207
  }, 1)
193
208
  }
194
209
 
@@ -207,6 +222,7 @@
207
222
  $: endpoint && filter && lang && session && init();
208
223
  $: clientstyling && customStylingContainer && setClientStyling();
209
224
  $: clientstylingurl && customStylingContainer && setClientStylingURL();
225
+ $: translationurl && setTranslationUrl();
210
226
 
211
227
  $: lang && setTabTexts()
212
228