This project is archived and is in readonly mode.
HTML fallback when format is :js should be also localized
Reported by José Valim | February 5th, 2009 @ 06:00 PM
The current implementation of localized templates on rails/actionpack/lib/action_view/paths.rb is incomplete.
At line 48, in the method find_template, when we check for a html file if the format is js, we should try first to find the localized version of this file. So what we have now as:
# Try to find html version if the format is javascript
elsif format == :js && template = load_path["#{template_path}.html"]
return template
end
Should actually be:
# Try to find html version if the format is javascript
elsif format == :js && template = load_path["#{template_path}.#{I18n.locale}.html"]
return template
elsif format == :js && template = load_path["#{template_path}.html"]
return template
end
I'm not building a patch, since it's a quick fix.
Comments and changes to this ticket
-
José Valim February 5th, 2009 @ 06:01 PM
Trying again:
The current implementation of localized templates on rails/actionpack/lib/action_view/paths.rb is incomplete.
At the line 48, when we check for a html file when format is js (this is used in when xhr? is true) should be also localized. So what we have now as:
# Try to find html version if the format is javascript elsif format == :js && template = load_path["#{template_path}.html"] return template end
Should actually be:
# Try to find html version if the format is javascript elsif format == :js && template = load_path["#{template_path}.#{I18n.locale}.html"] return template end elsif format == :js && template = load_path["#{template_path}.html"] return template end
I'm not building a patch, since it's a quick fix.
-
josh February 5th, 2009 @ 09:36 PM
- State changed from new to incomplete
Can you please add some unit tests.
-
José Valim February 6th, 2009 @ 09:20 AM
Joshua, patch attached.
I could not see tests for HTML fallback even when not localized. So I added tests for both cases.
-
José Valim February 7th, 2009 @ 07:58 AM
Joshua,
Don't forget to add this one. The tests provide a failing scenario.
Thanks!
-
josh February 7th, 2009 @ 04:56 PM
- State changed from incomplete to open
- Milestone cleared.
-
Repository February 7th, 2009 @ 06:08 PM
- State changed from open to resolved
(from [50f51ff95047858fa6dd889ade3027b7254c6dc0]) Render implicit html template when xhr request now supports localization [#1886 state:resolved] Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...
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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 1886 HTML fallback when format is :js should be also localized (from [50f51ff95047858fa6dd889ade3027b7254c6dc0]) Render ...