aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src/plugins
diff options
context:
space:
mode:
authorRémy Raes <contact@remyraes.com>2023-03-29 00:45:16 +0200
committerGitHub <noreply@github.com>2023-03-28 22:45:16 +0000
commit428c300e9f42f8b9232f780d387292c1a94fcd23 (patch)
tree8e3026de0ad6a69a08396026bdc7fd084d073739 /src-vue/src/plugins
parent784330797d947ec2ff4eb97a7325ac77f3a79e4d (diff)
downloadFlightCore-428c300e9f42f8b9232f780d387292c1a94fcd23.tar.gz
FlightCore-428c300e9f42f8b9232f780d387292c1a94fcd23.zip
feat: i18n (#182)
* build: add vue-i18n dependency * feat: add i18n plugin to vue project * feat: use translations in play button * feat: translate play view * feat: translate menu items * feat: translate local mods view * feat: translate online mods view * feat: translate mods menu * feat: translate thunderstore mod card component * fix: remove useless "this" keyword * feat: translate settings view * fix: remove leftover test invocation * feat: add language selector component * feat: using language selector updates interface's language * feat: save language in persistent store on selector change * feat: initialize lang on app launch * refactor: move i18n code into App.mounted callback * feat: update interface language on app launch * feat: adjust language selection on language selector load * fix: this.$root can't be null * feat: translate store notifications * fix: add missing parameter to english translation * feat: translate "by" author keyword * feat: translate repair window * feat: translate repair window title * docs: add some documentation regarding localization * docs: explain how to add a new language * feat: translate Northstar release canal selector elements * docs: describe how to inject variable into translations * feat: translate "info" word * feat: translate popconfirm buttons * fix: remove "this" keyword * fix: save store when updating interface language
Diffstat (limited to 'src-vue/src/plugins')
-rw-r--r--src-vue/src/plugins/store.ts26
1 files changed, 13 insertions, 13 deletions
diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts
index caa46bee..08f9b85f 100644
--- a/src-vue/src/plugins/store.ts
+++ b/src-vue/src/plugins/store.ts
@@ -16,8 +16,8 @@ import { ReleaseInfo } from "../../../src-tauri/bindings/ReleaseInfo";
import { ThunderstoreMod } from "../../../src-tauri/bindings/ThunderstoreMod";
import { NorthstarMod } from "../../../src-tauri/bindings/NorthstarMod";
import { searchModule } from './modules/search';
+import { i18n } from '../main';
import { pullRequestModule } from './modules/pull_requests';
-import { PullsApiResponseElement } from "../../../src-tauri/bindings/PullsApiResponseElement";
const persistentStore = new Store('flight-core-settings.json');
@@ -123,8 +123,8 @@ export const store = createStore<FlightCoreStore>({
if (is_valid_titanfall2_install) {
state.game_path = selected;
ElNotification({
- title: 'New game folder',
- message: "Game folder was successfully updated.",
+ title: i18n.global.tc('notification.game_folder.new.title'),
+ message: i18n.global.tc('notification.game_folder.new.text'),
type: 'success',
position: 'bottom-right'
});
@@ -151,8 +151,8 @@ export const store = createStore<FlightCoreStore>({
else {
// Not valid Titanfall2 install
ElNotification({
- title: 'Wrong folder',
- message: "Selected folder is not a valid Titanfall2 install.",
+ title: i18n.global.tc('notification.game_folder.wrong.title'),
+ message: i18n.global.tc('notification.game_folder.wrong.text'),
type: 'error',
position: 'bottom-right'
});
@@ -224,7 +224,7 @@ export const store = createStore<FlightCoreStore>({
.catch((error) => {
console.error(error);
ElNotification({
- title: 'Error',
+ title: i18n.global.tc('generic.error'),
message: error,
type: 'error',
position: 'bottom-right'
@@ -293,7 +293,7 @@ export const store = createStore<FlightCoreStore>({
.catch((error) => {
console.error(error);
ElNotification({
- title: 'Error',
+ title: i18n.global.tc('generic.error'),
message: error,
type: 'error',
position: 'bottom-right'
@@ -315,8 +315,8 @@ export const store = createStore<FlightCoreStore>({
// Display notification to highlight change
ElNotification({
- title: `${state.northstar_release_canal}`,
- message: `Switched release channel to: "${state.northstar_release_canal}"`,
+ title: i18n.global.tc(`channels.names.${state.northstar_release_canal}`),
+ message: i18n.global.tc('channels.release.switch.text', {canal: state.northstar_release_canal}),
type: 'success',
position: 'bottom-right'
});
@@ -394,8 +394,8 @@ async function _initializeApp(state: any) {
// Gamepath not found or other error
console.error(err);
notification_handle = ElNotification({
- title: 'Titanfall2 not found!',
- message: "Please manually select install location",
+ title: i18n.global.tc('notification.game_folder.not_found.title'),
+ message: i18n.global.tc('notification.game_folder.not_found.text'),
type: 'error',
position: 'bottom-right',
duration: 0 // Duration `0` means the notification will not auto-vanish
@@ -437,8 +437,8 @@ async function _checkForFlightCoreUpdates(state: FlightCoreStore) {
if (flightcore_is_outdated) {
let newest_flightcore_version = await invoke("get_newest_flightcore_version") as FlightCoreVersion;
ElNotification({
- title: 'FlightCore outdated!',
- message: `Please update FlightCore.\nRunning outdated version ${state.flightcore_version}.\nNewest is ${newest_flightcore_version.tag_name}!`,
+ title: i18n.global.tc('notification.flightcore_outdated.title'),
+ message: i18n.global.tc('notification.flightcore_outdated.text', {oldVersion: state.flightcore_version, newVersion: newest_flightcore_version.tag_name}),
type: 'warning',
position: 'bottom-right',
duration: 0 // Duration `0` means the notification will not auto-vanish