@@ -17,10 +17,12 @@ import { getStore } from '../../providers/generic/store/StoreProvider';
1717import { State } from ' ../../store' ;
1818import FileUtils from " ../../utils/FileUtils" ;
1919import * as DownloadUtils from " ../../utils/DownloadUtils" ;
20+ import {useI18n } from " vue-i18n" ;
2021
2122const 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 ;
2223
2324const store = getStore <State >();
25+ const { t } = useI18n ();
2426
2527const {
2628 doesProfileExist,
@@ -253,9 +255,11 @@ async function onImportTargetSelected() {
253255async function importProfile(targetProfileName : string , mods : ExportMod [], zipPath : string ) {
254256 activeStep .value = ' PROFILE_IS_BEING_IMPORTED' ;
255257 importPhaseDescription .value = ' Downloading mods: 0%' ;
256- const progressCallback = (downloadedSize : number ) => {
257- importPhaseDescription .value = ` Downloading mods: ${DownloadUtils .generateProgressPercentage (downloadedSize , profileTotalDownloadSize .value )}% ` +
258- ` of ${FileUtils .humanReadableSize (profileTotalDownloadSize .value )} ` ;
258+ const progressCallback = (progress : number | string , modName : string , status : number ) => {
259+ console .log (progress );
260+ return typeof progress === " number"
261+ ? importPhaseDescription .value = t (' translations.pages.profileSelection.importProfileModal.states.importInProgress.title.downloadingMods' , {progress: Math .floor (progress ), totalSize: FileUtils .humanReadableSize (profileTotalDownloadSize .value )})
262+ : importPhaseDescription .value = t (` translations.pages.profileSelection.importProfileModal.states.importInProgress.title.${progress } ` , {progress: status , totalSize: FileUtils .humanReadableSize (profileTotalDownloadSize .value )})
259263 };
260264 const isUpdate = importUpdateSelection .value === ' UPDATE' ;
261265
@@ -288,31 +292,42 @@ function onContentOrPathNotSet() {
288292<template >
289293 <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" >
290294 <template v-slot :header >
291- <h2 class =" modal-title" v-if =" importUpdateSelection === 'CREATE'" >How are you importing a profile?</h2 >
292- <h2 class =" modal-title" v-if =" importUpdateSelection === 'UPDATE'" >How are you updating your profile?</h2 >
295+ <h2 class =" modal-title" >
296+ {{ t('translations.pages.profileSelection.importProfileModal.states.fileCodeSelection.title') }}
297+ </h2 >
293298 </template >
294299 <template v-slot :footer >
295300 <button id =" modal-import-profile-file"
296301 class =" button is-info"
297- @click =" onFileOrCodeSelect('FILE')" >From file</button >
302+ @click =" onFileOrCodeSelect('FILE')" >
303+ {{ t('translations.pages.profileSelection.importProfileModal.states.fileCodeSelection.actions.fromFile') }}
304+ </button >
298305 <button id =" modal-import-profile-code"
299306 class =" button is-primary"
300- @click =" onFileOrCodeSelect('CODE')" >From code</button >
307+ @click =" onFileOrCodeSelect('CODE')" >
308+ {{ t('translations.pages.profileSelection.importProfileModal.states.fileCodeSelection.actions.fromCode') }}
309+ </button >
301310 </template >
302311 </ModalCard >
303312
304313 <ModalCard id =" import-profile-from-file-modal" v-else-if =" activeStep === 'IMPORT_FILE'" key =" IMPORT_FILE" :is-active =" isOpen" @close-modal =" closeModal" >
305314 <template v-slot :header >
306- <h2 class =" modal-title" >Loading file</h2 >
315+ <h2 class =" modal-title" >
316+ {{ t('translations.pages.profileSelection.importProfileModal.states.fromFile.title') }}
317+ </h2 >
307318 </template >
308319 <template v-slot :footer >
309- <p >A file selection window will appear. Once a profile has been selected it may take a few moments.</p >
320+ <p >
321+ {{ t('translations.pages.profileSelection.importProfileModal.states.fromFile.content') }}
322+ </p >
310323 </template >
311324 </ModalCard >
312325
313326 <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" >
314327 <template v-slot :header >
315- <h2 class =" modal-title" >Enter the profile code</h2 >
328+ <h2 class =" modal-title" >
329+ {{ t('translations.pages.profileSelection.importProfileModal.states.importCode.title') }}
330+ </h2 >
316331 </template >
317332 <template v-slot :body >
318333 <input
@@ -322,13 +337,13 @@ function onContentOrPathNotSet() {
322337 class =" input"
323338 type =" text"
324339 ref =" profileCodeInput"
325- placeholder =" Enter the profile code "
340+ : placeholder =" t('translations.pages.profileSelection.importProfileModal.states.importCode.enterCodePlaceholder') "
326341 autocomplete =" off"
327342 />
328343 <br />
329344 <br />
330345 <span class =" tag is-danger" v-if =" profileImportCode !== '' && !isProfileCodeValid" >
331- Invalid code, check for typos
346+ {{ t('translations.pages.profileSelection.importProfileModal.states.importCode.tagStates.invalid') }}
332347 </span >
333348 </template >
334349 <template v-slot :footer >
@@ -337,46 +352,58 @@ function onContentOrPathNotSet() {
337352 id =" modal-import-profile-from-code"
338353 class =" button is-info"
339354 @click =" onProfileCodeEntered();" >
340- {{importViaCodeInProgress ? 'Loading...' : 'Continue'}}
355+ <template v-if =" importViaCodeInProgress " >
356+ {{ t('translations.pages.profileSelection.importProfileModal.states.importCode.actions.loading') }}
357+ </template >
358+ <template v-else >
359+ {{ t('translations.pages.profileSelection.importProfileModal.states.importCode.actions.proceed') }}
360+ </template >
341361 </button >
342362 </template >
343363 </ModalCard >
344364
345365 <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" >
346366 <template v-slot :header >
347- <h2 class =" modal-title" >Refreshing online mod list</h2 >
367+ <h2 class =" modal-title" >
368+ {{ t('translations.pages.profileSelection.importProfileModal.states.refresh.title') }}
369+ </h2 >
348370 </template >
349371 <template v-slot :footer >
350372 <div >
351373 <p >
352- Some of the packages in the profile are not recognized by the mod manager.
353- Refreshing the online mod list might fix the problem. Please wait...
374+ {{ t('translations.pages.profileSelection.importProfileModal.states.refresh.description') }}
354375 </p >
355376 <p v-if =" store.getters['download/activeDownloadCount'] > 0" class =" margin-top" >
356- Waiting for mod downloads to finish before refreshing the online mod list...
377+ {{ t('translations.pages.profileSelection.importProfileModal.states.refresh.waitingForModDownloads') }}
357378 </p >
358379 <p v-else class =" margin-top" >
359- {{store.state.tsMods.thunderstoreModListUpdateStatus}}
380+ {{ t(`translations.pages.profileSelection.importProfileModal.states.refresh.refreshStatus.${ store.state.tsMods.thunderstoreModListUpdateStatus}`, { progress: store.state.tsMods.thunderstoreModListUpdateProgress }) }}
360381 </p >
361382 </div >
362383 </template >
363384 </ModalCard >
364385
365386 <ModalCard id =" review-profile-import-modal" v-else-if =" activeStep === 'REVIEW_IMPORT'" key =" REVIEW_IMPORT" :is-active =" isOpen" @close-modal =" closeModal" >
366387 <template v-slot :header >
367- <h2 class =" modal-title" >Packages to be installed</h2 >
388+ <h2 class =" modal-title" >
389+ {{ t('translations.pages.profileSelection.importProfileModal.states.reviewImport.title') }}
390+ </h2 >
368391 </template >
369392 <template v-slot :body >
370393 <div v-if =" knownProfileMods.length === 0 || profileMods.unknown.length > 0" class =" notification is-warning" >
371- <p >These packages in the profile were not found on Thunderstore and will not be installed:</p >
394+ <p >
395+ {{ t('translations.pages.profileSelection.importProfileModal.states.reviewImport.content.notFoundDisclaimer') }}
396+ </p >
372397 <p class =" margin-top" >{{ unknownProfileModNames }}</p >
373398
374399 <p v-if =" knownProfileMods.length === 0" class =" margin-top" >
375- Ensure the profile is intended for the currently selected game.
400+ {{ t('translations.pages.profileSelection.importProfileModal.states.reviewImport.content.ensureCorrectProfile') }}
376401 </p >
377402 </div >
378403
379- <p v-if =" knownProfileMods.length > 0 && profileMods.unknown.length > 0" class =" margin-bottom" >These packages will be installed:</p >
404+ <p v-if =" knownProfileMods.length > 0 && profileMods.unknown.length > 0" class =" margin-bottom" >
405+ {{ t('translations.pages.profileSelection.importProfileModal.states.reviewImport.content.packagesWillBeInstalled') }}
406+ </p >
380407 <OnlineModList
381408 v-if =" knownProfileMods.length > 0"
382409 :paged-mod-list =" knownProfileMods"
@@ -392,7 +419,9 @@ function onContentOrPathNotSet() {
392419 class =" is-checkradio has-background-color"
393420 type =" checkbox"
394421 >
395- <label for =" partialImportAllowedCheckbox" >I understand that some of the mods won't be imported</label >
422+ <label for =" partialImportAllowedCheckbox" >
423+ {{ t('translations.pages.profileSelection.importProfileModal.states.reviewImport.actions.acknowledgement') }}
424+ </label >
396425 </div >
397426
398427 <button
@@ -402,36 +431,42 @@ function onContentOrPathNotSet() {
402431 :disabled =" knownProfileMods.length === 0 || (profileMods.unknown.length > 0 && !isPartialImportAllowed)"
403432 @click =" onProfileReviewConfirmed"
404433 >
405- Import
434+ {{ t('translations.pages.profileSelection.importProfileModal.states.reviewImport.actions.proceed') }}
406435 </button >
407436
408437 </template >
409438 </ModalCard >
410439
411440 <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" >
412441 <template v-slot :header >
413- <h2 class =" modal-title" >Are you going to be updating an existing profile or creating a new one?</h2 >
442+ <h2 class =" modal-title" >
443+ {{ t('translations.pages.profileSelection.importProfileModal.states.willImportOrUpdate.title') }}
444+ </h2 >
414445 </template >
415446 <template v-slot :footer >
416447 <button id =" modal-import-new-profile"
417448 class =" button is-info"
418449 @click =" onCreateOrUpdateSelect('CREATE')" >
419- Import new profile
450+ {{ t('translations.pages.profileSelection.importProfileModal.states.willImportOrUpdate.actions.newProfile') }}
420451 </button >
421452 <button id =" modal-update-existing-profile"
422453 class =" button is-primary"
423454 @click =" onCreateOrUpdateSelect('UPDATE')" >
424- Update existing profile
455+ {{ t('translations.pages.profileSelection.importProfileModal.states.willImportOrUpdate.actions.existingProfile') }}
425456 </button >
426457 </template >
427458 </ModalCard >
428459
429460 <ModalCard id =" import-add-profile-modal" v-else-if =" activeStep === 'ADDING_PROFILE'" key =" ADDING_PROFILE" :is-active =" isOpen" @close-modal =" closeModal" >
430461 <template v-slot :header >
431- <h2 v-if =" importUpdateSelection === 'CREATE'" class =" modal-title" >Import a profile</h2 >
462+ <h2 class =" modal-title" >
463+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.title') }}
464+ </h2 >
432465 </template >
433466 <template v-slot :body v-if =" importUpdateSelection === ' CREATE' " >
434- <p >This profile will store its own mods independently from other profiles.</p >
467+ <p >
468+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.content.create.description') }}
469+ </p >
435470 <br />
436471 <input
437472 v-model =" targetProfileName"
@@ -444,32 +479,44 @@ function onContentOrPathNotSet() {
444479 />
445480 <br /><br />
446481 <span class =" tag is-dark" v-if =" makeProfileNameSafe(targetProfileName) === ''" >
447- Profile name required
482+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.tagStates. required') }}
448483 </span >
449484 <span class =" tag is-success" v-else-if =" !doesProfileExist(targetProfileName)" >
450- "{{ makeProfileNameSafe(targetProfileName)}}" is available
485+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.tagStates.valid', { profileName: makeProfileNameSafe(targetProfileName) }) }}
451486 </span >
452487 <span class =" tag is-danger" v-else >
453- "{{makeProfileNameSafe(targetProfileName)}}" is either already in use, or contains invalid characters
488+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.tagStates.error', { profileName: makeProfileNameSafe(targetProfileName) }) }}
454489 </span >
455490 </template >
456491 <template v-slot :body v-else-if =" importUpdateSelection === ' UPDATE' " >
457492 <div class =" notification is-warning" >
458- <p >All contents of the profile will be overwritten with the contents of the code/file.</p >
493+ <p >
494+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.content.update.contentsWillBeOverwritten') }}
495+ </p >
459496 </div >
460- <p >Select a profile below:</p >
497+ <p >
498+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.content.update.selectProfile') }}
499+ </p >
461500 <br />
462501 <select class =" select" v-model =" targetProfileName" >
463502 <option v-for =" profile of profileList" :key =" profile" >{{ profile }}</option >
464503 </select >
465504 </template >
466505 <template v-slot :footer v-if =" importUpdateSelection === ' CREATE' " >
467- <button id =" modal-create-profile-invalid" class =" button is-danger" v-if =" doesProfileExist(targetProfileName)" >Create</button >
468- <button id =" modal-create-profile" class =" button is-info" v-else @click =" onImportTargetSelected()" >Create</button >
506+ <button id =" modal-create-profile-invalid" class =" button is-danger" v-if =" doesProfileExist(targetProfileName)" >
507+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.actions.create') }}
508+ </button >
509+ <button id =" modal-create-profile" class =" button is-info" v-else @click =" onImportTargetSelected()" >
510+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.actions.create') }}
511+ </button >
469512 </template >
470513 <template v-slot :footer v-else-if =" importUpdateSelection === ' UPDATE' " >
471- <button id =" modal-update-profile-invalid" class =" button is-danger" v-if =" !doesProfileExist(targetProfileName)" >Update profile: {{ targetProfileName }}</button >
472- <button id =" modal-update-profile" class =" button is-info" v-else @click =" onImportTargetSelected()" >Update profile: {{ targetProfileName }}</button >
514+ <button id =" modal-update-profile-invalid" class =" button is-danger" v-if =" !doesProfileExist(targetProfileName)" >
515+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.actions.update', { profileName: targetProfileName }) }}
516+ </button >
517+ <button id =" modal-update-profile" class =" button is-info" v-else @click =" onImportTargetSelected()" >
518+ {{ t('translations.pages.profileSelection.importProfileModal.states.addProfile.actions.update', { profileName: targetProfileName }) }}
519+ </button >
473520 </template >
474521 </ModalCard >
475522
@@ -479,9 +526,9 @@ function onContentOrPathNotSet() {
479526 </template >
480527 <template v-slot :footer >
481528 <p >
482- This may take a while, as files are being downloaded, extracted, and copied.
529+ {{ t('translations.pages.profileSelection.importProfileModal.states.importInProgress.content.waitMessage') }}
483530 <br ><br >
484- Please do not close {{ appName}}.
531+ {{ t('translations.pages.profileSelection.importProfileModal.states.importInProgress.content.doNotClose', { appName: appName }) }}
485532 </p >
486533 </template >
487534 </ModalCard >
0 commit comments