在 rails 中将 time_ago_in_words 翻译成法语,用于 I18n

fol*_*e83 4 ruby-on-rails

我该如何翻译time_ago_in_words

我缺少 fr 语言环境的翻译文本:

翻译缺失:fr.datetime.distance_in_words.x_days ago|

Seb*_*lma 9

您需要datetime在 fr.yml 语言环境中的键下创建相应的结构config/locales/

  datetime:
    distance_in_words:
      about_x_hours:
        one: environ une heure
        other: environ %{count} heures
      about_x_months:
        one: environ un mois
        other: environ %{count} mois
      about_x_years:
        one: environ un an
        other: environ %{count} ans
      almost_x_years:
        one: presqu'un an
        other: presque %{count} ans
      half_a_minute: une demi-minute
      less_than_x_minutes:
        zero: moins d'une minute
        one: moins d'une minute
        other: moins de %{count} minutes
      less_than_x_seconds:
        zero: moins d'une seconde
        one: moins d'une seconde
        other: moins de %{count} secondes
      over_x_years:
        one: plus d'un an
        other: plus de %{count} ans
      x_days:
        one: 1 jour
        other: "%{count} jours"
      x_minutes:
        one: 1 minute
        other: "%{count} minutes"
      x_months:
        one: 1 mois
        other: "%{count} mois"
      x_years:
        one: un an
        other: "%{count} ans"
      x_seconds:
        one: 1 seconde
        other: "%{count} secondes"
Run Code Online (Sandbox Code Playgroud)

您可以在此处查看完整示例。