Merge branch 'develop' of https://github.com/ciderapp/Cider into develop

This commit is contained in:
booploops 2022-02-11 19:20:34 -08:00
commit 4c30b7ece2
3 changed files with 20 additions and 18 deletions

View file

@ -124,16 +124,10 @@
"term.contributors": "Contributors",
"term.equalizer": "Equalizer",
"term.reset": "Reset",
"term.track": [
{
"value": 1,
"text": "track"
"term.track": {
"one" : "track",
"other" : "tracks"
},
{
"value": 2,
"text": "tracks"
}
],
"term.tracks": "tracks", // Assume x amount of tracks. e.g. 50 tracks
"term.videos": "Videos",
"term.menu": "Menu",

View file

@ -324,13 +324,17 @@ const app = new Vue({
},
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;
if(options["count"] ) {
if (typeof this.lz[message] === "object"){
let type = window.fastPluralRules.getPluralFormNameForCardinalByLocale(this.cfg.general.language.replace("_","-"),options["count"]);
return this.lz[message][type] ?? ((this.lz[message])[Object.keys(this.lz[message])[0]] ?? this.lz[message])
} else {
// fallback English plural forms ( old i18n )
if (options["count"] > 1) {
return this.lz[message+ "s"] ?? this.lz[message]} else { return this.lz[message]}
}
} else if(typeof this.lz[message] === "object") {
return this.lz[message][0].text;
return (this.lz[message])[Object.keys(this.lz[message])[0]]
}
return this.lz[message]
} else {
@ -2149,7 +2153,10 @@ const app = new Vue({
let hours = Math.floor(time / 3600)
let mins = Math.floor(time / 60) % 60
let secs = time % 60
return app.showingPlaylist.relationships.tracks.data.length + " " + app.getLz('term.tracks') + ", " + ((hours > 0) ? (hours + (" " + ((hours > 1) ? app.getLz('term.time.hours') + ", " : app.getLz('term.time.hour') + ", "))) : "") + ((mins > 0) ? (mins + ((mins > 1) ? " " + app.getLz('term.time.minutes') + ", " : " " + app.getLz('term.time.minute') + ", ")) : "") + secs + ((secs > 1) ? " " + app.getLz('term.time.seconds') + "." : " " + app.getLz('term.time.second') + ".");
return app.showingPlaylist.relationships.tracks.data.length + " " + app.getLz('term.track', options = {count : app.showingPlaylist.relationships.tracks.data.length}) + ", "
+ ((hours > 0) ? (hours + (" " + (app.getLz('term.time.hour', options = {count : hours}) + ", "))) : "") +
((mins > 0) ? (mins + (" " + app.getLz('term.time.minute', options = {count : mins}) + ", ")) : "") +
secs + (" " + app.getLz('term.time.second', options = {count : secs}) + ".");
} else return ""
} catch (err) {
return ""

View file

@ -72,6 +72,7 @@
document.write(unescape("%3Cscript src='https://js-cdn.music.apple.com/musickit/v2/amp/musickit.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
<script src="https://unpkg.com/fast-plural-rules@1.0.2/dist/index.umd.min.js"></script>
<script
src="index.js?v=1"></script>
<script