#23 ✓resolved
mail (at arcasys)

interpolate_with_deprecated_syntax

Reported by mail (at arcasys) | April 1st, 2009 @ 10:41 AM

interpolate_with_deprecated_syntax currently replaces %d and %s with {{count}} and {{value}} respectively and issues a warning.
This behaviuor doesn't solve the problem the sysntax change was intended for. Instead, interpolate must ignore %d and %s, i.e. let them pass unchanged. There can still be a compile warning.

Maybe I missed how I can force interpolate to use interpolate_without_deprecated_syntax? In that case I'd appreciate a hint.

Hans

Comments and changes to this ticket

  • Sven Fuchs

    Sven Fuchs July 5th, 2009 @ 10:55 PM

    Hi Hans,

    can you explain further why you think "behaviuor doesn't solve the problem the sysntax change was intended for"? Because I think it does :) People were previously using %s and %d as interpolation variables so they'll expect the variables count and value to be interpolated to these, no?

    I also don't really get your last question. Do you mean how you could bypass interpolate_without_deprecated_syntax?

  • Sven Fuchs

    Sven Fuchs July 7th, 2009 @ 09:55 AM

    • State changed from “new” to “open”

    Hi Hans, thanks for the detailled explanation. I agree with your definition of "deprecation" and I think it perfectly applies to this case. I don't really see a real conflict between the "old and new way" so I'd say the second case applies: the old element was not sufficient for proper I18n.

    So, from what I understand this is just a bug. This line:

    http://github.com/rails/rails/blob/0d3c5f0a822cd1b6029b5f619774b779...

    probably should be:

      return string unless string.is_a?(String) && !values.empty?
    

    Right? So, it should assume you want the backend to interpolate values to the string only when you have passed values to the backend. (We've done some similar fix in the backend IIRC.) In your example you would not pass any values so the neither the interpolation nor the deprectation would kick in.

    Btw is there a reason why you do not use #localize for this?

  • Sven Fuchs

    Sven Fuchs July 8th, 2009 @ 07:06 PM

    • State changed from “open” to “resolved”

    Alright, I've added a patch and ticket to Rails' lighthouse:

    https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets...

    Maybe you wanna +1 on that

    Closing this ticket, please reopen if the problem remains

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

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

Repository for collecting Locale data for Ruby on Rails I18n as well as other interesting, Rails related I18n stuff

People watching this ticket

Pages