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

Possible differentiation between grammar styles #32

Closed scorixear closed 4 years ago

scorixear commented 4 years ago

This could potentially be a solution for different grammar (and therefor word orders) in different languages.

This is not a finished solution and does not work yet (since it is not implemented) but rather under "needs work".

I added an example of the correct german translation for the Sentence: "it has been new years day for 12 hours bla bla bla..." In German, this should be "Seit 12 Stunden (bla bla bla) ist es Silvester." with the Time being in the middle of the sentence.

I, unfortunately, do not have time now to implement the solution into the code for now (also german does not work for me on the website - so this should need some more changes) but I thought that the process of creating the text could be something like this (pseudocode):

Read language translation file in
select language based on browser

insert translations into the website:
  if (translation contains $time$)
    Write sentence.Replace("$time$",timeTranslation)
  else
    Write sentence + " " +timeTranslation

Therefore not every translation should need a $time$

w3cj commented 4 years ago

Thanks for the idea! This could work. We will still need a time stamp translation function for each language as some languages have more than just singular / plural or only use plural AND some languages are written right to left.