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) {
processed_last_submit = false;
const toast = Toastify({
text: "Adding Scan",
text: $_('adding-scan'),
duration: -1,
}).showToast();
let postdata = {
@ -59,7 +59,7 @@
modal_open = false;
//
Toastify({
text: "Scan added",
text: $_('scan-added'),
duration: 500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
}).showToast();
@ -118,11 +118,11 @@
</div>
<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">
Create a new scan (fixed only)
{$_('create-a-new-scan-fixed-only')}
</h3>
<div class="mt-2 mb-6">
<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>
</div>
<div class="grid grid-cols-6 gap-6">
@ -163,7 +163,7 @@
{#if !is_distance_valid}
<span
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>
{/if}
</div>

View File

@ -2,8 +2,6 @@
import { _ } from "svelte-i18n";
import store from "../../store";
import {
DonationService,
DonorService,
RunnerService,
ScanService,
} from "@odit/lfk-client-js";
@ -51,7 +49,7 @@
function submit() {
if (data_loaded === true && save_enabled) {
Toastify({
text: "Scan is being updated",
text: $_('scan-is-being-updated'),
duration: 2500,
}).showToast();
let postdata = {};
@ -64,7 +62,7 @@
Object.assign(original_data, editable);
original_data = original_data;
Toastify({
text: "updated scan",
text: $_('updated-scan'),
duration: 2500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
}).showToast();
@ -78,7 +76,7 @@
Object.assign(original_data, editable);
original_data = original_data;
Toastify({
text: "updated scan",
text: $_('updated-scan'),
duration: 2500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
}).showToast();
@ -92,7 +90,7 @@
ScanService.scanControllerRemove(original_data.id, false)
.then((resp) => {
Toastify({
text: "Deleded Scan",
text: $_('deleted-scan'),
duration: 500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
}).showToast();
@ -154,7 +152,7 @@
{original_data.runner.lastname}
#{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}
<button
on:click={deleteScan}
@ -171,8 +169,7 @@
delete_triggered = true;
}}
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
scan</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-scan')}</button>
{/if}
{/if}
{#if !delete_triggered}
@ -187,7 +184,7 @@
</div>
<!-- -->
<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>
&nbsp;
<input
@ -201,7 +198,7 @@
class="focus:ring-indigo-500 align-bottom h-7 w-5font-medium text-indigo-600 border-gray-300 rounded" />
&nbsp;
<p class="font-medium">
{#if editable.valid}Valid{:else}Invalid{/if}
{#if editable.valid}{$_('valid')}{:else}{$_('invalid')}{/if}
</p>
</div>
{#if editable.responseType === 'TRACKSCAN'}
@ -236,7 +233,7 @@
<label
for="scan_distance"
class="block text-sm font-medium text-gray-700">
Distance</label>
{$_('distance')}</label>
<div class="mt-1 flex rounded-md shadow-sm">
<input
autocomplete="off"
@ -256,7 +253,7 @@
{#if !is_distance_valid}
<span
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>
{/if}
</div>

View File

@ -9,7 +9,7 @@
<section class="container p-5">
<span class="mb-1 text-3xl font-extrabold leading-tight">
Scans
{$_('scans')}
{#if store.state.jwtinfo.userdetails.permissions.includes('SCAN:CREATE')}
<button
on:click={() => {
@ -17,7 +17,7 @@
}}
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">
Add scan
{$_('add-scan')}
</button>
{/if}
</span>

View File

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

View File

@ -1,8 +1,6 @@
<script>
import { getLocaleFromNavigator, _ } from "svelte-i18n";
import {
DonationService,
DonorService,
ScanService,
} from "@odit/lfk-client-js";
import store from "../../store";
@ -21,7 +19,7 @@
return id.toString() === searchvalue;
}
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 < 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)}`
@ -33,7 +31,7 @@
<div
class="bg-teal-lightest border-t-4 border-teal rounded-b text-teal-darkest px-4 py-3 shadow-md my-2"
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>
</div>
{:then}
@ -59,17 +57,17 @@
<th
scope="col"
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Distance (+Track)
{$_('distance-track')}
</th>
<th
scope="col"
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Laptime
{$_('laptime')}
</th>
<th
scope="col"
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Status
{$_('status')}
</th>
<th scope="col" class="relative px-6 py-3">
<span class="sr-only">{$_('action')}</span>
@ -125,7 +123,7 @@
</div>
{:else}
<div class="text-sm font-medium text-gray-900">
Scan with fixed distance
{$_('scan-with-fixed-distance')}
</div>
{/if}
</td>
@ -133,10 +131,10 @@
<div class="flex items-center">
{#if scan.valid}
<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}
<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}
</div>
</td>

View File

@ -318,5 +318,25 @@
"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-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"
}