From 91d38b58c49238d206373efdd5eafd811f92b083 Mon Sep 17 00:00:00 2001 From: akanyan Date: Sun, 27 Apr 2025 20:30:22 +0000 Subject: [PATCH] fix: localization fixes --- rust/src/modules/package.rs | 10 ++- src/components/App.vue | 7 +- src/components/ModStore.vue | 4 +- src/components/Onboarding.vue | 106 +++++++++++++-------------- src/components/PatchList.vue | 2 +- src/components/ProfileList.vue | 5 +- src/components/options/Display.vue | 16 ++-- src/components/options/Segatools.vue | 4 +- src/i18n.ts | 5 +- src/i18n/en.ts | 17 +++++ 10 files changed, 99 insertions(+), 77 deletions(-) diff --git a/rust/src/modules/package.rs b/rust/src/modules/package.rs index 6f038aa..94d90fc 100644 --- a/rust/src/modules/package.rs +++ b/rust/src/modules/package.rs @@ -7,12 +7,20 @@ use crate::pkg_store::PackageStore; use crate::util; use crate::profiles::types::ProfilePaths; -pub async fn prepare_packages<'a>(p: &'a impl ProfilePaths, pkgs: &BTreeSet, redo_bepinex: bool) -> Result<()> { +pub async fn prepare_packages<'a>(p: &'a impl ProfilePaths, pkgs: &BTreeSet, mut redo_bepinex: bool) -> Result<()> { log::debug!("begin prepare packages"); let pfx_dir = p.data_dir(); let opt_dir = pfx_dir.join("option"); + for m in pkgs { + let (namespace, _) = m.split()?; + if namespace == "local" { + log::info!("package with the 'local' namespace enabled -- force refreshing"); + redo_bepinex = true; + } + } + if redo_bepinex { if pfx_dir.join("BepInEx").exists() { util::remove_dir_all(pfx_dir.join("BepInEx")).await?; diff --git a/src/components/App.vue b/src/components/App.vue index 826f63c..fdb38a9 100644 --- a/src/components/App.vue +++ b/src/components/App.vue @@ -27,6 +27,9 @@ import { usePrfStore, } from '../stores'; import { messageSplit, shouldPreferDark } from '../util'; +import { useI18n } from 'vue-i18n'; + +const { t } = useI18n(); document.documentElement.classList.toggle('use-dark-mode', shouldPreferDark()); @@ -257,7 +260,7 @@ listen('download-progress', (event) => { style="min-width: 0; width: 25dvw" class="self-center" size="small" - placeholder="Search" + :placeholder="t('search')" v-model="general.cfgSearchTerm" /> ('download-progress', (event) => { style="min-width: 0; width: 25dvw" class="self-center" size="small" - placeholder="Search" + :placeholder="t('search')" v-model="pkgSearchTerm" /> diff --git a/src/components/ModStore.vue b/src/components/ModStore.vue index e26b42d..507abea 100644 --- a/src/components/ModStore.vue +++ b/src/components/ModStore.vue @@ -101,7 +101,7 @@ const installRecommended = () => { { -import { ComputedRef, computed, onMounted, ref } from 'vue'; +import { ComputedRef, computed, ref } from 'vue'; import Button from 'primevue/button'; import Carousel from 'primevue/carousel'; import Dialog from 'primevue/dialog'; @@ -27,7 +27,7 @@ interface Datum { const game = computed(() => prf.current?.meta.game); -const processText = (s: string) => { +const processText = computed(() => (s: string) => { // Why do I have to do this s = s .split('\n') @@ -39,14 +39,14 @@ const processText = (s: string) => { if (readable !== null) { return s.replace( '%TESTMENU%', - `${readable} or a button on the back of the controller` + `${readable} ${t('onboarding.or')} ${t('onboarding.backButton')}` ); } } - return s.replace('%TESTMENU%', 'a button on the back of the controller'); -}; + return s.replace('%TESTMENU%', t('onboarding.backButton')); +}); -const loadPage = (title: string, messages?: object) => { +const loadPage = computed(() => (title: string, messages?: object) => { return { text: t(`onboarding.${title}`, { endlink: '', @@ -56,19 +56,44 @@ const loadPage = (title: string, messages?: object) => { }), image: `help-${title}.png`, }; -}; - -let systemProcessing: Datum; -let standardOngeki: Datum; -let standardChunithm: Datum; -let lever: Datum; -let server: Datum; -let finaleOngeki: Datum; -let finaleChunithm: Datum; +}); const data: ComputedRef = computed(() => { const res = []; + const [standard, systemProcessing, lever, server, finale] = [ + loadPage.value('standard', { + bigblack: '
', + endbig: '
', + }), + loadPage.value('ongeki-system-processing'), + loadPage.value('ongeki-lever'), + loadPage.value('chunithm-server', { + link: '', + }), + loadPage.value('finale', { + segaguide: + '', + twotorial: '', + }), + ]; + const standardOngeki = { + ...standard, + image: '/help-standard-ongeki.png', + }; + const standardChunithm = { + ...standard, + image: '/help-standard-chunithm.png', + }; + const finaleOngeki = { + ...finale, + image: '/help-finale-ongeki.png', + }; + const finaleChunithm = { + ...finale, + image: '/help-finale-chunithm.png', + }; + switch (prf.current?.meta.game) { case 'ongeki': res.push(systemProcessing); @@ -92,48 +117,14 @@ const context = ref({ index: 0, }); -onMounted(async () => { - [standardOngeki, systemProcessing, lever, server, finaleOngeki] = - await Promise.all([ - loadPage('standard', { - bigblack: '
', - endbig: '
', - }), - loadPage('ongeki-system-processing'), - loadPage('ongeki-lever'), - loadPage('chunithm-server', { - link: '
', - }), - loadPage('finale', { - segaguide: - '', - twotorial: '', - }), - ]); - standardOngeki = { - ...standardOngeki, - image: '/help-standard-ongeki.png', - }; - standardChunithm = { - ...standardOngeki, - image: '/help-standard-chunithm.png', - }; - finaleOngeki = { - ...finaleOngeki, - image: '/help-finale-ongeki.png', - }; - finaleChunithm = { - ...finaleOngeki, - image: '/help-finale-chunithm.png', - }; -}); - const exitLabel = computed(() => { return props.firstTime === true && context.value.index < data.value.length - 1 - ? 'Skip' - : 'Close'; + ? t('skip') + : t('close'); }); + +const page = ref(0);