-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Translate helper should not escape translations if key end with '.html' or '_html' #244
Comments
@KaptajnKold which version are you using? This was fixed on main branch. |
@stephannv I'm using version 2.0.0.beta2 |
if you change your gemfile to |
@stephannv I've tried that now, but it doesn't appear to make a difference; the translations still get escaped. |
That's strange, I'm using Phlex Rails from main and I could remove my monkey patch similar to yours. include Phlex::Rails::Helpers::T
def view_template
span(class: "mb-2 text-sm text-gray-500") { t(".label_html") }
end This should work because Related code: Can you provide a MRP? |
Strange indeed. I tried forking plex-rails figuring I could create a test case demonstrating the problem, but I couldn't, because within that project, it works fine just like you said. The project where I'm experiencing this issue is a Rails 7.1.3.3 project that uses Phlex components in plain old ERB layouts. I'll try to find some time to create a MRP. |
The native Rails translation helpers (
#translate
and#t
) do not escape translations, if the key ends with_html
or.html
.. Phlex should mirror this behavior.In my toy project, I have overridden Phlex's translation helper from this:
to this:
which seems to do the trick.
The text was updated successfully, but these errors were encountered: