feat: internationalization
This commit is contained in:
@ -8,6 +8,9 @@ import { getCurrentWindow } from '@tauri-apps/api/window';
|
||||
import Onboarding from './Onboarding.vue';
|
||||
import { invoke } from '../invoke';
|
||||
import { useClientStore, usePrfStore } from '../stores';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const prf = usePrfStore();
|
||||
const client = useClientStore();
|
||||
@ -24,22 +27,22 @@ const startline = async (force: boolean, refresh: boolean) => {
|
||||
if (start_check.length > 0) {
|
||||
const message = start_check.map((o) => {
|
||||
if ('MissingRemotePackage' in o) {
|
||||
return `Package missing: ${o.MissingRemotePackage}`;
|
||||
return `${t('start.error.package')}: ${o.MissingRemotePackage}`;
|
||||
} else if ('MissingLocalPackage' in o) {
|
||||
return `Package missing: ${o.MissingLocalPackage}`;
|
||||
return `${t('start.error.package')}: ${o.MissingLocalPackage}`;
|
||||
} else if ('MissingDependency' in o) {
|
||||
return `Dependency missing: ${(o.MissingDependency as string[]).join(' ')}`;
|
||||
return `${t('start.error.dependency')}: ${(o.MissingDependency as string[]).join(' ')}`;
|
||||
} else if ('MissingTool' in o) {
|
||||
return `Tool missing: ${o.MissingTool}`;
|
||||
return `${t('start.error.tool')}: ${o.MissingTool}`;
|
||||
} else {
|
||||
return 'Unknown error';
|
||||
return t('start.error.unknown');
|
||||
}
|
||||
});
|
||||
confirmDialog.require({
|
||||
message: message.join('\n'),
|
||||
header: 'Start check failed',
|
||||
acceptLabel: 'Run anyway',
|
||||
rejectLabel: 'Cancel',
|
||||
header: t('start.failed'),
|
||||
acceptLabel: t('start.accept'),
|
||||
rejectLabel: t('cancel'),
|
||||
accept: () => {
|
||||
startline(true, refresh);
|
||||
},
|
||||
@ -62,16 +65,16 @@ const kill = async () => {
|
||||
|
||||
const disabledTooltip = computed(() => {
|
||||
if (prf.current?.data.sgt.target.length === 0) {
|
||||
return 'The game path must be specified';
|
||||
return t('start.tooltip.game');
|
||||
}
|
||||
if (prf.current?.data.sgt.amfs.length === 0) {
|
||||
return 'The amfs path must be specified';
|
||||
return t('start.tooltip.amfs');
|
||||
}
|
||||
if (
|
||||
prf.current?.data.sgt.hook === null ||
|
||||
prf.current?.data.sgt.hook === undefined
|
||||
) {
|
||||
return 'A segatools hook package is necessary';
|
||||
return t('start.tooltip.segatools');
|
||||
}
|
||||
return null;
|
||||
});
|
||||
@ -96,32 +99,50 @@ const createShortcut = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const menuItems = [
|
||||
{
|
||||
label: 'Refresh and start',
|
||||
icon: 'pi pi-sync',
|
||||
tooltip: 'test',
|
||||
command: async () => await startline(false, true),
|
||||
},
|
||||
{
|
||||
label: 'Start unchecked',
|
||||
icon: 'pi pi-exclamation-circle',
|
||||
command: async () => await startline(true, false),
|
||||
},
|
||||
{
|
||||
label: 'Create desktop shortcut',
|
||||
icon: 'pi pi-link',
|
||||
command: createShortcut,
|
||||
},
|
||||
{
|
||||
label: 'Help',
|
||||
icon: 'pi pi-question-circle',
|
||||
command: () => {
|
||||
onboardingFirstTime.value = false;
|
||||
onboardingVisible.value = true;
|
||||
const menuItems = computed(() => {
|
||||
const base = [
|
||||
{
|
||||
label: t('start.button.unchecked'),
|
||||
icon: 'pi pi-exclamation-circle',
|
||||
command: async () => await startline(true, false),
|
||||
},
|
||||
},
|
||||
];
|
||||
{
|
||||
label: t('start.button.shortcut'),
|
||||
icon: 'pi pi-link',
|
||||
command: createShortcut,
|
||||
},
|
||||
{
|
||||
label: t('start.button.help'),
|
||||
icon: 'pi pi-question-circle',
|
||||
command: () => {
|
||||
onboardingFirstTime.value = false;
|
||||
onboardingVisible.value = true;
|
||||
},
|
||||
},
|
||||
];
|
||||
if (prf.current === null) {
|
||||
return [];
|
||||
}
|
||||
if (prf.current.meta.game === 'chunithm') {
|
||||
return base;
|
||||
}
|
||||
if (prf.current.meta.game === 'ongeki') {
|
||||
return [
|
||||
{
|
||||
label: t('start.button.refresh'),
|
||||
icon: 'pi pi-sync',
|
||||
command: async () => await startline(false, true),
|
||||
},
|
||||
...base,
|
||||
{
|
||||
label: t('start.button.cache'),
|
||||
icon: 'pi pi-trash',
|
||||
command: async () => {},
|
||||
},
|
||||
];
|
||||
}
|
||||
});
|
||||
|
||||
const menu = ref();
|
||||
|
||||
const showContextMenu = (event: Event) => {
|
||||
@ -177,7 +198,7 @@ const tryStart = () => {
|
||||
v-else-if="startStatus === 'preparing'"
|
||||
disabled
|
||||
icon="pi pi-spin pi-spinner"
|
||||
label="START"
|
||||
:label="t('start.button.start')"
|
||||
aria-label="start"
|
||||
size="small"
|
||||
class="m-2.5"
|
||||
@ -186,7 +207,7 @@ const tryStart = () => {
|
||||
v-else
|
||||
:disabled="false"
|
||||
icon="pi pi-ban"
|
||||
label="STOP"
|
||||
:label="t('start.button.stop')"
|
||||
aria-label="stop"
|
||||
size="small"
|
||||
class="m-2.5"
|
||||
|
Reference in New Issue
Block a user