From cf93acb8ad44ba9cd486e8f6457d9fd9fbc041cc Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sun, 12 Jul 2026 23:42:23 +0200 Subject: Add a locale-aware relative-time helper; drop stale locale overrides Node.recently_changed and the new dashboard need "X ago" rendered correctly in both locales. Rails' own distance_of_time_in_words/ time_ago_in_words can't do this on their own -- the scope option changes which translation key is looked up, not the underlying grammar, and German's "vor" requires dative case, which is a different word form than the nominative plural Rails computes by default. relative_time_phrase/relative_distance is a small, from- scratch bucketing helper instead, with an explicit, hand-checked translation table per unit per locale. Also removes de.yml's datetime.distance_in_words and activerecord. errors blocks. Both used the old {{count}}/{{model}} interpolation syntax the current i18n gem no longer recognizes -- it silently leaves the literal placeholder text in the rendered output rather than erroring, which is why this went unnoticed until now. Both were shadowing rails-i18n's own current, correct translations for exactly these keys; deleting the local override lets the gem's version take over instead of maintaining a second, broken copy. --- config/locales/de.yml | 70 +++------------------------------------------------ config/locales/en.yml | 4 +++ 2 files changed, 8 insertions(+), 66 deletions(-) (limited to 'config') diff --git a/config/locales/de.yml b/config/locales/de.yml index 1f2222c..550ccb3 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -14,6 +14,10 @@ de: open_days_label: "Offene Tage" upcoming_events: "Weitere Termine" open_today: "Das Chaos, lokal und heute offen" + published: "veröffentlicht" + published_by: "veröffentlicht durch %{editor}" + editor_self: "du" + publisher_self: "dich" date: formats: default: "%d.%m.%Y" @@ -29,7 +33,6 @@ de: - :day - :month - :year - time: formats: default: "%A, %e. %B %Y, %H:%M Uhr" @@ -41,42 +44,6 @@ de: am: "vormittags" pm: "nachmittags" - datetime: - distance_in_words: - half_a_minute: 'eine halbe Minute' - less_than_x_seconds: - zero: 'weniger als 1 Sekunde' - one: 'weniger als 1 Sekunde' - other: 'weniger als {{count}} Sekunden' - x_seconds: - one: '1 Sekunde' - other: '{{count}} Sekunden' - less_than_x_minutes: - zero: 'weniger als 1 Minute' - one: 'weniger als eine Minute' - other: 'weniger als {{count}} Minuten' - x_minutes: - one: '1 Minute' - other: '{{count}} Minuten' - about_x_hours: - one: 'etwa 1 Stunde' - other: 'etwa {{count}} Stunden' - x_days: - one: '1 Tag' - other: '{{count}} Tage' - about_x_months: - one: 'etwa 1 Monat' - other: 'etwa {{count}} Monate' - x_months: - one: '1 Monat' - other: '{{count}} Monate' - about_x_years: - one: 'etwa 1 Jahr' - other: 'etwa {{count}} Jahre' - over_x_years: - one: 'mehr als 1 Jahr' - other: 'mehr als {{count}} Jahre' - number: format: precision: 2 @@ -105,35 +72,6 @@ de: sentence_connector: "und" skip_last_comma: true - activerecord: - errors: - template: - header: - one: 1 error prohibited this {{model}} from being saved - other: "{{count}} errors prohibited this {{model}} from being saved" - body: "There were problems with the following fields:" - - messages: - inclusion: "is not included in the list" - exclusion: "is reserved" - invalid: "is invalid" - confirmation: "doesn't match confirmation" - accepted: "must be accepted" - empty: "can't be empty" - blank: "can't be blank" - too_long: "is too long (maximum is {{count}} characters)" - too_short: "is too short (minimum is {{count}} characters)" - wrong_length: "is the wrong length (should be {{count}} characters)" - taken: "has already been taken" - not_a_number: "is not a number" - greater_than: "must be greater than {{count}}" - greater_than_or_equal_to: "must be greater than or equal to {{count}}" - equal_to: "must be equal to {{count}}" - less_than: "must be less than {{count}}" - less_than_or_equal_to: "must be less than or equal to {{count}}" - odd: "must be odd" - even: "must be even" - will_paginate: previous_label: "← Zurück" previous_aria_label: "Vorherige Seite" diff --git a/config/locales/en.yml b/config/locales/en.yml index 59c7304..73271ed 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -15,6 +15,10 @@ en: open_days_label: "Open days" upcoming_events: "Upcoming events" open_today: "Open today" + published: "published" + published_by: "published by %{editor}" + publisher_self: "you" + editor_self: "you" time: formats: -- cgit v1.3