Translate custom form buttons

This commit is contained in:
nemunaire 2023-01-18 18:35:25 +01:00
parent a050459f1a
commit 63e6389ce3
5 changed files with 22 additions and 13 deletions

View File

@ -130,11 +130,11 @@ func GenStructFields(data interface{}) (fields []*Field) {
func GenDefaultSettingsForm(data interface{}) *CustomForm {
return &CustomForm{
Fields: GenStructFields(data),
NextButtonText: "Create",
NextEditButtonText: "Update",
NextButtonText: "common.create-thing",
NextEditButtonText: "common.update",
NextButtonState: 1,
PreviousButtonText: "Use another source",
PreviousEditButtonText: "Cancel",
PreviousButtonText: "provider.another",
PreviousEditButtonText: "common.cancel",
PreviousButtonState: -1,
}
}

View File

@ -67,7 +67,7 @@ func settingsForm(edit bool) *forms.CustomForm {
form := forms.GenDefaultSettingsForm(nil)
form.Fields = srcFields
form.NextButtonText = "Next >"
form.NextButtonText = "common.next"
return form
}
@ -91,7 +91,7 @@ func settingsAskCredentials(cfg *config.Options, recallid string, session *happy
return &forms.CustomForm{
BeforeText: "In order allows happyDomain to get and update yours domains, you have to let us access them. To avoid storing your credentials, we will store a unique token that will be associated with your account. For this purpose, you will be redirected to an OVH login screen. The registration will automatically continue",
NextButtonText: "Go to OVH",
PreviousButtonText: "< Previous",
PreviousButtonText: "common.previous",
NextButtonLink: response.ValidationURL,
PreviousButtonState: 0,
}, map[string]interface{}{

View File

@ -7,6 +7,7 @@
} from 'sveltestrap';
import type { CustomForm } from '$lib/model/custom_form';
import { t } from '$lib/translations';
const dispatch = createEventDispatcher();
@ -34,7 +35,7 @@
{#if previousInProgress}
<Spinner label="Spinning" size="sm" />
{/if}
{form.previousButtonText}
{$t(form.previousButtonText)}
</Button>
{/if}
{#if (!form.nextEditButtonText || !edit) && form.nextButtonText}
@ -48,7 +49,7 @@
{#if nextInProgress}
<Spinner label="Spinning" size="sm" />
{/if}
{form.nextButtonText}
{$t(form.nextButtonText)}
</Button>
{/if}
{#if edit && form.previousEditButtonText}
@ -63,7 +64,7 @@
{#if previousInProgress}
<Spinner label="Spinning" size="sm" />
{/if}
{form.previousEditButtonText}
{$t(form.previousEditButtonText)}
</Button>
{/if}
{#if edit && form.nextEditButtonText}
@ -77,7 +78,7 @@
{#if nextInProgress}
<Spinner label="Spinning" size="sm" />
{/if}
{form.nextEditButtonText}
{$t(form.nextEditButtonText)}
</Button>
{/if}
{:else}
@ -92,7 +93,7 @@
{#if previousInProgress}
<Spinner label="Spinning" size="sm" />
{/if}
Cancel
{$t('common.cancel')}
</Button>
<Button
type="submit"
@ -104,7 +105,7 @@
{#if nextInProgress}
<Spinner label="Spinning" size="sm" />
{/if}
Next &gt;
{$t('common.next')} &gt;
</Button>
{/if}
</div>

View File

@ -39,15 +39,18 @@
"field": "Field",
"go": "Go!",
"name": "Name",
"next": "Next",
"no-content": "No content",
"no-thing": "No {{thing}}",
"new-row": "New row",
"password": "Password",
"previous": "Previous",
"rename": "Rename",
"resolver": "Resolver",
"run": "Run the request!",
"survey": "A remark? a comment to share? Don't hesitate to write us!",
"spinning": "Spinning",
"update": "Update",
"welcome": {
"start": "Welcome to ",
"end": "!"
@ -229,6 +232,7 @@
"form-new": "Add a new service to {{domain}}"
},
"provider": {
"another": "Use another provider",
"associations": "{{count:eq; 0:no domain associated; 1:{{count}} domain associated; default:{{count}} domains associated}}",
"check-config": "Check your provider configuration",
"delete": "Delete this domain provider",

View File

@ -38,11 +38,14 @@
"field": "Champ",
"go": "C'est parti!",
"name": "Nom",
"next": "Suivant",
"password": "Mot de passe",
"previous": "Précédent",
"rename": "Renommer",
"resolver": "Résolveur",
"run": "Lancer l'opération!",
"spinning": "Chargement",
"update": "Mettre à jour",
"help": "Besoin d'aide?",
"records": "{{n:eq; 0:aucun enregistrement {{type}}; 1:enregistrement {{type}}; default:enregistrements {{type}}}}",
"survey": "Une remarque? un commentaire à partager? N'hésitez pas à nous écrire!",
@ -291,6 +294,7 @@
"showDNSSEC": "Afficher les enregistrements DNSSEC dans la réponse (s'il y en a)"
},
"provider": {
"another": "Choisir un autre fournisseur",
"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",
@ -316,4 +320,4 @@
"no-group": "Divers",
"title": "Vos groupes"
}
}
}