Open Laura-O opened 7 years ago
Damn, that's tricky! I don't have any bright ideas for fixing the problem you've run into here, hopefully @timhabermaas can provide some insight?
Tangentially related: "days" probably wasn't the best variable name for this, something like distance_of_time_in_words_to_now
might have avoided the false sense of confidence you got when you saw "days".
@jfly I'm sorry, I don't have a proper solution for this problem, I only found this blog post which points out similar issues, but no (maintainable) solutions.
If I understand this issue correctly it is caused by using "some text #{localized_time_span}"
where localized_time_span
is unaware of the context in which it is being used. This might only be fixable by not using distance_of_time_in_words_to_now
at all and instead defining keys for the different units:
registration_closes_in_months:
one: Die Anmeldung schließt in einem Monat.
other: Die Anmeldung schließt in #{count} Monaten.
registration_closes_in_days:
one: Die Anmeldung schließt in einem Tag.
other: Die Anmeldung schließt in #{count} Tagen.
or a simpler solution: Define all units beforehand, e.g. registration_closes_in
will only handle days.
Thanks for taking a look, @timhabermaas! Yeah, my understanding is that the problem is that localized_time_span
is unaware of the context.
Defining keys for each unit might be the only solution =(
There are several problems with German declension on the translated website. A quick example:
month = Monat months = Monate
Registration closes in 1 month. = Die Anmeldung schließt in 1 Monat. Registration closes in 2 months. = Die Anmeldung schließt in 2 Monaten
There is a key for singular and plural of "months," but used in the sentence above, an 'n' has to be added. I was able to fix most of these grammar problems by rearranging the sentences so that no declension is needed. However, it's not possible to do that with every sentence.
It probably is a lot of extra work to implement declensions, so I am not asking for a fix. But it would help a lot to have more information about keys that are embedded in a sentence in the translation tool. In the example given above, it was "%{days}", which suggested that this will be replaced by something like "20 days". The translation for this would have been right, but as it can also mean "3 months", it's a grammar mistake in German. As several languages have declensions, this would also help other translators.
If I am just missing a cool way to circumvent all this, please let me know. 😄