From 0840e0b3aba172abad40452781e83b8908aec3c3 Mon Sep 17 00:00:00 2001 From: Matteias Collet Date: Fri, 3 Jul 2020 19:23:15 +0200 Subject: [PATCH] component translation frameworking --- .prettierrc | 22 +++++++++++- site/.vuepress/components/Generator.vue | 3 -- site/.vuepress/components/SelectComponent.vue | 9 ++++- site/.vuepress/components/StageLoader.vue | 35 +++++++++---------- site/.vuepress/i18n/de-CH.json | 14 +++++--- site/.vuepress/i18n/en-US.json | 26 +++++++++++--- 6 files changed, 77 insertions(+), 32 deletions(-) diff --git a/.prettierrc b/.prettierrc index 7f51337..7b158b9 100644 --- a/.prettierrc +++ b/.prettierrc @@ -3,5 +3,25 @@ "singleQuote": true, "useTabs": false, "tabWidth": 2, - "trailingComma": "all" + "trailingComma": "all", + "overrides": [ + { + "files": "*.js", + "options": { + "parser": "babel" + } + }, + { + "files": "*.md", + "options": { + "parser": "markdown" + } + }, + { + "files": "*.json", + "options": { + "parser": "json" + } + } + ] } diff --git a/site/.vuepress/components/Generator.vue b/site/.vuepress/components/Generator.vue index 3c1a47d..90aab12 100644 --- a/site/.vuepress/components/Generator.vue +++ b/site/.vuepress/components/Generator.vue @@ -137,9 +137,6 @@ export default { ], }; }, - mounted() { - console.log('Hello', this.$lang); - }, methods: { getLabel(key) { return translate(key, this.$lang); diff --git a/site/.vuepress/components/SelectComponent.vue b/site/.vuepress/components/SelectComponent.vue index abf7860..a2e4894 100644 --- a/site/.vuepress/components/SelectComponent.vue +++ b/site/.vuepress/components/SelectComponent.vue @@ -8,13 +8,15 @@ v-for="option in options" :value="option.value" :selected="selectedValue && option.value === selectedValue" - >{{ option.label }}{{ getLabel(option.label) }} diff --git a/site/.vuepress/components/StageLoader.vue b/site/.vuepress/components/StageLoader.vue index 468c658..a384ba1 100644 --- a/site/.vuepress/components/StageLoader.vue +++ b/site/.vuepress/components/StageLoader.vue @@ -120,26 +120,26 @@ export default { stageLoaderLevelOptions: stageLoaderLevels, stageLoaderPresetOptions: stageLoaderPresets, removeDialogueOptions: [ - { value: 'pv5', label: 'Not in Pinna 5' }, - { value: 'yes', label: 'Always' }, - { value: 'no', label: "Don't include" }, + { value: 'pv5', label: 'stageloader.removedialogue.options.pv5' }, + { value: 'yes', label: 'stageloader.removedialogue.options.yes' }, + { value: 'no', label: 'stageloader.removedialogue.options.no' }, ], skippableFMVsOptions: [ - { value: 'pp', label: 'Not in Pinna' }, - { value: 'yes', label: 'Always' }, - { value: 'no', label: "Don't include" }, + { value: 'pp', label: 'stageloader.skippablefmvs.options.pp' }, + { value: 'yes', label: 'stageloader.skippablefmvs.options.yes' }, + { value: 'no', label: 'stageloader.skippablefmvs.options.no' }, ], levelOrderOptions: [ - { value: 'list', label: 'As specified' }, - { value: 'shuffle', label: 'Random, no duplicates' }, - { value: 'random', label: 'Fully random' }, + { value: 'list', label: 'stageloader.levelorder.options.list' }, + { value: 'shuffle', label: 'stageloader.levelorder.options.shuffle' }, + { value: 'random', label: 'stageloader.levelorder.options.random' }, ], postGameOptions: [ - { value: '0F00', label: 'Return to the title screen' }, - { value: '0109', label: 'Load the flooded plaza' }, - { value: '0102', label: 'Load post-Corona plaza' }, - { value: '3400', label: 'Load Corona Montain' }, - { value: '3C00', label: 'Load the Bowser fight' }, + { value: '0F00', label: 'stageloader.postgame.options.0F00' }, + { value: '0109', label: 'stageloader.postgame.options.0109' }, + { value: '0102', label: 'stageloader.postgame.options.0102' }, + { value: '3400', label: 'stageloader.postgame.options.3400' }, + { value: '3C00', label: 'stageloader.postgame.options.3C00' }, ], removeDialogSelection: 'pv5', skippableFMVsSelection: 'pp', @@ -198,11 +198,10 @@ export default { const preset = e.split(';')[0]; const ending = e.split(';')[1]; - const newRoute = []; + this.selectedRoute = []; - for (let i = 0; i <= preset.length - 4; i += 4) newRoute.push({ value: preset.substr(i, 4) }); - - this.selectedRoute = newRoute; + for (let i = 0; i <= preset.length - 4; i += 4) + this.selectedRoute.push({ value: preset.substr(i, 4) }); if (ending) { this.postGameSelection = ending; diff --git a/site/.vuepress/i18n/de-CH.json b/site/.vuepress/i18n/de-CH.json index bffa95b..c6fdabe 100644 --- a/site/.vuepress/i18n/de-CH.json +++ b/site/.vuepress/i18n/de-CH.json @@ -27,18 +27,22 @@ "label": "Level Reihenfolge:", "options": {} }, + "postgame": { + "label": "Nach der Route:", + "options": {} + }, "removedialogue": { "label": "Dialoge entfernen:", - "options": {} + "options": { + "pv5": "Nicht in Pinna 5", + "yes": "Immer", + "no": "Nie" + } }, "skippablefmvs": { "label": "Überspringbare FMVs:", "options": {} }, - "postgame": { - "label": "Nach der Route:", - "options": {} - }, "levelselectplaceholder": "Wähle ein Level..", "loadpresetplaceholder": "Lade eine Vorlage..", "route": "Route", diff --git a/site/.vuepress/i18n/en-US.json b/site/.vuepress/i18n/en-US.json index 429c46c..1b838ca 100644 --- a/site/.vuepress/i18n/en-US.json +++ b/site/.vuepress/i18n/en-US.json @@ -31,19 +31,37 @@ "stageloader": { "levelorder": { "label": "Level Order", - "options": {} + "options": { + "list": "As specified", + "shuffle": "Random, no duplicates", + "random": "Fully random" + } }, "removedialogue": { "label": "Remove Dialogue:", - "options": {} + "options": { + "pv5": "Not in Pinna 5", + "yes": "Always", + "no": "Don't include" + } }, "skippablefmvs": { "label": "Skippable FMVs:", - "options": {} + "options": { + "pp": "Not in Pinna", + "yes": "Always", + "no": "Don't include" + } }, "postgame": { "label": "Post-Game:", - "options": {} + "options": { + "0F00": "Return to the title screen", + "0109": "Load the flooded plaza", + "0102": "Load post-Corona plaza", + "3400": "Load Corona Montain", + "3C00": "Load the Bowser fight" + } }, "levelselectplaceholder": "Choose a level..", "loadpresetplaceholder": "Load a preset..",