Move i18n to vue-i18n and json files

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-09-12 11:34:01 +02:00
parent c3b03a2e6b
commit 96380f7df2
47 changed files with 740 additions and 1803 deletions

View File

@@ -1,11 +1,13 @@
<template>
<div class="identity-picker">
<img class="image" v-if="currentIdentity.avatar" :src="currentIdentity.avatar.url" :alt="currentIdentity.avatar.alt"/> {{ currentIdentity.name || `@${currentIdentity.preferredUsername}` }}
<b-button type="is-text" @click="isComponentModalActive = true"><translate>Change</translate></b-button>
<b-button type="is-text" @click="isComponentModalActive = true">
{{ $t('Change') }}
</b-button>
<b-modal :active.sync="isComponentModalActive" has-modal-card>
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">Pick an identity</p>
<p class="modal-card-title">{{ $t('Pick an identity') }}</p>
</header>
<section class="modal-card-body">
<div class="list is-hoverable">

View File

@@ -24,46 +24,46 @@
<b-dropdown hoverable has-link aria-role="list">
<button class="button is-primary" slot="trigger">
<translate>Public feeds</translate>
{{ $t('Public feeds') }}
<b-icon icon="menu-down"></b-icon>
</button>
<b-dropdown-item aria-role="listitem">
<a :href="feedUrls('atom', true)">
<translate>Public RSS/Atom Feed</translate>
{{ $t('Public RSS/Atom Feed') }}
</a>
</b-dropdown-item>
<b-dropdown-item aria-role="listitem">
<a :href="feedUrls('ics', true)">
<translate>Public iCal Feed</translate>
{{ $t('Public iCal Feed') }}
</a>
</b-dropdown-item>
</b-dropdown>
<b-dropdown hoverable has-link aria-role="list" v-if="person.feedTokens.length > 0">
<button class="button is-info" slot="trigger">
<translate>Private feeds</translate>
{{ $t('Private feeds') }}
<b-icon icon="menu-down"></b-icon>
</button>
<b-dropdown-item aria-role="listitem">
<a :href="feedUrls('atom', false)">
<translate>RSS/Atom Feed</translate>
{{ $t('RSS/Atom Feed') }}
</a>
</b-dropdown-item>
<b-dropdown-item aria-role="listitem">
<a :href="feedUrls('ics', false)">
<translate>iCal Feed</translate>
{{ $t('iCal Feed') }}
</a>
</b-dropdown-item>
</b-dropdown>
<a class="button" v-if="currentActor.id === person.id" @click="createToken">
<translate>Create token</translate>
{{ $t('Create token') }}
</a>
</div>
<section v-if="person.organizedEvents.length > 0">
<h2 class="subtitle">
<translate>Organized</translate>
{{ $t('Organized') }}
</h2>
<div class="columns">
<EventCard
@@ -81,7 +81,7 @@
@click="deleteProfile()"
v-if="currentActor && currentActor.id === person.id"
>
<translate>Delete</translate>
{{ $t('Delete') }}
</a>
</p>
</div>

View File

@@ -3,7 +3,7 @@
<section class="hero">
<div class="hero-body">
<h1 class="title">
<translate>Register an account on Mobilizon!</translate>
{{ $t('Register an account on Mobilizon!') }}
</h1>
</div>
</section>
@@ -13,7 +13,7 @@
<div class="column">
<form v-if="!validationSent">
<b-field
:label="$gettext('Username')"
:label="t('Username')"
:type="errors.preferred_username ? 'is-danger' : null"
:message="errors.preferred_username"
>
@@ -30,18 +30,18 @@
</b-field>
</b-field>
<b-field :label="$gettext('Displayed name')">
<b-field :label="$t('Displayed name')">
<b-input v-model="person.name"/>
</b-field>
<b-field :label="$gettext('Description')">
<b-field :label="$t('Description')">
<b-input type="textarea" v-model="person.summary"/>
</b-field>
<b-field grouped>
<div class="control">
<button type="button" class="button is-primary" @click="submit()">
<translate>Create my profile</translate>
{{ $t('Create my profile') }}
</button>
</div>
</b-field>
@@ -50,15 +50,13 @@
<div v-if="validationSent && !userAlreadyActivated">
<b-message title="Success" type="is-success">
<h2 class="title">
<translate
:translate-params="{ username: person.preferredUsername }"
>Your account is nearly ready, %{username}</translate>
{{ $t('Your account is nearly ready, {username}', { username: person.preferredUsername }) }}
</h2>
<p>
<translate>A validation email was sent to %{email}</translate>
{{ $t('A validation email was sent to {email}', { email }) }}
</p>
<p>
<translate>Before you can login, you need to click on the link inside it to validate your account</translate>
{{ $t('Before you can login, you need to click on the link inside it to validate your account') }}
</p>
</b-message>
</div>

View File

@@ -2,16 +2,16 @@
<div class="root">
<h1 class="title">
<span v-if="isUpdate">{{ identity.displayName() }}</span>
<translate v-else>I create an identity</translate>
<span v-else>{{ $t('I create an identity') }}</span>
</h1>
<picture-upload v-model="avatarFile" class="picture-upload"></picture-upload>
<b-field :label="$gettext('Display name')">
<b-field :label="$t('Display name')">
<b-input aria-required="true" required v-model="identity.name" @input="autoUpdateUsername($event)"/>
</b-field>
<b-field :label="$gettext('Username')">
<b-field :label="$t('Username')">
<b-field>
<b-input aria-required="true" required v-model="identity.preferredUsername" :disabled="isUpdate"/>
@@ -21,7 +21,7 @@
</b-field>
</b-field>
<b-field :label="$gettext('Description')">
<b-field :label="$t('Description')">
<b-input type="textarea" aria-required="false" v-model="identity.summary"/>
</b-field>
@@ -37,15 +37,15 @@
<b-field class="submit">
<div class="control">
<button v-translate type="button" class="button is-primary" @click="submit()">
Save
<button type="button" class="button is-primary" @click="submit()">
{{ $t('Save') }}
</button>
</div>
</b-field>
<div class="delete-identity" v-if="isUpdate">
<span v-translate @click="openDeleteIdentityConfirmation()">
Delete this identity
<span @click="openDeleteIdentityConfirmation()">
{{ $t('Delete this identity') }}
</span>
</div>
</div>
@@ -177,7 +177,7 @@ export default class EditIdentity extends Vue {
});
this.$notifier.success(
this.$gettextInterpolate('Identity %{displayName} deleted', { displayName: this.identity.displayName() }),
this.$t('Identity {displayName} deleted', { displayName: this.identity.displayName() }) as string,
);
/**
* If we just deleted the current identity, we need to change it to the next one
@@ -213,7 +213,7 @@ export default class EditIdentity extends Vue {
});
this.$notifier.success(
this.$gettextInterpolate('Identity %{displayName} updated', { displayName: this.identity.displayName() }),
this.$t('Identity {displayName} updated', { displayName: this.identity.displayName() }) as string,
);
} catch (err) {
this.handleError(err);
@@ -237,7 +237,7 @@ export default class EditIdentity extends Vue {
});
this.$notifier.success(
this.$gettextInterpolate('Identity %{displayName} created', { displayName: this.identity.displayName() }),
this.$t('Identity {displayName} created', { displayName: this.identity.displayName() }) as string,
);
await this.$router.push({ name: RouteName.UPDATE_IDENTITY, params: { identityName: this.identity.preferredUsername } });
@@ -253,18 +253,17 @@ export default class EditIdentity extends Vue {
openDeleteIdentityConfirmation() {
this.$buefy.dialog.prompt({
type: 'is-danger',
title: this.$gettext('Delete your identity'),
message: this.$gettextInterpolate(
'This will delete / anonymize all content (events, comments, messages, participation...) created from this identity. <br /><br />' +
'If this identity is the only administrator of some groups, you need to delete them before being able to delete this identity. ' +
'Otherwise this identity will just be removed from the group administrators.<br /><br />' +
'To confirm, type your identity username "%{preferredUsername}"',
title: this.$t('Delete your identity') as string,
message: `${this.$t('This will delete / anonymize all content (events, comments, messages, participations…) created from this identity.')}
<br /><br />
${this.$t('If this identity is the only administrator of some groups, you need to delete them before being able to delete this identity.')}
${this.$t('Otherwise this identity will just be removed from the group administrators.')}
<br /><br />
${this.$t('To confirm, type your identity username "{preferredUsername}"', { preferredUsername: this.identity.preferredUsername })}`,
confirmText: this.$t(
'Delete {preferredUsername}',
{ preferredUsername: this.identity.preferredUsername },
),
confirmText: this.$gettextInterpolate(
'Delete %{preferredUsername}',
{ preferredUsername: this.identity.preferredUsername },
),
) as string,
inputAttrs: {
placeholder: this.identity.preferredUsername,
pattern: this.identity.preferredUsername,