Skip to content

Commit 5bd17d6

Browse files
committed
Added support for RenameProfileModal
1 parent d9e746f commit 5bd17d6

File tree

5 files changed

+51
-11
lines changed

5 files changed

+51
-11
lines changed

src/components/profiles-modals/DeleteProfileModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async function removeProfile() {
5454
:disabled="deletingInProgress"
5555
class="button is-danger"
5656
@click="removeProfile()">
57-
{{ t('translations.pages.profileSelection.deleteProfileModal.action.delete') }}
57+
{{ t('translations.pages.profileSelection.deleteProfileModal.actions.delete') }}
5858
</button>
5959
</template>
6060

src/components/profiles-modals/RenameProfileModal.vue

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import { useProfilesComposable } from '../composables/ProfilesComposable';
55
import { computed, nextTick, ref, watchEffect } from 'vue';
66
import { getStore } from '../../providers/generic/store/StoreProvider';
77
import { State } from '../../store';
8+
import {useI18n} from "vue-i18n";
89
910
const store = getStore<State>();
11+
const { t } = useI18n();
1012
1113
const {
1214
doesProfileExist,
@@ -60,10 +62,14 @@ async function performRename() {
6062
<ModalCard id="rename-profile-modal" v-if="isOpen" :is-active="isOpen" @close-modal="closeModal">
6163

6264
<template v-slot:header>
63-
<h2 class="modal-title">Rename a profile</h2>
65+
<h2 class="modal-title">
66+
{{ t('translations.pages.profileSelection.renameProfileModal.title') }}
67+
</h2>
6468
</template>
6569
<template v-slot:body>
66-
<p>This profile will store its own mods independently from other profiles.</p>
70+
<p>
71+
{{ t('translations.pages.profileSelection.renameProfileModal.content') }}
72+
</p>
6773

6874
<input
6975
v-model="newProfileName"
@@ -75,18 +81,22 @@ async function performRename() {
7581
/>
7682

7783
<span class="tag is-dark" v-if="newProfileName === '' || makeProfileNameSafe(newProfileName) === ''">
78-
Profile name required
84+
{{ t('translations.pages.profileSelection.renameProfileModal.tagStates.required') }}
7985
</span>
8086
<span class="tag is-success" v-else-if="!doesProfileExist(newProfileName)">
81-
"{{makeProfileNameSafe(newProfileName)}}" is available
87+
{{ t('translations.pages.profileSelection.renameProfileModal.tagStates.valid', { profileName: makeProfileNameSafe(newProfileName) }) }}
8288
</span>
8389
<span class="tag is-danger" v-else-if="doesProfileExist(newProfileName)">
84-
"{{makeProfileNameSafe(newProfileName)}}" is either already in use, or contains invalid characters
90+
{{ t('translations.pages.profileSelection.renameProfileModal.tagStates.error', { profileName: makeProfileNameSafe(newProfileName) }) }}
8591
</span>
8692
</template>
8793
<template v-slot:footer>
88-
<button class="button is-danger" v-if="doesProfileExist(newProfileName)" disabled>Rename</button>
89-
<button class="button is-info" @click="performRename()" :disabled="renamingInProgress" v-else>Rename</button>
94+
<button class="button is-danger" v-if="doesProfileExist(newProfileName)" disabled>
95+
{{ t('translations.pages.profileSelection.renameProfileModal.actions.rename') }}
96+
</button>
97+
<button class="button is-info" @click="performRename()" :disabled="renamingInProgress" v-else>
98+
{{ t('translations.pages.profileSelection.renameProfileModal.actions.rename') }}
99+
</button>
90100
</template>
91101

92102
</ModalCard>

src/i18n/base/pages/ProfileSelectionMessageFormat.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,21 @@ export type ProfileSelectionMessageFormat = {
3434
preventAction: string;
3535
confirmation: string;
3636
},
37-
action: {
37+
actions: {
3838
delete: string;
3939
}
4040
},
4141
renameProfileModal: {
42+
title: string;
43+
content: string;
44+
actions: {
45+
rename: string;
46+
},
47+
tagStates: {
48+
required: string;
49+
valid: string;
50+
error: string;
51+
},
4252
},
4353
importProfileModal: {
4454
}

src/i18n/en/pages/ProfileSelectionTranslation.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,21 @@ export const ProfileSelectionTranslation: ProfileSelectionMessageFormat = {
3636
preventAction: 'If this was an accident, click either the darkened area, or the cross inside located in the top right.',
3737
confirmation: 'Are you sure you\'d like to delete this profile?',
3838
},
39-
action: {
39+
actions: {
4040
delete: 'Delete profile',
4141
}
4242
},
4343
renameProfileModal: {
44+
title: 'Rename a profile',
45+
content: 'This profile will store its own mods independently from other profiles.',
46+
actions: {
47+
rename: 'Rename',
48+
},
49+
tagStates: {
50+
required: 'You must enter a profile name',
51+
valid: '"{profileName}" is a valid profile name',
52+
error: '"{profileName}" is either already in use or contains invalid characters'
53+
},
4454
},
4555
importProfileModal: {
4656
}

src/i18n/fr/pages/ProfileSelectionTranslation.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,21 @@ export const ProfileSelectionTranslation: ProfileSelectionMessageFormat = {
3636
preventAction: 'Si c\'est une erreur, cliquez sur la zone assombrie ou sur la croix en haut à droite.',
3737
confirmation: 'Êtes-vous sûr de vouloir supprimer ce profil ?'
3838
},
39-
action: {
39+
actions: {
4040
delete: 'Supprimer le profil'
4141
}
4242
},
4343
renameProfileModal: {
44+
title: 'Renommer un profil',
45+
content: 'Ce profil stockera ses propres mods indépendamment des autres profils.',
46+
actions: {
47+
rename: 'Renommer',
48+
},
49+
tagStates: {
50+
required: 'Vous devez entrer un nom de profil',
51+
valid: '"{profileName}" est un nom de profil valide',
52+
error: '"{profileName}" est déjà utilisé ou contient des caractères non valides'
53+
},
4454
},
4555
importProfileModal: {
4656
}

0 commit comments

Comments
 (0)