PButcher / flipdown

⏰ A lightweight and performant flip styled countdown clock
https://pbutcher.uk/flipdown/
MIT License
384 stars 123 forks source link

Plural/Singular .. #25

Closed osworx closed 4 years ago

osworx commented 4 years ago

While it maybe good to have a translation, see https://github.com/PButcher/flipdown/pull/13 I do not think that it wil be a good idea to translate the strings via css. Same goes to the English strings inside the css.

Why?

For example (currently via CSS):

English: 1 Days 1 Hours 1 Minutes 59 Seconds German: 1 Tage 1 Stunden 1 Minuten 59 Sekunden

Reads very unprofessional!

I think (as it is at many much bigger scripts) that it will be better, to have the few language strings as external javascript and initialize the main script with English strings. If an option is set, for example { lang: 'de' }

the translation is loaded (if not exist, the default EN vars are used). This way everybody can translate in every language he wants, and you have no additonal work - but could provide a professional plugin.

And doing it this way, singular and plural language strings can be assigned and used very easily.

PButcher commented 4 years ago

The headers are defining the time unit below them, so the current pluralisation of the headings is technically correct: Minutes: 1 vs ~Minute: 1~.

If there is ever an option to display the headers below the rotors then I agree with you that plurals should be removed for singular values.

As for defining language files in JS rather than CSS, that's an interesting one. It would still be possible to define singular versions of the heading labels by appending something like a .singluar class to the rotor and adding additional lines to a flipdown CSS language definition file, but at the cost of 4 extra selectors. At that point, JS might be more user friendly. I'll bare this in mind, thank you.

PButcher commented 4 years ago

Now possible thanks to #29