This project is archived and is in readonly mode.
HTML fallback when format is :js should be also localized
-
José Valim
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 endShould 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 endI'm not building a patch, since it's a quick fix.
-
José Valim
Joshua, patch attached.
I could not see tests for HTML fallback even when not localized. So I added tests for both cases.
-
José Valim
Joshua,
Don't forget to add this one. The tests provide a failing scenario.
Thanks!
-
josh
- State changed from incomplete to open
- Milestone cleared.
-
Repository
- State changed from open to resolved
(from [50f51ff95047858fa6dd889ade3027b7254c6dc0]) Render implicit html template when xhr request now supports localization [#1886 HTML fallback when format is :js should be also localized state:resolved] Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...
