Add services i18n

This commit is contained in:
Restray
2022-04-03 00:18:48 +02:00
parent 13891110ce
commit 360fb5ea37
16 changed files with 114 additions and 73 deletions

View File

@@ -64,6 +64,7 @@
import Loading from '$lib/components/Loading.svelte';
import { del, post } from '$lib/api';
import { goto } from '$app/navigation';
import { t } from '$lib/translations';
const { id } = $page.params;
export let service;
@@ -72,7 +73,7 @@
let loading = false;
async function deleteService() {
const sure = confirm(`Are you sure you would like to delete '${service.name}'?`);
const sure = confirm(t.get('application.confirm_to_delete', { name: service.name }));
if (sure) {
loading = true;
try {
@@ -87,7 +88,7 @@
}
}
async function stopService() {
const sure = confirm(`Are you sure you would like to stop '${service.name}'?`);
const sure = confirm(t.get('application.confirm_stop', { name: service.name }));
if (sure) {
loading = true;
try {
@@ -121,13 +122,13 @@
{#if isRunning}
<button
on:click={stopService}
title="Stop Service"
title={$t('service.stop_service')}
type="submit"
disabled={!$session.isAdmin}
class="icons bg-transparent tooltip-bottom text-sm flex items-center space-x-2 text-red-500"
data-tooltip={$session.isAdmin
? 'Stop Service'
: 'You do not have permission to stop the service.'}
? $t('service.stop_service')
: $t('service.permission_denied_stop_service')}
>
<svg
xmlns="http://www.w3.org/2000/svg"
@@ -147,13 +148,13 @@
{:else}
<button
on:click={startService}
title="Start Service"
title={$t('service.start_service')}
type="submit"
disabled={!$session.isAdmin}
class="icons bg-transparent tooltip-bottom text-sm flex items-center space-x-2 text-green-500"
data-tooltip={$session.isAdmin
? 'Start Service'
: 'You do not have permission to start the service.'}
? $t('service.start_service')
: $t('service.permission_denied_start_service')}
><svg
xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6"
@@ -180,9 +181,9 @@
class:bg-coolgray-500={$page.url.pathname === `/services/${id}`}
>
<button
title="Configurations"
title={$t('application.configurations')}
class="icons bg-transparent tooltip-bottom text-sm disabled:text-red-500"
data-tooltip="Configurations"
data-tooltip={$t('application.configurations')}
>
<svg
xmlns="http://www.w3.org/2000/svg"
@@ -215,9 +216,9 @@
class:bg-coolgray-500={$page.url.pathname === `/services/${id}/secrets`}
>
<button
title="Secrets"
title={$t('application.secret')}
class="icons bg-transparent tooltip-bottom text-sm disabled:text-red-500"
data-tooltip="Secrets"
data-tooltip={$t('application.secret')}
>
<svg
xmlns="http://www.w3.org/2000/svg"
@@ -242,14 +243,14 @@
{/if}
<button
on:click={deleteService}
title="Delete Service"
title={$t('service.delete_service')}
type="submit"
disabled={!$session.isAdmin}
class:hover:text-red-500={$session.isAdmin}
class="icons bg-transparent tooltip-bottom text-sm"
data-tooltip={$session.isAdmin
? 'Delete Service'
: 'You do not have permission to delete a service.'}><DeleteIcon /></button
? $t('service.delete_service')
: $t('service.permission_denied_delete_service')}><DeleteIcon /></button
>
{/if}
</nav>