Skip to content

Commit 0e00af1

Browse files
committed
WIP: Adding i18n support for "Other" section
1 parent c4538fe commit 0e00af1

File tree

2 files changed

+59
-13
lines changed

2 files changed

+59
-13
lines changed

src/components/settings-components/SettingsView.vue

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ import { computed, onMounted, ref, watch } from 'vue';
1717
import { getStore } from '../../providers/generic/store/StoreProvider';
1818
import { State } from '../../store';
1919
import {useRouter} from 'vue-router';
20-
import {getLaunchType, LaunchType} from "../../model/real_enums/launch/LaunchType";
20+
import {getLaunchType} from "../../model/real_enums/launch/LaunchType";
2121
import {LaunchTypeModalOpen} from "../../components/modals/launch-type/LaunchTypeRefs";
2222
import {useI18n} from "vue-i18n";
2323
2424
const store = getStore<State>();
2525
let router = useRouter();
26-
const { t } = useI18n();
26+
const { t, d, messages, locale } = useI18n();
27+
28+
function getLocaleMessages() {
29+
return messages.value[locale.value];
30+
}
2731
2832
const activeTab = ref<string>('All');
2933
const tabs = ref<string[]>(['All', 'Profile', 'Locations', 'Debugging', 'Modpacks', 'Other']);
@@ -230,7 +234,7 @@ let settingsList = [
230234
() => emitInvoke('UpdateAllMods')
231235
),
232236
new SettingsRow(
233-
'Other',
237+
'other',
234238
'Toggle funky mode',
235239
'Enable/disable funky mode.',
236240
async () => {
@@ -242,7 +246,7 @@ let settingsList = [
242246
() => emitInvoke('ToggleFunkyMode')
243247
),
244248
new SettingsRow(
245-
'Other',
249+
'other',
246250
'Switch theme',
247251
'Switch between light and dark themes.',
248252
async () => {
@@ -254,7 +258,7 @@ let settingsList = [
254258
() => emitInvoke('SwitchTheme')
255259
),
256260
new SettingsRow(
257-
'Other',
261+
'other',
258262
'Switch card display type',
259263
'Switch between expanded or collapsed cards.',
260264
async () => {
@@ -266,29 +270,31 @@ let settingsList = [
266270
() => emitInvoke('SwitchCard')
267271
),
268272
new SettingsRow(
269-
'Other',
273+
'other',
270274
'Refresh online mod list',
271275
'Check for any new mod releases.',
272276
async () => {
273277
if (store.state.tsMods.isThunderstoreModListUpdateInProgress) {
274-
return store.state.tsMods.thunderstoreModListUpdateStatus || "Refreshing...";
278+
return store.state.tsMods.thunderstoreModListUpdateStatus
279+
? t(`translations.pages.profileSelection.importProfileModal.states.refresh.refreshStatus.${store.state.tsMods.thunderstoreModListUpdateStatus}`)
280+
: t('translations.pages.settings.other.refreshOnlineModList.states.refreshing');
275281
}
276282
if (store.state.tsMods.thunderstoreModListUpdateError) {
277-
return `Error refreshing the mod list: ${store.state.tsMods.thunderstoreModListUpdateError.message}`;
283+
return t('translations.pages.settings.other.refreshOnlineModList.states.errorRefreshing', { errorText: store.state.tsMods.thunderstoreModListUpdateError.message });
278284
}
279285
if (store.getters['download/activeDownloadCount'] > 0) {
280-
return "Refreshing the mod list is disabled while there are active downloads.";
286+
return t('translations.pages.settings.other.refreshOnlineModList.states.disabledWhilstDownloading');
281287
}
282288
if (store.state.tsMods.modsLastUpdated !== undefined) {
283-
return "Cache date: " + moment(store.state.tsMods.modsLastUpdated).format("MMMM Do YYYY, h:mm:ss a");
289+
return t('translations.pages.settings.other.refreshOnlineModList.states.cacheDate', { formattedDate: d(moment(store.state.tsMods.modsLastUpdated).toDate(), 'long', getLocaleMessages().metadata.locale) });
284290
}
285291
return "No API information available";
286292
},
287293
'fa-exchange-alt',
288294
async () => await store.dispatch("tsMods/syncPackageList")
289295
),
290296
new SettingsRow(
291-
'Other',
297+
'other',
292298
'Change game',
293299
'Change the current game',
294300
async () => "",
@@ -334,7 +340,7 @@ onMounted(async () => {
334340
return directory;
335341
}
336342
}
337-
return t('translations.pages.settings.locations.changeSteamFolder.state.setManually');
343+
return t('translations.pages.settings.locations.changeSteamFolder.states.setManually');
338344
},
339345
'fa-folder-open',
340346
() => emitInvoke('ChangeSteamDirectory')

src/i18n/en/pages/SettingsTranslation.ts

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const SettingsTranslation: SettingsMessageFormat = {
2626
changeSteamFolder: {
2727
title: `Change {''}@:translations.platforms.STEAM{''} folder`,
2828
description: `Change the location of the @:translations.platforms.STEAM folder that {appName} uses.`,
29-
state: {
29+
states: {
3030
setManually: 'You must click this setting and locate the folder manually'
3131
}
3232
}
@@ -134,5 +134,45 @@ export const SettingsTranslation: SettingsMessageFormat = {
134134
You have {count} mods with an update available
135135
`,
136136
}
137+
},
138+
other: {
139+
toggleFunkyMode: {
140+
title: 'Toggle funky mode',
141+
description: 'Enable / disable funky mode.',
142+
states: {
143+
enabled: 'Funky mode is enabled',
144+
disabled: 'Funky mode is disabled',
145+
},
146+
},
147+
switchTheme: {
148+
title: 'Switch theme',
149+
description: 'Switch between light and dark themes.',
150+
themes: {
151+
light: 'Current: Light theme (default)',
152+
dark: 'Current: Dark theme',
153+
},
154+
},
155+
switchCardDisplayType: {
156+
title: 'Switch card display type',
157+
description: 'Switch between expanded or collapsed cards.',
158+
states: {
159+
expanded: 'Current: Expanded',
160+
collapsed: 'Current: Collapsed (default)'
161+
}
162+
},
163+
refreshOnlineModList: {
164+
title: 'Refresh online mod list',
165+
description: 'Check for new mod releases.',
166+
states: {
167+
refreshing: 'Refreshing',
168+
errorRefreshing: 'There was a problem refreshing the mod list: {errorText}',
169+
disabledWhilstDownloading: 'Refreshing the mod list is disabled whilst there are active downloads',
170+
cacheDate: 'Cache date: {formattedDate}',
171+
}
172+
},
173+
changeGame: {
174+
title: 'Change game',
175+
description: 'Change the current game.',
176+
}
137177
}
138178
}

0 commit comments

Comments
 (0)