From dc22e82c84a47c5c5b451b2f23dc7ae9031cf8fe Mon Sep 17 00:00:00 2001 From: Spythere Date: Sat, 6 Mar 2021 20:10:24 +0100 Subject: [PATCH] =?UTF-8?q?Wsparcie=20j=C4=99zyka=20angielskiego=20(beta)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 5 ++ package.json | 1 + src/App.vue | 28 ++++++-- src/components/StationsView/FilterCard.vue | 14 ++-- src/components/StationsView/StationTable.vue | 64 ++++++++++++++++- src/components/TrainsView/TrainOptions.vue | 13 ++-- src/components/TrainsView/TrainStats.vue | 22 +++--- src/data/options.json | 18 ++--- src/lang/en.json | 73 ++++++++++++++++++++ src/lang/pl.json | 73 ++++++++++++++++++++ src/main.ts | 16 +++++ src/views/StationsView.vue | 4 +- 12 files changed, 295 insertions(+), 36 deletions(-) create mode 100644 src/lang/en.json create mode 100644 src/lang/pl.json diff --git a/package-lock.json b/package-lock.json index 1486632..11aa003 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10157,6 +10157,11 @@ "integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==", "dev": true }, + "vue-i18n": { + "version": "8.23.0", + "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.23.0.tgz", + "integrity": "sha512-mXgniaumwca8tKdp55fmvqIcW658vQQXq0zEyRHp8sgZ6t+Md+Whhu6CCPg9/erVNlvpKzsGsucGjt2N8GrFCA==" + }, "vue-loader": { "version": "15.9.3", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.9.3.tgz", diff --git a/package.json b/package.json index a16096e..f01ebc4 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "howler": "^2.2.1", "vue": "^2.6.11", "vue-class-component": "^7.2.5", + "vue-i18n": "^8.23.0", "vue-property-decorator": "^8.4.2", "vue-router": "^3.4.3", "vuex": "^3.4.0" diff --git a/src/App.vue b/src/App.vue index 64af09a..6a0a1af 100644 --- a/src/App.vue +++ b/src/App.vue @@ -27,13 +27,19 @@ SCENERIE{{ $t("app.sceneries") }} / - POCIĄGI{{ $t("app.trains") }}/ - DZIENNIK{{ $t("app.journal") }} @@ -82,6 +88,18 @@ export default class App extends Vue { mounted() { this.synchronizeData(); + if (window.navigator.language) { + switch (window.navigator.language) { + case "pl-PL": + this.$i18n.locale = "pl"; + break; + case "en-EN": + default: + this.$i18n.locale = "en"; + break; + } + } + if (StorageManager.getStringValue("version") != this.VERSION) { StorageManager.setStringValue("version", this.VERSION); diff --git a/src/components/StationsView/FilterCard.vue b/src/components/StationsView/FilterCard.vue index acb9755..b6dd17c 100644 --- a/src/components/StationsView/FilterCard.vue +++ b/src/components/StationsView/FilterCard.vue @@ -21,7 +21,7 @@ {{ option.content }}{{ $t(`filters.${option.id}`) }} @@ -42,7 +42,9 @@ {{ slider.value }} -
{{ slider.content }}
+
+ {{ $t(`filters.sliders.${slider.id}`) }} +
@@ -51,15 +53,17 @@
- - + +
diff --git a/src/components/StationsView/StationTable.vue b/src/components/StationsView/StationTable.vue index a35d8d3..0d6d0b2 100644 --- a/src/components/StationsView/StationTable.vue +++ b/src/components/StationsView/StationTable.vue @@ -4,7 +4,56 @@ + + + + + + @@ -204,7 +253,6 @@ import { Component, Prop } from "vue-property-decorator"; import Station from "@/scripts/interfaces/Station"; - import styleMixin from "@/mixins/styleMixin"; import Options from "@/components/StationsView/Options.vue"; @@ -228,6 +276,18 @@ export default class StationTable extends styleMixin { ascIcon: string = require("@/assets/icon-arrow-asc.svg"); descIcon: string = require("@/assets/icon-arrow-desc.svg"); + headIds = [ + "station", + "min-lvl", + "status", + "dispatcher", + "dispatcher-lvl", + "routes", + "general", + ]; + + headIconsIds = ["user", "spawn", "timetable"]; + headTitles: string[][] = [ ["Stacja"], ["Min. poziom", "dyżurnego"], diff --git a/src/components/TrainsView/TrainOptions.vue b/src/components/TrainsView/TrainOptions.vue index 1339f11..ff9fe45 100644 --- a/src/components/TrainsView/TrainOptions.vue +++ b/src/components/TrainsView/TrainOptions.vue @@ -16,7 +16,9 @@ @click="() => chooseOption(option)" > - + @@ -27,7 +29,7 @@
-

STATYSTYKI RUCHU

+

{{ $t("trains.stats") }}

- PRĘDKOŚCI POCIĄGÓW (MIN | ŚR | MAX) [km/h] + {{ $t("trains.stats-speed") }}
{{ speedStats.min }} | {{ speedStats.avg }} | {{ speedStats.max }} @@ -25,7 +25,7 @@
- DŁUGOŚCI ROZKŁADÓW (MIN | ŚR | MAX) [km] + {{ $t("trains.stats-length") }}
{{ timetableStats.min }} | {{ timetableStats.avg }} | @@ -34,7 +34,9 @@
-
KATEGORIE RJ
+
+ {{ $t("trains.stats-categories") }} +
- WYSOKIEGO RYZYKA + {{ + $t("trains.stats-special-twr") + }} {{ specialTrainCount[0] }} - PRZEKROCZONA SKRAJNIA + {{ + $t("trains.stats-special-skr") + }} {{ specialTrainCount[1] }}
-
NAJCZĘSTSZE JEDNOSTKI
+
{{ $t("trains.stats-locos") }}
diff --git a/src/data/options.json b/src/data/options.json index 88cee07..2098a6a 100644 --- a/src/data/options.json +++ b/src/data/options.json @@ -56,7 +56,7 @@ "content": "SCS" }, { - "id": "by-hand", + "id": "manual", "name": "ręczne", "iconName": "ręczne", "section": "control", @@ -65,7 +65,7 @@ "content": "RĘCZNE" }, { - "id": "levers", + "id": "mechanical", "name": "mechaniczne", "iconName": "mechaniczne", "section": "control", @@ -84,7 +84,7 @@ "content": "WSPÓŁCZESNA" }, { - "id": "semaphore", + "id": "semaphores", "name": "kształtowa", "iconName": "kształtowa", "section": "signals", @@ -102,7 +102,7 @@ "content": "MIESZANA" }, { - "id": "historic", + "id": "historical", "name": "historyczna", "iconName": "historyczna", "section": "signals", @@ -134,7 +134,7 @@ ], "sliders": [ { - "id": "min-level", + "id": "min-lvl", "name": "minLevel", "minRange": 0, "maxRange": 20, @@ -143,7 +143,7 @@ "content": "MINIMALNY WYMAGANY POZIOM DYŻURNEGO" }, { - "id": "min-oneway-e", + "id": "routes-1t-cat", "name": "minOneWayCatenary", "minRange": 0, "maxRange": 5, @@ -152,7 +152,7 @@ "content": "SZLAKI JEDNOTOROWE ZELEKTR. (MINIMUM)" }, { - "id": "min-oneway-ne", + "id": "routes-1t-other", "name": "minOneWay", "minRange": 0, "maxRange": 5, @@ -161,7 +161,7 @@ "content": "SZLAKI JEDNOTOROWE NIEZELEKTR. (MINIMUM)" }, { - "id": "min-twoway-e", + "id": "routes-2t-cat", "name": "minTwoWayCatenary", "minRange": 0, "maxRange": 5, @@ -170,7 +170,7 @@ "content": "SZLAKI DWUTOROWE ZELEKTR. (MINIMUM)" }, { - "id": "min-twoway-ne", + "id": "routes-2t-other", "name": "minTwoWay", "minRange": 0, "maxRange": 5, diff --git a/src/lang/en.json b/src/lang/en.json new file mode 100644 index 0000000..08ebfba --- /dev/null +++ b/src/lang/en.json @@ -0,0 +1,73 @@ +{ + "app": { + "sceneries": "SCENERIES", + "trains": "TRAINS", + "journal": "JOURNAL" + }, + "options": { + "filters": "FILTERS", + "donate": "DONATE" + }, + "filters": { + "title": "STATION FILTER", + "default": "DEFAULT", + "not-default": "OTHER", + "real": "REAL", + "fictional": "FICTIONAL", + "SPK": "SPK", + "SCS": "SCS", + "manual": "MANUAL", + "mechanical": "MECHANICAL", + "modern": "MODERN", + "semaphores": "SEMAPHORES", + "mixed": "MIXED", + "historical": "HISTORICAL", + "free": "FREE", + "occupied": "OCCUPIED", + "sliders": { + "min-lvl": "MINIMUM REQUIRED DISPATCHER LEVEL", + "routes-1t-cat": "MINIMUM CATENARY SINGLE TRACK ROUTES", + "routes-1t-other": "MINIMUM OTHER SINGLE TRACK ROUTES", + "routes-2t-cat": "MINIMUM CATENARY DOUBLE TRACK ROUTES", + "routes-2t-other": "MINIMUM OTHER DOUBLE TRACK ROUTES" + }, + "save": "SAVE FILTERS", + "reset": "RESET FILTERS", + "close": "CLOSE FILTERS" + }, + "sceneries": { + "station": "Station", + "min-lvl": "Min. dispatcher
level", + "status": "Status", + "dispatcher": "Dispatcher", + "dispatcher-lvl": "Dispatcher
level", + "routes": "Routes
double | single", + "general": "General info", + "users": "Drivers online", + "spawns": "Spawns online", + "timetables": "Active timetables" + }, + "trains": { + "stats": "TRAFFIC STATISTICS", + "stats-speed": "TRAINS SPEED (MIN | AVG | MAX) [km/h]", + "stats-length": "TIMETABLES LENGTH (MIN | AVG | MAX) [km]", + "stats-categories": "TIMETABLE CATEGORIES", + "stats-special-twr": "HIGH RISK", + "stats-special-skr": "EXCEEDED STRUCT. GAUGE", + "stats-locos": "MOST COMMON UNITS", + "option-mass": "mass", + "option-speed": "speed", + "option-length": "length", + "option-distance": "distance", + "option-timetable": "train no.", + "search-no": "Search for train no...", + "search-driver": "Search for driver...", + "detailed-timetable": "Detailed timetable for train no. " + }, + "journal": { + "title": "SCENERY ACTIVITY JOURNAL", + "subtitle": "Shows all recent dispatchers on a selected scenery", + "disclaimer": "This functionality is unfinished!
Information shown here could be false or incorrect!", + "select": "Select a scenery" + } +} diff --git a/src/lang/pl.json b/src/lang/pl.json new file mode 100644 index 0000000..597d39f --- /dev/null +++ b/src/lang/pl.json @@ -0,0 +1,73 @@ +{ + "app": { + "sceneries": "SCENERIE", + "trains": "POCIĄGI", + "journal": "DZIENNIK" + }, + "options": { + "filters": "FILTRY", + "donate": "WESPRZYJ" + }, + "filters": { + "title": "FILTRUJ STACJE", + "default": "DOMYŚLNA", + "not-default": "POZA PACZKĄ", + "real": "REALNA", + "fictional": "FIKCYJNA", + "SPK": "SPK", + "SCS": "SCS", + "manual": "RĘCZNE", + "mechanical": "MECHANICZNE", + "modern": "WSPÓŁCZESNA", + "semaphores": "KSZTAŁTOWA", + "mixed": "MIESZANA", + "historical": "HISTORYCZNA", + "free": "WOLNA", + "occupied": "ZAJĘTA", + "sliders": { + "min-lvl": "MINIMALNY WYMAGANY POZIOM DYŻURNEGO", + "routes-1t-cat": "SZLAKI JEDNOTOROWE ZELEKTR. (MINIMUM)", + "routes-1t-other": "SZLAKI JEDNOTOROWE NIEZELEKTR. (MINIMUM)", + "routes-2t-cat": "SZLAKI DWUTOROWE ZELEKTR. (MINIMUM)", + "routes-2t-other": "SZLAKI DWUTOROWE NIEZELEKTR. (MINIMUM)" + }, + "save": "ZAPISZ FILTRY", + "reset": "RESETUJ FILTRY", + "close": "ZAMKNIJ FILTRY" + }, + "sceneries": { + "station": "Stacja", + "min-lvl": "Min. poziom
dyżurnego", + "status": "Status", + "dispatcher": "Dyżurny", + "dispatcher-lvl": "Poziom
dyżurnego", + "routes": "Szlaki
2tor | 1tor", + "general": "Informacje
ogólne", + "users": "Maszyniści online", + "spawns": "Otwarte spawny", + "timetables": "Aktywne rozkłady jazdy" + }, + "trains": { + "stats": "STATYSTYKI RUCHU", + "stats-speed": "PRĘDKOŚCI POCIĄGÓW (MIN | ŚR | MAX) [km/h]", + "stats-length": "DŁUGOŚCI ROZKŁADÓW (MIN | ŚR | MAX) [km]", + "stats-categories": "KATEGORIE RJ", + "stats-special-twr": "WYSOKIEGO RYZYKA", + "stats-special-skr": "PRZEKROCZONA SKRAJNIA", + "stats-locos": "NAJCZĘSTSZE JEDNOSTKI", + "option-mass": "masa", + "option-speed": "prędkość", + "option-length": "długość", + "option-distance": "kilometraż", + "option-timetable": "numer pociagu", + "search-no": "Szukaj nr pociągu...", + "search-driver": "Szukaj maszynisty...", + "detailed-timetable": "Szczegółowy rozkład jazdy pociągu " + }, + "journal": { + "title": "DZIENNIK AKTYWNOŚCI SCENERII", + "subtitle": "Pokazuje dyżurnych, którzy ostatnio byli aktywni na wybranej scenerii", + "disclaimer": "Ta funkcjonalność jest w testach beta!
Informacje pokazywane na ekranie mogą znikać, a ich zawartość może być fałszywa!", + "select": "Wybierz scenerię" + } +} diff --git a/src/main.ts b/src/main.ts index 8aa426d..badb5d3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,11 +2,27 @@ import Vue from 'vue'; import App from './App.vue'; import router from './router'; import store from './store'; +import VueI18n from 'vue-i18n'; + +import enLang from '@/lang/en.json'; +import plLang from '@/lang/pl.json'; + +Vue.use(VueI18n); + +const i18n = new VueI18n({ + locale: 'pl', + fallbackLocale: 'pl', + messages: { + en: enLang, + pl: plLang, + }, +}); Vue.config.productionTip = false; new Vue({ router, store, + i18n, render: h => h(App), }).$mount('#app'); diff --git a/src/views/StationsView.vue b/src/views/StationsView.vue index c736d9d..9e5adae 100644 --- a/src/views/StationsView.vue +++ b/src/views/StationsView.vue @@ -15,13 +15,13 @@ :src="require('@/assets/icon-filter2.svg')" alt="icon-filter" /> -

FILTRY

+

{{ $t("options.filters") }}

+ +
+ + +
+
+ + + + + +