chore: Prettified Code
[ci skip]
This commit is contained in:
parent
b5074cfe6f
commit
4c0855165f
2 changed files with 18 additions and 23 deletions
|
@ -1486,7 +1486,7 @@
|
||||||
color: #eee;
|
color: #eee;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
font-family: system-ui, 'Pretendard Variable';
|
font-family: system-ui, "Pretendard Variable";
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,25 +11,20 @@ export const i18nEditor = Vue.component("i18n-editor", {
|
||||||
<div class="col-auto nopadding selectCol">
|
<div class="col-auto nopadding selectCol">
|
||||||
<select class="md-select" @change="$root.setLz('');$root.setLzManual()" v-model="$root.cfg.general.language">
|
<select class="md-select" @change="$root.setLz('');$root.setLzManual()" v-model="$root.cfg.general.language">
|
||||||
<optgroup :label="index" v-for="(categories, index) in getLanguages()">
|
<optgroup :label="index" v-for="(categories, index) in getLanguages()">
|
||||||
<option v-for="lang in categories" :value="lang.code">
|
<option v-for="lang in categories" :value="lang.code">{{lang.nameNative}} ({{lang.nameEnglish }})</option>
|
||||||
{{lang.nameNative}}
|
|
||||||
({{lang.nameEnglish }})
|
|
||||||
</option>
|
|
||||||
</optgroup>
|
</optgroup>
|
||||||
</select>
|
</select>
|
||||||
<button class="md-btn" @click="exportLz">Export</button>
|
<button class="md-btn" @click="exportLz">Export</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr />
|
||||||
<div class="md-option-container">
|
<div class="md-option-container">
|
||||||
<template v-for="(val, key) in baseLz">
|
<template v-for="(val, key) in baseLz">
|
||||||
<div class="md-option-line" v-if="$root.lz[key]">
|
<div class="md-option-line" v-if="$root.lz[key]">
|
||||||
<div class="md-option-segment">
|
<div class="md-option-segment">{{ key }}</div>
|
||||||
{{ key }}
|
|
||||||
</div>
|
|
||||||
<div class="md-option-segment">
|
<div class="md-option-segment">
|
||||||
<template v-if='typeof $root.lz[key] == "object"'>
|
<template v-if='typeof $root.lz[key] == "object"'>
|
||||||
<div v-for='(variant, vkey) in $root.lz[key]'>
|
<div v-for="(variant, vkey) in $root.lz[key]">
|
||||||
{{variant}}
|
{{variant}}
|
||||||
<input type="text" v-model="$root.lz[key][vkey]" />
|
<input type="text" v-model="$root.lz[key][vkey]" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -52,32 +47,32 @@ export const i18nEditor = Vue.component("i18n-editor", {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
listing: ipcRenderer.sendSync("get-i18n-listing"),
|
listing: ipcRenderer.sendSync("get-i18n-listing"),
|
||||||
baseLz: ipcRenderer.sendSync("get-i18n", "en_US")
|
baseLz: ipcRenderer.sendSync("get-i18n", "en_US"),
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
exportLz() {
|
exportLz() {
|
||||||
bootbox.alert(`<textarea spellcheck='false' style="width:100%;height: 300px;">${JSON.stringify(app.lz, true, ' ')}</textarea>`)
|
bootbox.alert(`<textarea spellcheck='false' style="width:100%;height: 300px;">${JSON.stringify(app.lz, true, " ")}</textarea>`);
|
||||||
notyf.success("Copied to clipboard");
|
notyf.success("Copied to clipboard");
|
||||||
navigator.clipboard.writeText(JSON.stringify(app.lz, true, ' ')).then((r) => console.debug("Copied to clipboard."));
|
navigator.clipboard.writeText(JSON.stringify(app.lz, true, " ")).then((r) => console.debug("Copied to clipboard."));
|
||||||
},
|
},
|
||||||
getLanguages: function () {
|
getLanguages: function () {
|
||||||
let langs = this.$root.lzListing
|
let langs = this.$root.lzListing;
|
||||||
let categories = {
|
let categories = {
|
||||||
"main": [],
|
main: [],
|
||||||
"fun": [],
|
fun: [],
|
||||||
"unsorted": []
|
unsorted: [],
|
||||||
}
|
};
|
||||||
// sort by category if category is undefined or empty put it in "unsorted"
|
// sort by category if category is undefined or empty put it in "unsorted"
|
||||||
for (let i = 0; i < langs.length; i++) {
|
for (let i = 0; i < langs.length; i++) {
|
||||||
if (langs[i].category === undefined || langs[i].category === "") {
|
if (langs[i].category === undefined || langs[i].category === "") {
|
||||||
categories.unsorted.push(langs[i])
|
categories.unsorted.push(langs[i]);
|
||||||
} else {
|
} else {
|
||||||
categories[langs[i].category].push(langs[i])
|
categories[langs[i].category].push(langs[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// return
|
// return
|
||||||
return categories
|
return categories;
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue