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,
"useTabs": false,
"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: {
getLabel(key) {
return translate(key, this.$lang);

View file

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

View file

@ -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;

View file

@ -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",

View file

@ -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..",