From 6a32ad65a578c8b8a2280aba7826e001fc113f46 Mon Sep 17 00:00:00 2001 From: akanyan Date: Sun, 27 Apr 2025 07:35:38 +0000 Subject: [PATCH] feat: onboarding i18n --- public/help-chunithm-server.md | 3 -- public/help-finale.md | 8 ----- public/help-ongeki-lever.md | 3 -- public/help-ongeki-system-processing.md | 3 -- public/help-standard.md | 7 ---- src/components/Onboarding.vue | 36 +++++++++++++++---- src/components/PatchEntry.vue | 12 +++---- src/components/options/Segatools.vue | 7 ++-- src/i18n/en.ts | 47 ++++++++++++++++++++++++- 9 files changed, 84 insertions(+), 42 deletions(-) delete mode 100644 public/help-chunithm-server.md delete mode 100644 public/help-finale.md delete mode 100644 public/help-ongeki-lever.md delete mode 100644 public/help-ongeki-system-processing.md delete mode 100644 public/help-standard.md diff --git a/public/help-chunithm-server.md b/public/help-chunithm-server.md deleted file mode 100644 index f753de4..0000000 --- a/public/help-chunithm-server.md +++ /dev/null @@ -1,3 +0,0 @@ -If you're stuck on this screen, restart the game. - -If the problem persists, check your network configuration diff --git a/public/help-finale.md b/public/help-finale.md deleted file mode 100644 index 44100f6..0000000 --- a/public/help-finale.md +++ /dev/null @@ -1,8 +0,0 @@ -You can access this page any time by right-clicking the START button. - -Additional resources: - -- SEGAguide -- two-torial - -## Have fun diff --git a/public/help-ongeki-lever.md b/public/help-ongeki-lever.md deleted file mode 100644 index e405b7c..0000000 --- a/public/help-ongeki-lever.md +++ /dev/null @@ -1,3 +0,0 @@ -You also have to calibrate the lever, or you may get the error 3301. - -Go to lever settings (レバー設定), move the lever to both edges, then press "end" (終了) and "save" (保存する). diff --git a/public/help-ongeki-system-processing.md b/public/help-ongeki-system-processing.md deleted file mode 100644 index 9e9884c..0000000 --- a/public/help-ongeki-system-processing.md +++ /dev/null @@ -1,3 +0,0 @@ -You might get stuck on this screen for several minutes. _This is normal_. The game just takes a long time to load data. - -If you install 7EVENDAYSHOLIDAYS/LoadBoost, subsequent launches will be much faster. diff --git a/public/help-standard.md b/public/help-standard.md deleted file mode 100644 index d1ed7bb..0000000 --- a/public/help-standard.md +++ /dev/null @@ -1,7 +0,0 @@ -You might get stuck on the following screen: - -
Aグループの基準機から設定を取得
- -In which case, you should go to the test menu, and in game settings ゲーム設定 switch from "follow the standard machine" 基準機に従う to "standard machine" 基準機. - -The test menu can be accessed with %TESTMENU%. diff --git a/src/components/Onboarding.vue b/src/components/Onboarding.vue index 4d799fd..0cf4e7a 100644 --- a/src/components/Onboarding.vue +++ b/src/components/Onboarding.vue @@ -7,6 +7,9 @@ import { fromKeycode } from '../keyboard'; import { useClientStore, usePrfStore } from '../stores'; import { prettyPrint } from '../util'; import { VueMarkdownIt } from '@f3ve/vue-markdown-it'; +import { useI18n } from 'vue-i18n'; + +const { t } = useI18n(); const prf = usePrfStore(); const client = useClientStore(); @@ -25,6 +28,11 @@ interface Datum { const game = computed(() => prf.current?.meta.game); const processText = (s: string) => { + // Why do I have to do this + s = s + .split('\n') + .map((l) => l.trim()) + .join('\n'); if (prf.current!.data.keyboard?.data.enabled) { const testKey = prf.current!.data.keyboard?.data.test; const readable = fromKeycode(testKey); @@ -38,9 +46,14 @@ const processText = (s: string) => { return s.replace('%TESTMENU%', 'a button on the back of the controller'); }; -const loadPage = async (title: string) => { +const loadPage = (title: string, messages?: object) => { return { - text: await (await fetch(`/help-${title}.md`)).text(), + text: t(`onboarding.${title}`, { + endlink: '', + black: '', + end: '', + ...messages, + }), image: `help-${title}.png`, }; }; @@ -75,14 +88,25 @@ const data: ComputedRef = computed(() => { return res; }); +const counter = ref(0); + onMounted(async () => { [standardOngeki, systemProcessing, lever, server, finaleOngeki] = await Promise.all([ - loadPage('standard'), + loadPage('standard', { + bigblack: '
', + endbig: '
', + }), loadPage('ongeki-system-processing'), loadPage('ongeki-lever'), - loadPage('chunithm-server'), - loadPage('finale'), + loadPage('chunithm-server', { + link: '', + }), + loadPage('finale', { + segaguide: + '', + twotorial: '', + }), ]); standardOngeki = { ...standardOngeki, @@ -102,8 +126,6 @@ onMounted(async () => { }; }); -const counter = ref(0); - const exitLabel = computed(() => { return props.firstTime === true && counter.value < data.value.length - 1 ? 'Skip' diff --git a/src/components/PatchEntry.vue b/src/components/PatchEntry.vue index 02ac790..70fa537 100644 --- a/src/components/PatchEntry.vue +++ b/src/components/PatchEntry.vue @@ -8,7 +8,7 @@ import { usePrfStore } from '../stores'; import { Patch } from '../types'; import { useI18n } from 'vue-i18n'; -const { t } = useI18n(); +const { t, te } = useI18n(); const prf = usePrfStore(); @@ -51,14 +51,14 @@ const hexModel = computed({ // Doesn't need to be reactive const nameKey = `patch.${props.patch?.id}`; -let name = t(nameKey); -if (name === nameKey) { - name = props.patch?.name ?? 'No name'; -} +const name = te(nameKey) ? t(nameKey) : props.patch?.name; + +const tooltipKey = `patch.${props.patch?.id}-tooltip`; +const tooltip = te(tooltipKey) ? t(tooltipKey) : props.patch?.tooltip;