added options to getLz
This commit is contained in:
parent
6eba2cfdd2
commit
51534c3640
2 changed files with 19 additions and 1 deletions
|
@ -124,6 +124,16 @@
|
|||
"term.contributors": "Contributors",
|
||||
"term.equalizer": "Equalizer",
|
||||
"term.reset": "Reset",
|
||||
"term.track": [
|
||||
{
|
||||
"value": 1,
|
||||
"text": "track"
|
||||
},
|
||||
{
|
||||
"value": 2,
|
||||
"text": "tracks"
|
||||
}
|
||||
],
|
||||
"term.tracks": "tracks", // Assume x amount of tracks. e.g. 50 tracks
|
||||
"term.videos": "Videos",
|
||||
"term.menu": "Menu",
|
||||
|
|
|
@ -322,8 +322,16 @@ const app = new Vue({
|
|||
this.lz = ipcRenderer.sendSync("get-i18n", lang)
|
||||
this.mklang = await this.MKJSLang()
|
||||
},
|
||||
getLz(message) {
|
||||
getLz(message, options = {}) {
|
||||
if (this.lz[message]) {
|
||||
if(options["plural"]) {
|
||||
let closest = this.lz[message].reduce(function(prev, curr) {
|
||||
return (Math.abs(curr.value - options["plural"]) < Math.abs(prev.value - options["plural"]) ? curr : prev);
|
||||
});
|
||||
return closest.text;
|
||||
}else{
|
||||
return this.lz[message][0].text
|
||||
}
|
||||
return this.lz[message]
|
||||
} else {
|
||||
return message
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue