[openstreetmap/openstreetmap-website] Source of translations of future dates (Issue #5769)
Andy Allan
notifications at github.com
Wed Mar 12 11:15:20 UTC 2025
gravitystorm left a comment (openstreetmap/openstreetmap-website#5769)
As far as I can see so far, we have a few issues here.
* We can't translate every sentence that contains a duration, future time or past time separately. We have [13 different types of time](https://github.com/openstreetmap/openstreetmap-website/blob/432fa57e61c5535eb955ee50529aa43b18787fe4/config/locales/en.yml#L165-L201), and each of those need a language-dependent number of translations (normally 2-4) and we use dates in many different places on the website. So some sort of consolidation and interpolation is necessary.
* rails has a few [time helpers](https://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html), and by default they use the same translation scope for every helper. (Some of the helpers are also slightly misleadingly named).
* We currently have two sources of time translations:
* rails-i18n, which we use for durations and future times
* our own [distance_in_words_ago](https://github.com/openstreetmap/openstreetmap-website/blob/432fa57e61c5535eb955ee50529aa43b18787fe4/config/locales/en.yml#L164) which [we use for past times](https://github.com/openstreetmap/openstreetmap-website/blob/master/app/helpers/application_helper.rb#L28-L34](https://github.com/openstreetmap/openstreetmap-website/blob/432fa57e61c5535eb955ee50529aa43b18787fe4/app/helpers/application_helper.rb#L28-L34))
* I think the problem might be that some translations in rails-i18n are correct for past times, and therefore not durations or future times (e.g. slovakian, see [sk](https://github.com/svenfuchs/rails-i18n/blob/5e37210c8d3506f8b6925c67752d85fbee15a2a4/rails/locale/sk.yml#L77)) but others are correct for durations/future times (e.g. [de](https://github.com/svenfuchs/rails-i18n/blob/5e37210c8d3506f8b6925c67752d85fbee15a2a4/rails/locale/de.yml#L96)), see also #2255.
So to resolve this I think we need to do the following:
* Agree to stop using rails-i18n for time durations. Their translations are not grammatically consistent between languages as to whether they represent durations or past times.
* We already have our own translations for `distance_in_words_ago`. But do we need separate sets of translations for `distance_in_words_duration` and `distance_in_words_in_future`? Or are they the same in each language?
* Do we need separate translations for `distance_in_words_in_future` and `distance_in_words_in_future_in_a_sentence`?
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5769#issuecomment-2717518252
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/issues/5769/2717518252 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250312/9d061538/attachment.htm>
More information about the rails-dev
mailing list