Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed translate helper so that it doesn’t mark every translation as…
… safe HTML. Only keys with a "_html" suffix and keys named "html" are considered to be safe HTML. All other translations are left untouched. Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
- Loading branch information
Showing
4 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<%= t(['foo', 'bar']) %> | ||
<%= t(['foo', 'bar', 'html']) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5208cc3
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.
Have you considered this situation:
Here we have no html in the translation itself, but are still required to name it welcome_html for it to work. Doesn't this seem wrong to you?
5208cc3
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.
I agree with rasmusrn. It should follow the same rules are ERB:
Ideally (if it doesn't already), link_to should return an html_safe by default. The title and url passed into it should be escaped within the link_to definition
5208cc3
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.
I have raised this issue in the Rails Core Group: http://groups.google.com/group/rubyonrails-core/browse_thread/thread/8a18c9fbe1ea4e4c
5208cc3
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.
Kieran, FYI have a look at the Rails Core Group thread I posted above. Koz makes a good point. The i18n module shouldn't be "html aware".