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;
|
||||
font-weight: bold;
|
||||
font-size: 1em;
|
||||
font-family: system-ui, 'Pretendard Variable';
|
||||
font-family: system-ui, "Pretendard Variable";
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,25 +11,20 @@ export const i18nEditor = Vue.component("i18n-editor", {
|
|||
<div class="col-auto nopadding selectCol">
|
||||
<select class="md-select" @change="$root.setLz('');$root.setLzManual()" v-model="$root.cfg.general.language">
|
||||
<optgroup :label="index" v-for="(categories, index) in getLanguages()">
|
||||
<option v-for="lang in categories" :value="lang.code">
|
||||
{{lang.nameNative}}
|
||||
({{lang.nameEnglish }})
|
||||
</option>
|
||||
<option v-for="lang in categories" :value="lang.code">{{lang.nameNative}} ({{lang.nameEnglish }})</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
<button class="md-btn" @click="exportLz">Export</button>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<hr />
|
||||
<div class="md-option-container">
|
||||
<template v-for="(val, key) in baseLz">
|
||||
<div class="md-option-line" v-if="$root.lz[key]">
|
||||
<div class="md-option-segment">
|
||||
{{ key }}
|
||||
</div>
|
||||
<div class="md-option-segment">{{ key }}</div>
|
||||
<div class="md-option-segment">
|
||||
<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}}
|
||||
<input type="text" v-model="$root.lz[key][vkey]" />
|
||||
</div>
|
||||
|
@ -52,32 +47,32 @@ export const i18nEditor = Vue.component("i18n-editor", {
|
|||
data() {
|
||||
return {
|
||||
listing: ipcRenderer.sendSync("get-i18n-listing"),
|
||||
baseLz: ipcRenderer.sendSync("get-i18n", "en_US")
|
||||
}
|
||||
baseLz: ipcRenderer.sendSync("get-i18n", "en_US"),
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
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");
|
||||
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 () {
|
||||
let langs = this.$root.lzListing
|
||||
let langs = this.$root.lzListing;
|
||||
let categories = {
|
||||
"main": [],
|
||||
"fun": [],
|
||||
"unsorted": []
|
||||
}
|
||||
main: [],
|
||||
fun: [],
|
||||
unsorted: [],
|
||||
};
|
||||
// sort by category if category is undefined or empty put it in "unsorted"
|
||||
for (let i = 0; i < langs.length; i++) {
|
||||
if (langs[i].category === undefined || langs[i].category === "") {
|
||||
categories.unsorted.push(langs[i])
|
||||
categories.unsorted.push(langs[i]);
|
||||
} else {
|
||||
categories[langs[i].category].push(langs[i])
|
||||
categories[langs[i].category].push(langs[i]);
|
||||
}
|
||||
}
|
||||
// return
|
||||
return categories
|
||||
return categories;
|
||||
},
|
||||
},
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue