Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

translating time_ago_in_words to french for I18n in rails

How can I translate time_ago_in_words?

I am having a missing translation text for the fr locale:

Translation missing: fr.datetime.distance_in_words.x_days ago|

like image 686
foliwe83 Avatar asked Sep 05 '17 19:09

foliwe83


1 Answers

You need to create the corresponding structure in under the datetime key in your fr.yml locale in 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"

You can see the full example here.

like image 191
Sebastian Palma Avatar answered Nov 07 '22 01:11

Sebastian Palma