diff --git a/src-electron/preload/hooks-preload.ts b/src-electron/preload/hooks-preload.ts new file mode 100644 index 000000000..78eb8b4f9 --- /dev/null +++ b/src-electron/preload/hooks-preload.ts @@ -0,0 +1,5 @@ +import { ipcRenderer } from 'electron'; + +export function once(hookName: string, callback: Function) { + ipcRenderer.once(hookName, (event, ...args) => callback(...args)); +} diff --git a/src/App.vue b/src/App.vue index d5049e349..66aef5a8a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -58,6 +58,7 @@ import { NodeFsImplementation } from './providers/node/fs/NodeFsImplementation'; import { useRouter } from 'vue-router'; import { ProtocolProviderImplementation } from './providers/generic/protocol/ProtocolProviderImplementation'; import { provideProtocolImplementation } from './providers/generic/protocol/ProtocolProvider'; +import { useI18n } from 'vue-i18n'; import BreadcrumbNavigator from 'components/breadcrumbs/BreadcrumbNavigator.vue'; const store = baseStore; @@ -150,6 +151,19 @@ onMounted(async () => { watchEffect(() => { document.documentElement.classList.toggle('html--dark', quasar.dark.isActive); }) + +const { locale } = useI18n(); + +document.addEventListener('keydown', (e: KeyboardEvent) => { + if (e.altKey && ['l', '¬'].includes(e.key.toLowerCase())) { + console.log("Switch lang"); + if (locale.value === 'en') { + locale.value = 'fr'; + } else { + locale.value = 'en'; + } + } +}) + + + + + diff --git a/src/components/views/DownloadModVersionSelectModal.vue b/src/components/views/DownloadModVersionSelectModal.vue index d42a964b7..c66d1ab44 100644 --- a/src/components/views/DownloadModVersionSelectModal.vue +++ b/src/components/views/DownloadModVersionSelectModal.vue @@ -2,12 +2,12 @@ @@ -66,8 +68,10 @@ import { State } from '../../store'; import ThunderstoreMod from '../../model/ThunderstoreMod'; import ThunderstoreCombo from "../../model/ThunderstoreCombo"; import { InstallMode } from "../../utils/DependencyUtils"; +import { useI18n } from 'vue-i18n'; const store = getStore(); +const { t } = useI18n(); const versionNumbers = ref([]); const recommendedVersion = ref(null); diff --git a/src/components/views/DownloadProgressModal.vue b/src/components/views/DownloadProgressModal.vue index 9ba5e6241..54377ddcf 100644 --- a/src/components/views/DownloadProgressModal.vue +++ b/src/components/views/DownloadProgressModal.vue @@ -5,8 +5,10 @@ import { State } from '../../store'; import * as DownloadUtils from '../../utils/DownloadUtils'; import FileUtils from '../../utils/FileUtils'; import { DownloadStatusEnum } from '../../model/enums/DownloadStatusEnum'; +import { useI18n } from 'vue-i18n'; const store = getStore(); +const { t } = useI18n(); function closeModal() { store.commit("closeDownloadProgressModal"); @@ -26,23 +28,20 @@ function closeModal() {

- Downloading {{store.getters['download/currentDownload'].modName}} + {{ t('translations.pages.manager.modals.downloadProgress.states.downloading', { modName: store.getters['download/currentDownload'].modName }) }}

- Installing {{store.getters['download/currentDownload'].modName}} + {{ t('translations.pages.manager.modals.downloadProgress.states.installing', { modName: store.getters['download/currentDownload'].modName }) }}

-

- Downloading: {{store.getters['download/currentDownload'].downloadProgress}}% of - {{FileUtils.humanReadableSize(store.getters['download/currentDownload'].totalDownloadSize)}} + {{ t('translations.pages.manager.modals.downloadProgress.downloadProgress', { progress: store.getters['download/currentDownload'].downloadProgress, totalSize: FileUtils.humanReadableSize(store.getters['download/currentDownload'].totalDownloadSize) }) }}

- Extracting: {{store.getters['download/currentDownload'].downloadProgress}}% of - {{FileUtils.humanReadableSize(store.getters['download/currentDownload'].totalDownloadSize)}} + {{ t('translations.pages.manager.modals.downloadProgress.extractionProgress', { progress: store.getters['download/currentDownload'].downloadProgress, totalSize: FileUtils.humanReadableSize(store.getters['download/currentDownload'].totalDownloadSize) }) }}

@@ -58,11 +57,11 @@ function closeModal() {

- Installing: {{store.getters['download/currentDownload'].installProgress}}% + {{ t('translations.pages.manager.modals.downloadProgress.installProgress', { progress: store.getters['download/currentDownload'].installProgress }) }}

- Installing: waiting for download to finish + {{ t('translations.pages.manager.modals.downloadProgress.waitingForDownload') }}


-

Looks like you don't have any mods installed

+

+ {{ t('translations.pages.manager.installed.noModsInstalled.title') }} +

- Click the Online tab on the left, or click - here. + {{ t('translations.pages.manager.installed.noModsInstalled.content') }}

@@ -21,8 +22,10 @@
- You have {{ numberOfModsWithUpdates }} available mod update{{ numberOfModsWithUpdates > 1 ? "s" : ""}}. - Would you like to update all? + {{ t('translations.pages.manager.installed.updatableModsBanner.text', numberOfModsWithUpdates, { named: { numberOfModsWithUpdates: numberOfModsWithUpdates } }) }} + + {{ t('translations.pages.manager.installed.updatableModsBanner.updateAction') }} + @@ -42,8 +45,10 @@ import ManifestV2 from '../../model/ManifestV2'; import LocalModListProvider from '../../providers/components/loaders/LocalModListProvider'; import { getStore } from '../../providers/generic/store/StoreProvider'; import { State } from '../../store'; +import { useI18n } from 'vue-i18n'; const store = getStore(); +const { t } = useI18n(); // const LocalModList = computed(() => LocalModListProvider.provider); const LocalModList = defineAsyncComponent(() => LocalModListProvider.provider()); diff --git a/src/components/views/LocalModList/LocalModCard.vue b/src/components/views/LocalModList/LocalModCard.vue index 33a6af0c1..efae20619 100644 --- a/src/components/views/LocalModList/LocalModCard.vue +++ b/src/components/views/LocalModList/LocalModCard.vue @@ -12,8 +12,10 @@ import { splitToNameAndVersion } from '../../../utils/DependencyUtils'; import { computed, onMounted, ref, watch } from 'vue'; import { getStore } from '../../../providers/generic/store/StoreProvider'; import { State } from '../../../store'; +import { useI18n } from 'vue-i18n'; const store = getStore(); +const { t, d, messages, locale } = useI18n(); type LocalModCardProps = { mod: ManifestV2; @@ -194,21 +196,18 @@ function dependencyStringToModName(x: string) { - Deprecated + {{ t('translations.pages.manager.installed.localModCard.labels.deprecated') }} - Disabled + {{ t('translations.pages.manager.installed.localModCard.labels.disabled') }} - {{mod.getDisplayName()}} + {{ mod.getDisplayName() }} - - by {{mod.getAuthorName()}} + {{ t('translations.pages.manager.installed.localModCard.display.byline', { version: mod.getVersionNumber(), author: mod.getAuthorName() }) }} @@ -216,7 +215,9 @@ function dependencyStringToModName(x: string) { @@ -225,11 +226,12 @@ function dependencyStringToModName(x: string) { - + - @@ -241,47 +243,51 @@ function dependencyStringToModName(x: string) { type="checkbox" :class="['switch', 'is-small', {'switch is-info' : mod.isEnabled()}]" :checked="mod.isEnabled()" /> - + +
- Website + {{ t('translations.pages.manager.installed.localModCard.actions.openWebsite') }} diff --git a/src/components/views/LocalModList/SearchAndSort.vue b/src/components/views/LocalModList/SearchAndSort.vue index 6f288f7f6..354f7e946 100644 --- a/src/components/views/LocalModList/SearchAndSort.vue +++ b/src/components/views/LocalModList/SearchAndSort.vue @@ -6,8 +6,11 @@ import { getStore } from '../../../providers/generic/store/StoreProvider'; import { State } from '../../../store'; import { computed } from 'vue'; import DeferredInput from '../../DeferredInput.vue'; +import { useI18n } from 'vue-i18n'; +import EnumResolver from '../../../model/enums/_EnumResolver'; const store = getStore(); +const { t } = useI18n(); const order = computed({ get() { @@ -56,46 +59,52 @@ const disabledOptions = computed(() => Object.values(SortLocalDisabledMods));
- +
- +
- +
diff --git a/src/components/views/OnlineModList.vue b/src/components/views/OnlineModList.vue index f257614f4..0b6f89759 100644 --- a/src/components/views/OnlineModList.vue +++ b/src/components/views/OnlineModList.vue @@ -8,35 +8,52 @@ - + - Website + {{ t('translations.pages.manager.online.modList.actions.website') }} +