@everymatrix/casino-categories-slider 1.12.5 → 1.12.7
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-categories-slider",
|
3
|
-
"version": "1.12.
|
3
|
+
"version": "1.12.7",
|
4
4
|
"main": "dist/casino-categories-slider.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": "
|
38
|
+
"gitHead": "7f8097b50f6a8794ce81f8961ed3efba1842a578"
|
39
39
|
}
|
@@ -3,7 +3,8 @@
|
|
3
3
|
<script lang="ts">
|
4
4
|
import { onMount, tick } from "svelte";
|
5
5
|
import { getDevice, checkSession } from 'rvhelper';
|
6
|
-
|
6
|
+
import { _, addNewMessages } from './i18n';
|
7
|
+
import { TRANSLATIONS } from './translations';
|
7
8
|
import type { CategoriesData, CategoriesItems } from './CasinoCategoriesSlider.types';
|
8
9
|
import '@everymatrix/casino-slider';
|
9
10
|
|
@@ -24,11 +25,15 @@
|
|
24
25
|
export let location:string = "secondaryMenu";
|
25
26
|
export let showsubgroups:string = 'false';
|
26
27
|
export let filteredcategories:string = '';
|
28
|
+
export let translationurl:string = '';
|
27
29
|
|
28
30
|
let identity:string = 'CasinoSliderData'
|
29
31
|
|
30
32
|
// Player logged-in/logged-out status & session
|
31
33
|
|
34
|
+
let myGamesTranslation:string;
|
35
|
+
let lobbyTranslation:string;
|
36
|
+
|
32
37
|
let isLoading:boolean = true;
|
33
38
|
let error:string;
|
34
39
|
|
@@ -45,13 +50,29 @@
|
|
45
50
|
|
46
51
|
$: numberOfFavoredGames = 0;
|
47
52
|
|
53
|
+
const setTranslationUrl = ():void => {
|
54
|
+
let url:string = translationurl;
|
55
|
+
|
56
|
+
fetch(url).then((res:any) => res.json())
|
57
|
+
.then((res) => {
|
58
|
+
Object.keys(res).forEach((item:any):void => {
|
59
|
+
addNewMessages(item, res[item]);
|
60
|
+
});
|
61
|
+
}).catch((err:any) => {
|
62
|
+
console.log(err);
|
63
|
+
});
|
64
|
+
}
|
65
|
+
|
66
|
+
Object.keys(TRANSLATIONS).forEach((item) => {
|
67
|
+
addNewMessages(item, TRANSLATIONS[item]);
|
68
|
+
});
|
48
69
|
|
49
70
|
const addMyGamesCategory = ():void => {
|
50
71
|
if (myGamesAdded == false && (favorites == 'true' || mostplayed == 'true' || lastplayed == 'true') ) {
|
51
72
|
categories.splice(1, 0, {
|
52
73
|
// @ts-ignore
|
53
74
|
id: 'MYGAMES',
|
54
|
-
name:
|
75
|
+
name: myGamesTranslation,
|
55
76
|
href: '',
|
56
77
|
games: [],
|
57
78
|
});
|
@@ -92,6 +113,9 @@
|
|
92
113
|
}
|
93
114
|
|
94
115
|
const initialLoad = ():void => {
|
116
|
+
myGamesTranslation = $_('myGamesName');
|
117
|
+
lobbyTranslation = $_('lobbyName');
|
118
|
+
|
95
119
|
if (!checkAttrs()) {
|
96
120
|
let url:any = new URL(`${endpoint}/casino/groups/${datasource}`);
|
97
121
|
|
@@ -126,7 +150,7 @@
|
|
126
150
|
categories.unshift({
|
127
151
|
// @ts-ignore
|
128
152
|
id: 'LOBBY',
|
129
|
-
name:
|
153
|
+
name: lobbyTranslation,
|
130
154
|
href: '',
|
131
155
|
games: [],
|
132
156
|
});
|
@@ -178,6 +202,7 @@
|
|
178
202
|
$: endpoint && session && (mostplayed || lastplayed || favorites) && !isLoading && addMyGamesCategory();
|
179
203
|
$: !isLoading && activecategory && (session ? confirmCategoryParse : true) && setActiveCategory();
|
180
204
|
$: clientstyling && customStylingContainer && setClientStyling();
|
205
|
+
$: translationurl && setTranslationUrl();
|
181
206
|
$: clientstylingurl && customStylingContainer && setClientStylingURL();
|
182
207
|
|
183
208
|
</script>
|
package/src/i18n.js
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
import {
|
2
|
+
dictionary,
|
3
|
+
locale,
|
4
|
+
addMessages,
|
5
|
+
_
|
6
|
+
} from 'svelte-i18n';
|
7
|
+
|
8
|
+
function setupI18n({ withLocale: _locale, translations }) {
|
9
|
+
locale.subscribe((data) => {
|
10
|
+
if (data == null) {
|
11
|
+
dictionary.set(translations);
|
12
|
+
locale.set(_locale);
|
13
|
+
}
|
14
|
+
}); // maybe we will need this to make sure that the i18n is set up only once
|
15
|
+
/*dictionary.set(translations);
|
16
|
+
locale.set(_locale);*/
|
17
|
+
}
|
18
|
+
|
19
|
+
function addNewMessages(lang, dict) {
|
20
|
+
addMessages(lang, dict);
|
21
|
+
}
|
22
|
+
|
23
|
+
function setLocale(_locale) {
|
24
|
+
locale.set(_locale);
|
25
|
+
}
|
26
|
+
|
27
|
+
export { _, setupI18n, addNewMessages, setLocale };
|
@@ -0,0 +1,62 @@
|
|
1
|
+
export const TRANSLATIONS = {
|
2
|
+
"en": {
|
3
|
+
"lobbyName": "Lobby",
|
4
|
+
"myGamesName": "My games"
|
5
|
+
},
|
6
|
+
"de": {
|
7
|
+
"lobbyName": "Lobby",
|
8
|
+
"myGamesName": "My games"
|
9
|
+
},
|
10
|
+
"es": {
|
11
|
+
"lobbyName": "Sala",
|
12
|
+
"myGamesName": "Mis juegos"
|
13
|
+
},
|
14
|
+
"zh-hk": {
|
15
|
+
"lobbyName": "Lobby",
|
16
|
+
"myGamesName": "My games"
|
17
|
+
},
|
18
|
+
"it": {
|
19
|
+
"lobbyName": "Lobby",
|
20
|
+
"myGamesName": "My games"
|
21
|
+
},
|
22
|
+
"fr": {
|
23
|
+
"lobbyName": "Lobby",
|
24
|
+
"myGamesName": "My games"
|
25
|
+
},
|
26
|
+
"tr": {
|
27
|
+
"lobbyName": "Lobby",
|
28
|
+
"myGamesName": "My games"
|
29
|
+
},
|
30
|
+
"ru": {
|
31
|
+
"lobbyName": "Lobby",
|
32
|
+
"myGamesName": "My games"
|
33
|
+
},
|
34
|
+
"ro": {
|
35
|
+
"lobbyName": "Lobby",
|
36
|
+
"myGamesName": "My games"
|
37
|
+
},
|
38
|
+
"hr": {
|
39
|
+
"lobbyName": "Lobby",
|
40
|
+
"myGamesName": "My games"
|
41
|
+
},
|
42
|
+
"hu": {
|
43
|
+
"lobbyName": "Lobby",
|
44
|
+
"myGamesName": "My games"
|
45
|
+
},
|
46
|
+
"pl": {
|
47
|
+
"lobbyName": "Lobby",
|
48
|
+
"myGamesName": "My games"
|
49
|
+
},
|
50
|
+
"pt": {
|
51
|
+
"lobbyName": "Lobby",
|
52
|
+
"myGamesName": "My games"
|
53
|
+
},
|
54
|
+
"sl": {
|
55
|
+
"lobbyName": "Lobby",
|
56
|
+
"myGamesName": "My games"
|
57
|
+
},
|
58
|
+
"sr": {
|
59
|
+
"lobbyName": "Lobby",
|
60
|
+
"myGamesName": "My games"
|
61
|
+
}
|
62
|
+
}
|