New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interpolate now works for an array #282
Conversation
Looks good! Happy to merge when I get back from holidays unless anybody else wants to look into this first?
|
Any updates? |
What happened? Still not support? |
Code works but it's not merged yet. If you want to use it is I would recommend you reading this: http://stackoverflow.com/a/25484080 Wysłane z iPhone'a Dnia 24 sty 2015 o godz. 15:05 Seaborn Lee notifications@github.com napisał(a):
|
@Bartuz Thanks! |
Still not any news? |
@tigrish Please take a look when you have time :) |
@tigrish any word on this? Seems like a really useful feature without any downsides |
It's been almost a year since I opened pull request 😞 |
Ya, sorry about that, I'm planning to get back to i18n in the upcoming days/weeks, things have been a bit crazy around here :), I'll keep this one on my radar and check back soon. Thanks everyone! |
@@ -150,6 +150,8 @@ def pluralize(locale, entry, count) | |||
def interpolate(locale, string, values = {}) | |||
if string.is_a?(::String) && !values.empty? | |||
I18n.interpolate(string, values) | |||
elsif string.is_a?(::Array) && !values.empty? | |||
string.map { |el| interpolate(locale, el, values) } | |||
else | |||
string | |||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this whole method should be rewritten to make it clearer and cut down repetition:
def interpolate(locale, subject, values = {})
return subject if values.empty?
case subject
when ::String then I18n.interpolate(subject, values)
when ::Array then subject.map { |element| interpolate(locale, element, values) }
else
subject
end
end
It covers full use case now. Thankfully to ruby-i18n#282 (comment)
Passed on my machine... - ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin14.0] |
Travis matrix buggy :S |
But something is wrong anyway: #324 |
There is no news about this right? Thanks to all |
Looks fine to me. Just going to wait on the build and then once that's showing green I'll merge this. |
on Rails 4.2.x travis build. is it possible my commits caused it? I doubt it... |
Try a "bundle update json" and then committing Gemfile.lock and see if that fixes it
|
removes unnecessary line
Suggested by @clemens
It covers full use case now. Thankfully to ruby-i18n#282 (comment)
This reverts PART of commit ee27f3d. thanks @clemens https://github.com/svenfuchs/i18n/pull/282/files#r37780129
Anxiously awaiting this 👍 |
+1 |
Damned, why this fix is still not applied? |
ryanbigg.com/now could be a reason, perhaps?
… On 18 Nov 2017, at 12:25, am ***@***.***> wrote:
Damned, why this fix is still not applied?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
#395 has been merged. Please try the latest i18n master. |
Fixes #281
Credits for @ahmadsherif, thank you Ahmad!