Added language keys🌎

ref #92
This commit is contained in:
Nicolai Ort 2021-03-18 17:17:15 +01:00
parent 8252a35771
commit 60aa919b14
6 changed files with 368 additions and 353 deletions

View File

@ -45,7 +45,7 @@
if (processed_last_submit === true) { if (processed_last_submit === true) {
processed_last_submit = false; processed_last_submit = false;
const toast = Toastify({ const toast = Toastify({
text: "Adding Scan", text: $_('adding-scan'),
duration: -1, duration: -1,
}).showToast(); }).showToast();
let postdata = { let postdata = {
@ -59,7 +59,7 @@
modal_open = false; modal_open = false;
// //
Toastify({ Toastify({
text: "Scan added", text: $_('scan-added'),
duration: 500, duration: 500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
@ -118,11 +118,11 @@
</div> </div>
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left"> <div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
<h3 class="text-lg leading-6 font-medium text-gray-900"> <h3 class="text-lg leading-6 font-medium text-gray-900">
Create a new scan (fixed only) {$_('create-a-new-scan-fixed-only')}
</h3> </h3>
<div class="mt-2 mb-6"> <div class="mt-2 mb-6">
<p class="text-sm text-gray-500"> <p class="text-sm text-gray-500">
Please provide the nessecary information to create a new scan. {$_('please-provide-the-nessecary-information-to-create-a-new-scan')}
</p> </p>
</div> </div>
<div class="grid grid-cols-6 gap-6"> <div class="grid grid-cols-6 gap-6">
@ -163,7 +163,7 @@
{#if !is_distance_valid} {#if !is_distance_valid}
<span <span
class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1"> class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1">
The scan's distance must be greater than 0m {$_('the-scans-distance-must-be-greater-than-0m')}
</span> </span>
{/if} {/if}
</div> </div>

View File

@ -2,8 +2,6 @@
import { _ } from "svelte-i18n"; import { _ } from "svelte-i18n";
import store from "../../store"; import store from "../../store";
import { import {
DonationService,
DonorService,
RunnerService, RunnerService,
ScanService, ScanService,
} from "@odit/lfk-client-js"; } from "@odit/lfk-client-js";
@ -51,7 +49,7 @@
function submit() { function submit() {
if (data_loaded === true && save_enabled) { if (data_loaded === true && save_enabled) {
Toastify({ Toastify({
text: "Scan is being updated", text: $_('scan-is-being-updated'),
duration: 2500, duration: 2500,
}).showToast(); }).showToast();
let postdata = {}; let postdata = {};
@ -64,7 +62,7 @@
Object.assign(original_data, editable); Object.assign(original_data, editable);
original_data = original_data; original_data = original_data;
Toastify({ Toastify({
text: "updated scan", text: $_('updated-scan'),
duration: 2500, duration: 2500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
@ -78,7 +76,7 @@
Object.assign(original_data, editable); Object.assign(original_data, editable);
original_data = original_data; original_data = original_data;
Toastify({ Toastify({
text: "updated scan", text: $_('updated-scan'),
duration: 2500, duration: 2500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
@ -92,7 +90,7 @@
ScanService.scanControllerRemove(original_data.id, false) ScanService.scanControllerRemove(original_data.id, false)
.then((resp) => { .then((resp) => {
Toastify({ Toastify({
text: "Deleded Scan", text: $_('deleted-scan'),
duration: 500, duration: 500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
@ -154,7 +152,7 @@
{original_data.runner.lastname} {original_data.runner.lastname}
#{original_data.id} #{original_data.id}
<span data-id="donation_actions_${original_data.id}"> <span data-id="donation_actions_${original_data.id}">
{#if store.state.jwtinfo.userdetails.permissions.includes('DONATION:DELETE')} {#if store.state.jwtinfo.userdetails.permissions.includes('SCAN:DELETE')}
{#if delete_triggered} {#if delete_triggered}
<button <button
on:click={deleteScan} on:click={deleteScan}
@ -171,8 +169,7 @@
delete_triggered = true; delete_triggered = true;
}} }}
type="button" type="button"
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:">Delete class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:">{$_('delete-scan')}</button>
scan</button>
{/if} {/if}
{/if} {/if}
{#if !delete_triggered} {#if !delete_triggered}
@ -187,7 +184,7 @@
</div> </div>
<!-- --> <!-- -->
<div class="w-full inline-flex"> <div class="w-full inline-flex">
<label for="valid" class="block font-medium text-gray-700">Status: <label for="valid" class="block font-medium text-gray-700">{$_('status')}:
</label> </label>
&nbsp; &nbsp;
<input <input
@ -201,7 +198,7 @@
class="focus:ring-indigo-500 align-bottom h-7 w-5font-medium text-indigo-600 border-gray-300 rounded" /> class="focus:ring-indigo-500 align-bottom h-7 w-5font-medium text-indigo-600 border-gray-300 rounded" />
&nbsp; &nbsp;
<p class="font-medium"> <p class="font-medium">
{#if editable.valid}Valid{:else}Invalid{/if} {#if editable.valid}{$_('valid')}{:else}{$_('invalid')}{/if}
</p> </p>
</div> </div>
{#if editable.responseType === 'TRACKSCAN'} {#if editable.responseType === 'TRACKSCAN'}
@ -236,7 +233,7 @@
<label <label
for="scan_distance" for="scan_distance"
class="block text-sm font-medium text-gray-700"> class="block text-sm font-medium text-gray-700">
Distance</label> {$_('distance')}</label>
<div class="mt-1 flex rounded-md shadow-sm"> <div class="mt-1 flex rounded-md shadow-sm">
<input <input
autocomplete="off" autocomplete="off"
@ -256,7 +253,7 @@
{#if !is_distance_valid} {#if !is_distance_valid}
<span <span
class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1"> class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1">
The scan's distance must be greater than 0m {$_('the-scans-distance-must-be-greater-than-0m')}
</span> </span>
{/if} {/if}
</div> </div>

View File

@ -9,7 +9,7 @@
<section class="container p-5"> <section class="container p-5">
<span class="mb-1 text-3xl font-extrabold leading-tight"> <span class="mb-1 text-3xl font-extrabold leading-tight">
Scans {$_('scans')}
{#if store.state.jwtinfo.userdetails.permissions.includes('SCAN:CREATE')} {#if store.state.jwtinfo.userdetails.permissions.includes('SCAN:CREATE')}
<button <button
on:click={() => { on:click={() => {
@ -17,7 +17,7 @@
}} }}
type="button" type="button"
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm"> class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
Add scan {$_('add-scan')}
</button> </button>
{/if} {/if}
</span> </span>

View File

@ -6,7 +6,7 @@
<div class="text-center items-center justify-center"> <div class="text-center items-center justify-center">
<p class="mb-16 text-lg text-gray-500"> <p class="mb-16 text-lg text-gray-500">
<img class="w-full" style="height:15rem" src={scans_empty} alt="" /> <img class="w-full" style="height:15rem" src={scans_empty} alt="" />
<span class="font-bold">There are no scans yet</span><br /> <span class="font-bold">{$_('there-are-no-scans-yet')}</span><br />
<span>Add your fist scan</span> <span>{$_('add-your-fist-scan')}</span>
</p> </p>
</div> </div>

View File

@ -1,8 +1,6 @@
<script> <script>
import { getLocaleFromNavigator, _ } from "svelte-i18n"; import { getLocaleFromNavigator, _ } from "svelte-i18n";
import { import {
DonationService,
DonorService,
ScanService, ScanService,
} from "@odit/lfk-client-js"; } from "@odit/lfk-client-js";
import store from "../../store"; import store from "../../store";
@ -21,7 +19,7 @@
return id.toString() === searchvalue; return id.toString() === searchvalue;
} }
function format_laptime(laptime){ function format_laptime(laptime){
if(laptime == 0 || laptime == null){return "First scan of the day."} if(laptime == 0 || laptime == null){return $_('first-scan-of-the-day')}
if(laptime < 60){return `${laptime}s`} if(laptime < 60){return `${laptime}s`}
if(laptime < 3600){return `${Math.floor(laptime / 60)}min ${laptime - (Math.floor(laptime / 60)*60)}s`} if(laptime < 3600){return `${Math.floor(laptime / 60)}min ${laptime - (Math.floor(laptime / 60)*60)}s`}
return `${Math.floor(laptime / 3600)}h ${laptime - (Math.floor(laptime / 3600)*3600)}min ${laptime - (Math.floor(laptime / 3600)*3600) - (Math.floor(laptime / 60)*60)}` return `${Math.floor(laptime / 3600)}h ${laptime - (Math.floor(laptime / 3600)*3600)}min ${laptime - (Math.floor(laptime / 3600)*3600) - (Math.floor(laptime / 60)*60)}`
@ -33,7 +31,7 @@
<div <div
class="bg-teal-lightest border-t-4 border-teal rounded-b text-teal-darkest px-4 py-3 shadow-md my-2" class="bg-teal-lightest border-t-4 border-teal rounded-b text-teal-darkest px-4 py-3 shadow-md my-2"
role="alert"> role="alert">
<p class="font-bold">Scans are being loaded</p> <p class="font-bold">{$_('scans-are-being-loaded')}</p>
<p class="text-sm">{$_('this-might-take-a-moment')}</p> <p class="text-sm">{$_('this-might-take-a-moment')}</p>
</div> </div>
{:then} {:then}
@ -59,17 +57,17 @@
<th <th
scope="col" scope="col"
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"> class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Distance (+Track) {$_('distance-track')}
</th> </th>
<th <th
scope="col" scope="col"
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"> class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Laptime {$_('laptime')}
</th> </th>
<th <th
scope="col" scope="col"
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"> class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Status {$_('status')}
</th> </th>
<th scope="col" class="relative px-6 py-3"> <th scope="col" class="relative px-6 py-3">
<span class="sr-only">{$_('action')}</span> <span class="sr-only">{$_('action')}</span>
@ -125,7 +123,7 @@
</div> </div>
{:else} {:else}
<div class="text-sm font-medium text-gray-900"> <div class="text-sm font-medium text-gray-900">
Scan with fixed distance {$_('scan-with-fixed-distance')}
</div> </div>
{/if} {/if}
</td> </td>
@ -133,10 +131,10 @@
<div class="flex items-center"> <div class="flex items-center">
{#if scan.valid} {#if scan.valid}
<span <span
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Valid</span> class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">{$_('valid')}</span>
{:else} {:else}
<span <span
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">Invalid</span> class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">{$_('invalid')}</span>
{/if} {/if}
</div> </div>
</td> </td>

View File

@ -318,5 +318,25 @@
"welcome_wavinghand": "Welcome 👋", "welcome_wavinghand": "Welcome 👋",
"you-can-now-use-your-new-password-to-log-in-to-your-account": "You can now use your new password to log in to your account! 🎉", "you-can-now-use-your-new-password-to-log-in-to-your-account": "You can now use your new password to log in to your account! 🎉",
"you-have-to-provide-an-organization": "You have to provide an organization", "you-have-to-provide-an-organization": "You have to provide an organization",
"zip-postal-code": "ZIP/ postal code" "zip-postal-code": "ZIP/ postal code",
"adding-scan": "Adding Scan",
"scan-added": "Scan added",
"create-a-new-scan-fixed-only": "Create a new scan (fixed only)",
"please-provide-the-nessecary-information-to-create-a-new-scan": "Please provide the nessecary information to create a new scan.",
"the-scans-distance-must-be-greater-than-0m": "The scan's distance must be greater than 0m",
"scan-is-being-updated": "Scan is being updated",
"updated-scan": "updated scan",
"deleted-scan": "Deleted scan",
"delete-scan": "Delete scan",
"valid": "Valid",
"invalid": "Invalid",
"add-scan": "Add scan",
"scans": "Scans",
"there-are-no-scans-yet": "There are no scans yet",
"add-your-fist-scan": "Add your fist scan",
"first-scan-of-the-day": "First scan of the day.",
"scans-are-being-loaded": "Scans are being loaded",
"distance-track": "Distance (+Track)",
"laptime": "Laptime",
"scan-with-fixed-distance": "Scan with fixed distance"
} }