This project is archived and is in readonly mode.

#5806 open
tassmann (at jovoto)

add I18n scope option to distance_of_time_in_words

Reported by tassmann (at jovoto) | October 14th, 2010 @ 02:04 PM

add option for distance_of_time_in_words to add an custom I18n scope.

For example in german the wording depends on the context: 3 days = 3 Tage 3 days ago = vor 3 Tagen (with an n)

this patch gives more flexibility for different contexts

patch attached or

Comments and changes to this ticket

  • tassmann (at jovoto)

    tassmann (at jovoto) October 14th, 2010 @ 02:04 PM

    • Tag set to date_helper, i18n, patch
  • Yaroslav Markin

    Yaroslav Markin October 16th, 2010 @ 04:17 AM

    • Assigned user set to “José Valim”

    Is it possible to do the same with lambda-translations feature of I18n? In that case, we'll need to pass the datetime object to Proc which does the translation, instead of patching like that.

    Could you look into it?

  • Thomas Fritzsche

    Thomas Fritzsche December 22nd, 2010 @ 07:45 AM

    I just come across this ticket while searching for a solution for exactly this issue in German translation? As I'm new to i18n, may I ask you: This lambda-translation you suggested. Is this something I can use in my project or this is just a ways you guys try to fix the i18n support of distance_of_time_in_words?

    As "time_ago_in_words" and "distance_of_time_in_words" should yield in different texts in German grammar. I could maybe adjust the translation to meaning "time_ago_in_words" ("vor 3 Tage" --> "vor 3 Tagen") and just use this version? Or I create a local copy of that method in my project that is using different translations for "time_ago_in words"?

    Thanks so much for your great work!

  • rails

    rails March 23rd, 2011 @ 12:00 AM

    • State changed from “new” to “open”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • rails

    rails March 23rd, 2011 @ 12:00 AM

    • State changed from “open” to “stale”
  • tassmann (at jovoto)

    tassmann (at jovoto) March 23rd, 2011 @ 09:01 AM

    the problem still exists in rails3, nothing changed..

  • tassmann (at jovoto)

    tassmann (at jovoto) March 23rd, 2011 @ 09:02 AM

    • State changed from “stale” to “open”

    forgot the reopen part .. [state:open]

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>