@everymatrix/player-deposit 0.0.199 → 0.0.203
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/dist/player-deposit.js +1 -1
- package/dist/player-deposit.js.map +1 -1
- package/package.json +2 -2
- package/src/PlayerDeposit.svelte +16 -3
- package/src/i18n.js +27 -0
- package/src/translations.js +14 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everymatrix/player-deposit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.203",
|
|
4
4
|
"main": "dist/player-deposit",
|
|
5
5
|
"svelte": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "31d7d9eeef7e68b954b83fb3dde25db05d8edf74"
|
|
40
40
|
}
|
package/src/PlayerDeposit.svelte
CHANGED
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
<script lang="typescript">
|
|
3
3
|
import { onMount } from 'svelte';
|
|
4
4
|
import { getDevice } from 'rvhelper';
|
|
5
|
+
import { _, addNewMessages, setLocale } from './i18n';
|
|
6
|
+
import { PlayerDepositTranslations } from './translations';
|
|
5
7
|
|
|
6
8
|
export let endpoint:string = '';
|
|
7
9
|
export let session:string = '';
|
|
8
10
|
export let playerid:string = '';
|
|
11
|
+
export let lang:string = 'en';
|
|
9
12
|
|
|
10
13
|
let userAgent:string = window.navigator.userAgent;
|
|
11
14
|
let isMobile = (getDevice(userAgent) === 'PC') ? false : true;
|
|
@@ -15,6 +18,11 @@
|
|
|
15
18
|
let amount:number = 0;
|
|
16
19
|
let iframeUrl:string = '';
|
|
17
20
|
|
|
21
|
+
Object.keys(PlayerDepositTranslations).forEach((item:any) => {
|
|
22
|
+
addNewMessages(item, PlayerDepositTranslations[item]);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
|
|
18
26
|
const toggleScreen = () => {
|
|
19
27
|
window.postMessage({ type: 'ReturnToMenu' }, window.location.href);
|
|
20
28
|
}
|
|
@@ -88,6 +96,10 @@
|
|
|
88
96
|
});
|
|
89
97
|
}
|
|
90
98
|
|
|
99
|
+
const initialLoad = () => {
|
|
100
|
+
setLocale(lang);
|
|
101
|
+
}
|
|
102
|
+
|
|
91
103
|
onMount(() => {
|
|
92
104
|
window.addEventListener('message', messageHandler, false);
|
|
93
105
|
|
|
@@ -96,6 +108,7 @@
|
|
|
96
108
|
}
|
|
97
109
|
});
|
|
98
110
|
|
|
111
|
+
$: lang && initialLoad();
|
|
99
112
|
$: session && playerid && endpoint && getDepositIframe();
|
|
100
113
|
</script>
|
|
101
114
|
|
|
@@ -107,12 +120,12 @@
|
|
|
107
120
|
<path class="aaa" d="M7.5,0,6.136,1.364,11.3,6.526H0V8.474H11.3L6.136,13.636,7.5,15,15,7.5Z" transform="translate(15 15) rotate(180)"/>
|
|
108
121
|
</g></g>
|
|
109
122
|
</svg>
|
|
110
|
-
<h2 class="DepositTitleMobile">
|
|
123
|
+
<h2 class="DepositTitleMobile">{$_('deposit.title')}</h2>
|
|
111
124
|
</div>
|
|
112
125
|
{/if}
|
|
113
|
-
<h2 class="DepositTitle {isMobile ? 'DepositTitleNone' : ''}">
|
|
126
|
+
<h2 class="DepositTitle {isMobile ? 'DepositTitleNone' : ''}">{$_('deposit.title')}</h2>
|
|
114
127
|
{#if isLoading}
|
|
115
|
-
<p>
|
|
128
|
+
<p>{$_('deposit.loading')}</p>
|
|
116
129
|
{:else}
|
|
117
130
|
<div class="DepositIframeWrapper">
|
|
118
131
|
<iframe src={iframeUrl} title="Deposit Iframe"></iframe>
|
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 };
|