diff options
author | (quasar) nebula <towerofnix@gmail.com> | 2021-03-10 10:19:04 -0400 |
---|---|---|
committer | (quasar) nebula <towerofnix@gmail.com> | 2021-03-10 10:19:04 -0400 |
commit | 590cb87a0eead2db19108e699f5bf652f7bf3431 (patch) | |
tree | 309280d343e185d77e535c4988457d01a7d17034 | |
parent | 8f0842ab522b238bf3aacd4d6bab2c6d384469bf (diff) |
simplify and un-break count.words() logic
-rwxr-xr-x | upd8.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/upd8.js b/upd8.js index 97ee8bf7..8dff388e 100755 --- a/upd8.js +++ b/upd8.js @@ -576,13 +576,15 @@ const count = { number: value => strings.intl.number.format(value), words: (value, {strings, unit = false}) => { + const num = strings.intl.number.format(value > 1000 + ? Math.floor(value / 100) / 10 + : value); + const words = (value > 1000 - ? strings('count.words.thousand', {words: Math.floor(value / 100) / 10}) - : strings('count.words', {words: value})); + ? strings('count.words.thousand', {words: num}) + : strings('count.words', {words: num})); - return (unit - ? countHelper('words')(words, {strings, unit: true}) - : words); + return strings('count.words.withUnit.' + strings.intl.plural.cardinal.select(value), {words}); }, albums: countHelper('albums'), |