ui: Use variables in translations

This commit is contained in:
nemunaire 2023-01-09 10:33:41 +01:00
parent 14962aeffa
commit 5cb81781a0
10 changed files with 41 additions and 37 deletions

11
ui/package-lock.json generated
View File

@ -11,6 +11,7 @@
"bootstrap": "^5.2.2",
"bootstrap-icons": "^1.9.1",
"cuid": "^2.1.8",
"html-escaper": "^3.0.3",
"sass": "^1.55.0",
"sass-loader": "^13.1.0",
"sveltekit-i18n": "^2.2.2",
@ -2044,6 +2045,11 @@
"node": ">=8"
}
},
"node_modules/html-escaper": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz",
"integrity": "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ=="
},
"node_modules/ignore": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.1.tgz",
@ -5064,6 +5070,11 @@
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
},
"html-escaper": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz",
"integrity": "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ=="
},
"ignore": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.1.tgz",

View File

@ -33,6 +33,7 @@
"bootstrap": "^5.2.2",
"bootstrap-icons": "^1.9.1",
"cuid": "^2.1.8",
"html-escaper": "^3.0.3",
"sass": "^1.55.0",
"sass-loader": "^13.1.0",
"sveltekit-i18n": "^2.2.2",

View File

@ -1,6 +1,7 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte';
import { escape } from 'html-escaper';
import {
Button,
Icon,
@ -105,8 +106,7 @@
on:submit|preventDefault={submitAliasForm}
>
<p>
{$t('domains.alias-creation')}
<span class="font-monospace">{fqdn(dn, origin.domain)}</span>
{@html $t('domains.alias-creation', {"domain": `<span class="font-monospace">${escape(fqdn(dn, origin.domain))}</span>`})}
<InputGroup>
<Input
autofocus

View File

@ -1,4 +1,5 @@
<script lang="ts">
import { escape } from 'html-escaper';
import {
ModalHeader,
} from 'sveltestrap';
@ -14,7 +15,6 @@
{#if update}
{$t('service.update')}
{:else}
{$t('service.form-new')}
{@html $t('service.form-new', {"domain": `<span class="font-monospace">${escape(dn)}</span>`})}
{/if}
<span class="font-monospace">{dn}</span>
</ModalHeader>

View File

@ -1,6 +1,7 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte';
import { escape } from 'html-escaper';
import {
Input,
InputGroup,
@ -76,8 +77,8 @@
on:submit|preventDefault={submitSubdomainForm}
>
<p>
{$t('domains.form-new-subdomain')}
<span class="font-monospace">{origin.domain}</span>
{@html $t('domains.form-new-subdomain', {"domain": `<span class="font-monospace">${escape(origin.domain)}</span>`})}
<InputGroup>
<Input
autofocus

View File

@ -1,4 +1,5 @@
<script lang="ts">
import { escape } from 'html-escaper';
import {
Badge,
Button,
@ -93,14 +94,7 @@
<CardHeader>
<div class="d-flex justify-content-between">
<div>
{$t("provider.provider")}
<em>
{#if provider._comment}
{provider._comment}
{:else if $providersSpecs}
{$providersSpecs[provider._srctype].name}
{/if}
</em>
{@html $t("provider.provider", {"provider": '<em>' + escape(provider._comment?provider._comment:$providersSpecs?$providersSpecs[provider._srctype].name:"") + '</em>'})}
</div>
{#if importableDomainsList != null}
<Button
@ -194,9 +188,7 @@
{:else if importableDomainsList.length === 0}
<ListGroupItem class="text-center my-3">
{#if $providersSpecs}
<i18n path="errors.domain-all-imported">
{$providersSpecs[provider._srctype].name}
</i18n>
{$t("errors.domain-all-imported", {"provider": $providersSpecs[provider._srctype].name})}
{/if}
</ListGroupItem>
{/if}

View File

@ -44,7 +44,7 @@
bind:value={value.domain}
/>
<div id="domainHelpBlock" class="form-text">
{$t('resolver.domain-description')}
{@html $t('resolver.domain-description', {"domain": `<a href="/resolver/wikipedia.org" class="font-monospace">wikipedia.org</a>`})}
</div>
<datalist id="my-domains">
{#each sortedDomains as dn (dn.id)}

View File

@ -101,7 +101,7 @@
"view": {
"abstract": "Abstract zone",
"cancel-title": "Keep my domain in happyDomain",
"description": "Review the modifications that will be applied to {{0}}",
"description": "Review the modifications that will be applied to {{domain}}",
"live": "Live records",
"monitoring": "Monitoring",
"summary": "Summary",
@ -111,11 +111,11 @@
"views": {
"provider-parameters": "Hosting parameters"
},
"alias-creation": "Add an alias pointing to {{0}}:",
"alias-creation": "Add an alias pointing to {{domain}}:",
"alias-creation-sample": "This will create the alias:",
"placeholder-new": "my.new.domain.",
"placeholder-new-sub": "new.subdomain",
"form-new-subdomain": "Add a new subdomain under {{0}}:"
"form-new-subdomain": "Add a new subdomain under {{domain}}:"
},
"domaingroups": {
"manage": "Manage your domain's groups",
@ -170,7 +170,7 @@
},
"settings-change": "Unable to change your settings",
"account-no-auth": "You're using happyDomain without authentication. You cannot manage other account properties.",
"domain-all-imported": "This account on {{0}} doesn't have any more domain to import."
"domain-all-imported": "This account on {{provider}} doesn't have any more domain to import."
},
"menu": {
"my-domains": "My domains",
@ -225,17 +225,16 @@
"already": "Already managed",
"delete": "Delete the service",
"update": "Update the service",
"form-new": "Add a new service to {{0}}"
"form-new": "Add a new service to {{domain}}"
},
"provider": {
"check-config": "Check your provider configuration",
"delete": "Delete this domain provider",
"find": "Can't find your domain provider here?",
"name-your": "Name your domain's provider",
"provider": "Domains living on {{0}}",
"provider": "Domains living on {{provider}}",
"kind": "domain's provider",
"select-provider": "First, you need to select the provider hosting your domain:",
"select-source": "Select the place where your domain {{0}} is hosted",
"provider-name": "Host's name",
"provider-type": "Hosting provider type",
"title": "Your domains' providers",
@ -304,8 +303,8 @@
"advanced": "With custom settings?",
"custom": "Custom resolver",
"custom-description": "Enter the addresse (a domain name or an IP) of the resolver you want to use.",
"domain-description": "Indicate the domain you search the records. For example, you can try {{0}}.",
"field-description": "What kind of DNS record you want to see. For example: A is for IPv4, AAAA is for IPv6, ... {{0}}",
"domain-description": "Indicate the domain you search the records. For example, you can try {{domain}}.",
"field-description": "What kind of DNS record you want to see. For example: A is for IPv4, AAAA is for IPv6, ...",
"field-description-more-info": "More information here",
"resolver-description": "This is the server we will ask for the information.",
"ttl": "Remaining time in cache",

View File

@ -98,7 +98,7 @@
"view": {
"abstract": "Zone abstraite",
"cancel-title": "Conserver mon domaine dans happyDomain",
"description": "Valider les modifications qui seront appliquées à {{0}}",
"description": "Valider les modifications qui seront appliquées à {{domain}}",
"live": "Enregistrements actifs",
"monitoring": "Suivi",
"summary": "Résumé",
@ -121,10 +121,10 @@
},
"as": "Voir comme :"
},
"alias-creation": "Ajouter un alias pointant sur {{0}} :",
"alias-creation": "Ajouter un alias pointant sur {{domain}} :",
"alias-creation-sample": "Cela va créer cet alias :",
"placeholder-new": "mon.nouveau.domaine.",
"form-new-subdomain": "Ajout d'un sous-domaine sous {{0}} :"
"form-new-subdomain": "Ajout d'un sous-domaine sous {{domain}} :"
},
"email": {
"address": "Adresse électronique",
@ -172,7 +172,7 @@
},
"settings-change": "Impossible de changer vos paramètres",
"account-no-auth": "Vous utilisez happyDomain sans authentification. Vous ne pouvez pas changer d'autre paramètre de votre compte.",
"domain-all-imported": "Ce compte sur {{0}} ne contient plus aucun domaine à importer."
"domain-all-imported": "Ce compte sur {{provider}} ne contient plus aucun domaine à importer."
},
"menu": {
"my-domains": "Mes domaines",
@ -227,16 +227,15 @@
"already": "Déjà géré",
"delete": "Supprimer ce service",
"update": "Mettre à jour le service",
"form-new": "Ajout d'une service sur {{0}}"
"form-new": "Ajout d'un service sur {{domain}}"
},
"source": {
"delete": "Supprimer cet hébergeur de domaines",
"find": "Vous ne trouvez pas votre hébergeur de domaines ici ?",
"name-your": "Nommer cet hébergeur de domaines",
"source": "Domaines existant sur {{0}}",
"source": "Domaines existant sur {{provider}}",
"kind": "L'hébergeur du domaine",
"select-provider": "Sélectionnez d'abord l'hébergeur de votre domaine :",
"select-source": "Sélectionnez l'endroit où votre domaine {{0}} est hébergé",
"source-name": "Nom de l'hébergeur",
"source-type": "Type d'hébergement",
"title": "Les hébergeurs de vos domaines",
@ -305,8 +304,8 @@
"advanced": "Besoin de paramètres personnalisés ?",
"custom": "Résolveur spécifique",
"custom-description": "Indiquez l'adresse (un nom de domaine ou une IP) du résolveur que vous souhaitez utiliser.",
"domain-description": "Indiquez le domaine dont vous souhaitez consulter les enregistrements. Par exemple, vous pouvez essayer {{0}}.",
"field-description": "Quel type d'enregistrement DNS vous souhaitez voir. Par exemple : A est utilisé pour les IPv4, AAAA pour les IPv6, .... {{0}}",
"domain-description": "Indiquez le domaine dont vous souhaitez consulter les enregistrements. Par exemple, vous pouvez essayer {{domain}}.",
"field-description": "Quel type d'enregistrement DNS vous souhaitez voir. Par exemple : A est utilisé pour les IPv4, AAAA pour les IPv6, ....",
"field-description-more-info": "Plus d'information ici",
"resolver-description": "Il s'agit du serveur à qui nous allons demander les informations.",
"ttl": "Temps de cache restant",

View File

@ -1,6 +1,7 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { escape } from 'html-escaper';
import {
Button,
ButtonGroup,
@ -419,7 +420,7 @@
scrollable
>
<ModalHeader toggle={() => applyZoneModalIsOpen = false}>
{$t('domains.view.description')}
{@html $t('domains.view.description', {"domain": `<span class="font-monospace">${escape(domain.domain)}</span>`})}
</ModalHeader>
<ModalBody>
{#if !zoneDiff}