CodingGarden / is-it-new-years-day

A site that tells you if it is new years day or not.
https://isitnewyearsday.com
9 stars 15 forks source link

Differentiation in languages with arguments and special time translations [Updated] #36

Closed scorixear closed 4 years ago

scorixear commented 4 years ago

Wait no more,

I sat down and changed the client site as I would imagine it and rewrote the CountDown.vue and the translations/index.js.

The standard $time$ argument will be automatically replaced if present and if there is no special translation function in the ìndex.js. Now the translation for Russian still uses the special time translation, turkish or german for example are using the $time$ argument (which is quite shorter).

Will update the pulll request on recent changes if wanted

scorixear commented 4 years ago

yeah no, I give up, the added google translate function destroys pretty much the point of this and myself

w3cj commented 4 years ago

I added the fallback here: https://github.com/CodingGarden/is-it-new-years-day/blob/master/client/src/translations/index.js#L416

I'm still open to using some sort of replacer variable though. The time functions could be updated to just return the formatted time, and the translations.json file could be updated to have the text with the $time$ value.

w3cj commented 4 years ago

Also, the translations.json file could include something like commonPluralization: true or allPlural: true to simplify the number of translation override functions.

I might explore this tonight on stream.

scorixear commented 4 years ago

@w3cj my intention was to have more usability for other developers when creating other languages (since writing into a json is easier than writing into the js).

I might have a look into it later, but now its 0am in germany ;)