component translation frameworking

This commit is contained in:
Matteias Collet 2020-07-03 19:23:15 +02:00
parent 137b280c6c
commit 0840e0b3ab
6 changed files with 77 additions and 32 deletions

View file

@ -3,5 +3,25 @@
"singleQuote": true, "singleQuote": true,
"useTabs": false, "useTabs": false,
"tabWidth": 2, "tabWidth": 2,
"trailingComma": "all" "trailingComma": "all",
"overrides": [
{
"files": "*.js",
"options": {
"parser": "babel"
}
},
{
"files": "*.md",
"options": {
"parser": "markdown"
}
},
{
"files": "*.json",
"options": {
"parser": "json"
}
}
]
} }

View file

@ -137,9 +137,6 @@ export default {
], ],
}; };
}, },
mounted() {
console.log('Hello', this.$lang);
},
methods: { methods: {
getLabel(key) { getLabel(key) {
return translate(key, this.$lang); return translate(key, this.$lang);

View file

@ -8,13 +8,15 @@
v-for="option in options" v-for="option in options"
:value="option.value" :value="option.value"
:selected="selectedValue && option.value === selectedValue" :selected="selectedValue && option.value === selectedValue"
>{{ option.label }}</option >{{ getLabel(option.label) }}</option
> >
</select> </select>
</div> </div>
</template> </template>
<script> <script>
import { translate } from '../i18n/localeHelper';
export default { export default {
props: { props: {
disabled: { type: Boolean }, disabled: { type: Boolean },
@ -26,6 +28,11 @@ export default {
data() { data() {
return {}; return {};
}, },
methods: {
getLabel(key) {
return translate(key, this.$lang);
},
},
}; };
</script> </script>

View file

@ -120,26 +120,26 @@ export default {
stageLoaderLevelOptions: stageLoaderLevels, stageLoaderLevelOptions: stageLoaderLevels,
stageLoaderPresetOptions: stageLoaderPresets, stageLoaderPresetOptions: stageLoaderPresets,
removeDialogueOptions: [ removeDialogueOptions: [
{ value: 'pv5', label: 'Not in Pinna 5' }, { value: 'pv5', label: 'stageloader.removedialogue.options.pv5' },
{ value: 'yes', label: 'Always' }, { value: 'yes', label: 'stageloader.removedialogue.options.yes' },
{ value: 'no', label: "Don't include" }, { value: 'no', label: 'stageloader.removedialogue.options.no' },
], ],
skippableFMVsOptions: [ skippableFMVsOptions: [
{ value: 'pp', label: 'Not in Pinna' }, { value: 'pp', label: 'stageloader.skippablefmvs.options.pp' },
{ value: 'yes', label: 'Always' }, { value: 'yes', label: 'stageloader.skippablefmvs.options.yes' },
{ value: 'no', label: "Don't include" }, { value: 'no', label: 'stageloader.skippablefmvs.options.no' },
], ],
levelOrderOptions: [ levelOrderOptions: [
{ value: 'list', label: 'As specified' }, { value: 'list', label: 'stageloader.levelorder.options.list' },
{ value: 'shuffle', label: 'Random, no duplicates' }, { value: 'shuffle', label: 'stageloader.levelorder.options.shuffle' },
{ value: 'random', label: 'Fully random' }, { value: 'random', label: 'stageloader.levelorder.options.random' },
], ],
postGameOptions: [ postGameOptions: [
{ value: '0F00', label: 'Return to the title screen' }, { value: '0F00', label: 'stageloader.postgame.options.0F00' },
{ value: '0109', label: 'Load the flooded plaza' }, { value: '0109', label: 'stageloader.postgame.options.0109' },
{ value: '0102', label: 'Load post-Corona plaza' }, { value: '0102', label: 'stageloader.postgame.options.0102' },
{ value: '3400', label: 'Load Corona Montain' }, { value: '3400', label: 'stageloader.postgame.options.3400' },
{ value: '3C00', label: 'Load the Bowser fight' }, { value: '3C00', label: 'stageloader.postgame.options.3C00' },
], ],
removeDialogSelection: 'pv5', removeDialogSelection: 'pv5',
skippableFMVsSelection: 'pp', skippableFMVsSelection: 'pp',
@ -198,11 +198,10 @@ export default {
const preset = e.split(';')[0]; const preset = e.split(';')[0];
const ending = e.split(';')[1]; 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) }); for (let i = 0; i <= preset.length - 4; i += 4)
this.selectedRoute.push({ value: preset.substr(i, 4) });
this.selectedRoute = newRoute;
if (ending) { if (ending) {
this.postGameSelection = ending; this.postGameSelection = ending;

View file

@ -27,18 +27,22 @@
"label": "Level Reihenfolge:", "label": "Level Reihenfolge:",
"options": {} "options": {}
}, },
"postgame": {
"label": "Nach der Route:",
"options": {}
},
"removedialogue": { "removedialogue": {
"label": "Dialoge entfernen:", "label": "Dialoge entfernen:",
"options": {} "options": {
"pv5": "Nicht in Pinna 5",
"yes": "Immer",
"no": "Nie"
}
}, },
"skippablefmvs": { "skippablefmvs": {
"label": "Überspringbare FMVs:", "label": "Überspringbare FMVs:",
"options": {} "options": {}
}, },
"postgame": {
"label": "Nach der Route:",
"options": {}
},
"levelselectplaceholder": "Wähle ein Level..", "levelselectplaceholder": "Wähle ein Level..",
"loadpresetplaceholder": "Lade eine Vorlage..", "loadpresetplaceholder": "Lade eine Vorlage..",
"route": "Route", "route": "Route",

View file

@ -31,19 +31,37 @@
"stageloader": { "stageloader": {
"levelorder": { "levelorder": {
"label": "Level Order", "label": "Level Order",
"options": {} "options": {
"list": "As specified",
"shuffle": "Random, no duplicates",
"random": "Fully random"
}
}, },
"removedialogue": { "removedialogue": {
"label": "Remove Dialogue:", "label": "Remove Dialogue:",
"options": {} "options": {
"pv5": "Not in Pinna 5",
"yes": "Always",
"no": "Don't include"
}
}, },
"skippablefmvs": { "skippablefmvs": {
"label": "Skippable FMVs:", "label": "Skippable FMVs:",
"options": {} "options": {
"pp": "Not in Pinna",
"yes": "Always",
"no": "Don't include"
}
}, },
"postgame": { "postgame": {
"label": "Post-Game:", "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..", "levelselectplaceholder": "Choose a level..",
"loadpresetplaceholder": "Load a preset..", "loadpresetplaceholder": "Load a preset..",