@everymatrix/player-transaction-history 0.0.200 → 0.0.201

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/player-transaction-history",
3
- "version": "0.0.200",
3
+ "version": "0.0.201",
4
4
  "main": "dist/player-transaction-history",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "1575292cd20d511a1f4ebe038656d86deab2c7e0"
39
+ "gitHead": "71051531499cfea745b53a0f7c0a77a252990ae7"
40
40
  }
@@ -1,10 +1,13 @@
1
1
  <svelte:options tag={null} />
2
2
  <script lang="typescript">
3
3
  import { getDevice } from 'rvhelper';
4
+ import { _, addNewMessages, setLocale } from './i18n';
5
+ import { PlayerTransactionHistoryTranslations } from './translations';
4
6
 
5
7
  export let endpoint:String = '';
6
8
  export let session:String = '';
7
9
  export let playerid:String = '';
10
+ export let lang:string = 'en';
8
11
 
9
12
  let userAgent:string = window.navigator.userAgent;
10
13
  let isMobile = (getDevice(userAgent) === 'PC') ? false : true;
@@ -12,6 +15,10 @@
12
15
 
13
16
  let iframeUrl:string = '';
14
17
 
18
+ Object.keys(PlayerTransactionHistoryTranslations).forEach((item:any) => {
19
+ addNewMessages(item, PlayerTransactionHistoryTranslations[item]);
20
+ });
21
+
15
22
  const toggleScreen = () => {
16
23
  window.postMessage({ type: 'ReturnToMenu' }, window.location.href);
17
24
  }
@@ -42,6 +49,11 @@
42
49
  });
43
50
  }
44
51
 
52
+ const initialLoad = () => {
53
+ setLocale(lang);
54
+ }
55
+
56
+ $: lang && initialLoad();
45
57
  $: session && playerid && endpoint && getTransactionHistoryIframe();
46
58
  </script>
47
59
 
@@ -53,12 +65,12 @@
53
65
  <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)"/>
54
66
  </g></g>
55
67
  </svg>
56
- <h2 class="TransactionHistoryTitleMobile">Transaction History</h2>
68
+ <h2 class="TransactionHistoryTitleMobile">{$_('transactionHistory.title')}</h2>
57
69
  </div>
58
70
  {/if}
59
- <h2 class="TransactionHistoryTitle {isMobile ? 'TransactionHistoryTitleNone' : ''}">Transaction History</h2>
71
+ <h2 class="TransactionHistoryTitle {isMobile ? 'TransactionHistoryTitleNone' : ''}">{$_('transactionHistory.title')}</h2>
60
72
  {#if isLoading}
61
- <p>Loading, please wait ...</p>
73
+ <p>{$_('transactionHistory.loading')}</p>
62
74
  {:else}
63
75
  <div class="TransactionHistoryIframeWrapper">
64
76
  <iframe src={iframeUrl} title="Transaction History 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 };
@@ -0,0 +1,14 @@
1
+ export const PlayerTransactionHistoryTranslations = {
2
+ en: {
3
+ transactionHistory: {
4
+ title: `Transaction History`,
5
+ loading: `Loading, please wait ...`
6
+ }
7
+ },
8
+ ro: {
9
+ transactionHistory: {
10
+ title: `Transaction History`,
11
+ loading: `Loading, please wait ...`
12
+ }
13
+ }
14
+ };