@@ -15,10 +15,12 @@ import { useProfilesComposable } from '../composables/ProfilesComposable';
1515import { computed , nextTick , ref , watch , watchEffect } from ' vue' ;
1616import { getStore } from ' ../../providers/generic/store/StoreProvider' ;
1717import { State } from ' ../../store' ;
18+ import {useI18n } from " vue-i18n" ;
1819
1920const VALID_PROFILE_CODE_REGEX = / ^ [0-9a-f ] {8} -[0-9a-f ] {4} -[0-9a-f ] {4} -[0-9a-f ] {4} -[0-9a-f ] {12} $ / i ;
2021
2122const store = getStore <State >();
23+ const { t } = useI18n ();
2224
2325const {
2426 doesProfileExist,
@@ -250,9 +252,12 @@ async function onImportTargetSelected() {
250252async function importProfile(targetProfileName : string , mods : ExportMod [], zipPath : string ) {
251253 activeStep .value = ' PROFILE_IS_BEING_IMPORTED' ;
252254 importPhaseDescription .value = ' Downloading mods: 0%' ;
253- const progressCallback = (progress : number | string ) => typeof progress === " number"
254- ? importPhaseDescription .value = ` Downloading mods: ${Math .floor (progress )}% `
255- : importPhaseDescription .value = progress ;
255+ const progressCallback = (progress : number | string , modName : string , status : number ) => {
256+ console .log (progress );
257+ return typeof progress === " number"
258+ ? importPhaseDescription .value = t (' translations.pages.profileSelection.importProfileModal.states.importInProgress.title.downloadingMods' , {progress: Math .floor (progress )})
259+ : importPhaseDescription .value = t (` translations.pages.profileSelection.importProfileModal.states.importInProgress.title.${progress } ` , {progress: status })
260+ };
256261 const isUpdate = importUpdateSelection .value === ' UPDATE' ;
257262
258263 try {
@@ -280,31 +285,42 @@ function onContentOrPathNotSet() {
280285<template >
281286 <ModalCard id =" import-profile-from-file-or-code-modal" v-if =" activeStep === 'FILE_CODE_SELECTION'" key =" FILE_CODE_SELECTION" :is-active =" isOpen" @close-modal =" closeModal" >
282287 <template v-slot :header >
283- <h2 class =" modal-title" v-if =" importUpdateSelection === 'CREATE'" >How are you importing a profile?</h2 >
284- <h2 class =" modal-title" v-if =" importUpdateSelection === 'UPDATE'" >How are you updating your profile?</h2 >
288+ <h2 class =" modal-title" >
289+ {{ t('translations.pages.profileSelection.importProfileModal.states.fileCodeSelection.title') }}
290+ </h2 >
285291 </template >
286292 <template v-slot :footer >
287293 <button id =" modal-import-profile-file"
288294 class =" button is-info"
289- @click =" onFileOrCodeSelect('FILE')" >From file</button >
295+ @click =" onFileOrCodeSelect('FILE')" >
296+ {{ t('translations.pages.profileSelection.importProfileModal.states.fileCodeSelection.actions.fromFile') }}
297+ </button >
290298 <button id =" modal-import-profile-code"
291299 class =" button is-primary"
292- @click =" onFileOrCodeSelect('CODE')" >From code</button >
300+ @click =" onFileOrCodeSelect('CODE')" >
301+ {{ t('translations.pages.profileSelection.importProfileModal.states.fileCodeSelection.actions.fromCode') }}
302+ </button >
293303 </template >
294304 </ModalCard >
295305
296306 <ModalCard id =" import-profile-from-file-modal" v-else-if =" activeStep === 'IMPORT_FILE'" key =" IMPORT_FILE" :is-active =" isOpen" @close-modal =" closeModal" >
297307 <template v-slot :header >
298- <h2 class =" modal-title" >Loading file</h2 >
308+ <h2 class =" modal-title" >
309+ {{ t('translations.pages.profileSelection.importProfileModal.states.fromFile.title') }}
310+ </h2 >
299311 </template >
300312 <template v-slot :footer >
301- <p >A file selection window will appear. Once a profile has been selected it may take a few moments.</p >
313+ <p >
314+ {{ t('translations.pages.profileSelection.importProfileModal.states.fromFile.content') }}
315+ </p >
302316 </template >
303317 </ModalCard >
304318
305319 <ModalCard id =" import-profile-from-code-modal" v-else-if =" activeStep === 'IMPORT_CODE'" :can-close =" !importViaCodeInProgress" key =" IMPORT_CODE" :is-active =" isOpen" @close-modal =" closeModal" >
306320 <template v-slot :header >
307- <h2 class =" modal-title" >Enter the profile code</h2 >
321+ <h2 class =" modal-title" >
322+ {{ t('translations.pages.profileSelection.importProfileModal.states.importCode.title') }}
323+ </h2 >
308324 </template >
309325 <template v-slot :body >
310326 <input
@@ -314,13 +330,13 @@ function onContentOrPathNotSet() {
314330 class =" input"
315331 type =" text"
316332 ref =" profileCodeInput"
317- placeholder =" Enter the profile code "
333+ : placeholder =" t('translations.pages.profileSelection.importProfileModal.states.importCode.enterCodePlaceholder') "
318334 autocomplete =" off"
319335 />
320336 <br />
321337 <br />
322338 <span class =" tag is-danger" v-if =" profileImportCode !== '' && !isProfileCodeValid" >
323- Invalid code, check for typos
339+ {{ t('translations.pages.profileSelection.importProfileModal.states.importCode.tagStates.invalid') }}
324340 </span >
325341 </template >
326342 <template v-slot :footer >
@@ -329,46 +345,58 @@ function onContentOrPathNotSet() {
329345 id =" modal-import-profile-from-code"
330346 class =" button is-info"
331347 @click =" onProfileCodeEntered();" >
332- {{importViaCodeInProgress ? 'Loading...' : 'Continue'}}
348+ <template v-if =" importViaCodeInProgress " >
349+ {{ t('translations.pages.profileSelection.importProfileModal.states.importCode.actions.loading') }}
350+ </template >
351+ <template v-else >
352+ {{ t('translations.pages.profileSelection.importProfileModal.states.importCode.actions.proceed') }}
353+ </template >
333354 </button >
334355 </template >
335356 </ModalCard >
336357
337358 <ModalCard id =" import-profile-refresh-mod-list-modal" v-else-if =" activeStep === 'REFRESH_MOD_LIST'" key =" REFRESH_MOD_LIST" :is-active =" isOpen" :can-close =" false" >
338359 <template v-slot :header >
339- <h2 class =" modal-title" >Refreshing online mod list</h2 >
360+ <h2 class =" modal-title" >
361+ {{ t('translations.pages.profileSelection.importProfileModal.states.refresh.title') }}
362+ </h2 >
340363 </template >
341364 <template v-slot :footer >
342365 <div >
343366 <p >
344- Some of the packages in the profile are not recognized by the mod manager.
345- Refreshing the online mod list might fix the problem. Please wait...
367+ {{ t('translations.pages.profileSelection.importProfileModal.states.refresh.description') }}
346368 </p >
347369 <p v-if =" store.getters['download/activeDownloadCount'] > 0" class =" margin-top" >
348- Waiting for mod downloads to finish before refreshing the online mod list...
370+ {{ t('translations.pages.profileSelection.importProfileModal.states.refresh.waitingForModDownloads') }}
349371 </p >
350372 <p v-else class =" margin-top" >
351- {{store.state.tsMods.thunderstoreModListUpdateStatus}}
373+ {{ t(`translations.pages.profileSelection.importProfileModal.states.refresh.refreshStatus.${ store.state.tsMods.thunderstoreModListUpdateStatus}`, { progress: store.state.tsMods.thunderstoreModListUpdateProgress }) }}
352374 </p >
353375 </div >
354376 </template >
355377 </ModalCard >
356378
357379 <ModalCard id =" review-profile-import-modal" v-else-if =" activeStep === 'REVIEW_IMPORT'" key =" REVIEW_IMPORT" :is-active =" isOpen" @close-modal =" closeModal" >
358380 <template v-slot :header >
359- <h2 class =" modal-title" >Packages to be installed</h2 >
381+ <h2 class =" modal-title" >
382+ {{ t('translations.pages.profileSelection.importProfileModal.states.reviewImport.title') }}
383+ </h2 >
360384 </template >
361385 <template v-slot :body >
362386 <div v-if =" knownProfileMods.length === 0 || profileMods.unknown.length > 0" class =" notification is-warning" >
363- <p >These packages in the profile were not found on Thunderstore and will not be installed:</p >
387+ <p >
388+ {{ t('translations.pages.profileSelection.importProfileModal.states.reviewImport.content.notFoundDisclaimer') }}
389+ </p >
364390 <p class =" margin-top" >{{ unknownProfileModNames }}</p >
365391
366392 <p v-if =" knownProfileMods.length === 0" class =" margin-top" >
367- Ensure the profile is intended for the currently selected game.
393+ {{ t('translations.pages.profileSelection.importProfileModal.states.reviewImport.content.ensureCorrectProfile') }}
368394 </p >
369395 </div >
370396
371- <p v-if =" knownProfileMods.length > 0 && profileMods.unknown.length > 0" class =" margin-bottom" >These packages will be installed:</p >
397+ <p v-if =" knownProfileMods.length > 0 && profileMods.unknown.length > 0" class =" margin-bottom" >
398+ {{ t('translations.pages.profileSelection.importProfileModal.states.reviewImport.content.packagesWillBeInstalled') }}
399+ </p >
372400 <OnlineModList
373401 v-if =" knownProfileMods.length > 0"
374402 :paged-mod-list =" knownProfileMods"
@@ -384,7 +412,9 @@ function onContentOrPathNotSet() {
384412 class =" is-checkradio has-background-color"
385413 type =" checkbox"
386414 >
387- <label for =" partialImportAllowedCheckbox" >I understand that some of the mods won't be imported</label >
415+ <label for =" partialImportAllowedCheckbox" >
416+ {{ t('translations.pages.profileSelection.importProfileModal.states.reviewImport.actions.acknowledgement') }}
417+ </label >
388418 </div >
389419
390420 <button
@@ -394,36 +424,42 @@ function onContentOrPathNotSet() {
394424 :disabled =" knownProfileMods.length === 0 || (profileMods.unknown.length > 0 && !isPartialImportAllowed)"
395425 @click =" onProfileReviewConfirmed"
396426 >
397- Import
427+ {{ t('translations.pages.profileSelection.importProfileModal.states.reviewImport.actions.proceed') }}
398428 </button >
399429
400430 </template >
401431 </ModalCard >
402432
403433 <ModalCard id =" import-or-update-profile-selection-modal" v-else-if =" activeStep === 'IMPORT_UPDATE_SELECTION'" key =" IMPORT_UPDATE_SELECTION" :is-active =" isOpen" @close-modal =" closeModal" >
404434 <template v-slot :header >
405- <h2 class =" modal-title" >Are you going to be updating an existing profile or creating a new one?</h2 >
435+ <h2 class =" modal-title" >
436+ {{ t('translations.pages.profileSelection.importProfileModal.states.willImportOrUpdate.title') }}
437+ </h2 >
406438 </template >
407439 <template v-slot :footer >
408440 <button id =" modal-import-new-profile"
409441 class =" button is-info"
410442 @click =" onCreateOrUpdateSelect('CREATE')" >
411- Import new profile
443+ {{ t('translations.pages.profileSelection.importProfileModal.states.willImportOrUpdate.actions.newProfile') }}
412444 </button >
413445 <button id =" modal-update-existing-profile"
414446 class =" button is-primary"
415447 @click =" onCreateOrUpdateSelect('UPDATE')" >
416- Update existing profile
448+ {{ t('translations.pages.profileSelection.importProfileModal.states.willImportOrUpdate.actions.existingProfile') }}
417449 </button >
418450 </template >
419451 </ModalCard >
420452
421453 <ModalCard id =" import-add-profile-modal" v-else-if =" activeStep === 'ADDING_PROFILE'" key =" ADDING_PROFILE" :is-active =" isOpen" @close-modal =" closeModal" >
422454 <template v-slot :header >
423- <h2 v-if =" importUpdateSelection === 'CREATE'" class =" modal-title" >Import a profile</h2 >
455+ <h2 class =" modal-title" >
456+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.title') }}
457+ </h2 >
424458 </template >
425459 <template v-slot :body v-if =" importUpdateSelection === ' CREATE' " >
426- <p >This profile will store its own mods independently from other profiles.</p >
460+ <p >
461+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.content.create.description') }}
462+ </p >
427463 <br />
428464 <input
429465 v-model =" targetProfileName"
@@ -436,32 +472,44 @@ function onContentOrPathNotSet() {
436472 />
437473 <br /><br />
438474 <span class =" tag is-dark" v-if =" makeProfileNameSafe(targetProfileName) === ''" >
439- Profile name required
475+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.tagStates. required') }}
440476 </span >
441477 <span class =" tag is-success" v-else-if =" !doesProfileExist(targetProfileName)" >
442- "{{ makeProfileNameSafe(targetProfileName)}}" is available
478+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.tagStates.valid', { profileName: makeProfileNameSafe(targetProfileName) }) }}
443479 </span >
444480 <span class =" tag is-danger" v-else >
445- "{{makeProfileNameSafe(targetProfileName)}}" is either already in use, or contains invalid characters
481+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.tagStates.error', { profileName: makeProfileNameSafe(targetProfileName) }) }}
446482 </span >
447483 </template >
448484 <template v-slot :body v-else-if =" importUpdateSelection === ' UPDATE' " >
449485 <div class =" notification is-warning" >
450- <p >All contents of the profile will be overwritten with the contents of the code/file.</p >
486+ <p >
487+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.content.update.contentsWillBeOverwritten') }}
488+ </p >
451489 </div >
452- <p >Select a profile below:</p >
490+ <p >
491+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.content.update.selectProfile') }}
492+ </p >
453493 <br />
454494 <select class =" select" v-model =" targetProfileName" >
455495 <option v-for =" profile of profileList" :key =" profile" >{{ profile }}</option >
456496 </select >
457497 </template >
458498 <template v-slot :footer v-if =" importUpdateSelection === ' CREATE' " >
459- <button id =" modal-create-profile-invalid" class =" button is-danger" v-if =" doesProfileExist(targetProfileName)" >Create</button >
460- <button id =" modal-create-profile" class =" button is-info" v-else @click =" onImportTargetSelected()" >Create</button >
499+ <button id =" modal-create-profile-invalid" class =" button is-danger" v-if =" doesProfileExist(targetProfileName)" >
500+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.actions.create') }}
501+ </button >
502+ <button id =" modal-create-profile" class =" button is-info" v-else @click =" onImportTargetSelected()" >
503+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.actions.create') }}
504+ </button >
461505 </template >
462506 <template v-slot :footer v-else-if =" importUpdateSelection === ' UPDATE' " >
463- <button id =" modal-update-profile-invalid" class =" button is-danger" v-if =" !doesProfileExist(targetProfileName)" >Update profile: {{ targetProfileName }}</button >
464- <button id =" modal-update-profile" class =" button is-info" v-else @click =" onImportTargetSelected()" >Update profile: {{ targetProfileName }}</button >
507+ <button id =" modal-update-profile-invalid" class =" button is-danger" v-if =" !doesProfileExist(targetProfileName)" >
508+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.actions.update', { profileName: targetProfileName }) }}
509+ </button >
510+ <button id =" modal-update-profile" class =" button is-info" v-else @click =" onImportTargetSelected()" >
511+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.actions.update', { profileName: targetProfileName }) }}
512+ </button >
465513 </template >
466514 </ModalCard >
467515
@@ -471,9 +519,9 @@ function onContentOrPathNotSet() {
471519 </template >
472520 <template v-slot :footer >
473521 <p >
474- This may take a while, as files are being downloaded, extracted, and copied.
522+ {{ t('translations.pages.profileSelection.importProfileModal.states.importInProgress.content.waitMessage') }}
475523 <br ><br >
476- Please do not close {{ appName}}.
524+ {{ t('translations.pages.profileSelection.importProfileModal.states.importInProgress.content.doNotClose', { appName: appName }) }}
477525 </p >
478526 </template >
479527 </ModalCard >
0 commit comments