-
Notifications
You must be signed in to change notification settings - Fork 264
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
Clarify the sintax for magic comments in ERB files #435
Comments
If I use the last syntax, then the code gets parsed by erb-lint and I get errors about wrong indentation, so I'm in a loop 🙈 |
I've just found that if I write in this way <%# i18n-tasks-use t('configurations.product_data_sheet_drawings')
# i18n-tasks-use t('configurations.shop_drawings')
# i18n-tasks-use t('configurations.client_drawings')
# i18n-tasks-use t('configurations.production_drawings')
# i18n-tasks-use t('configurations.spare_part_glass_drawings')
# i18n-tasks-use t('configurations.price_overview_drawings')
# i18n-tasks-use t('configurations.wall_template_drawings')
# i18n-tasks-use t('configurations.dp_primer_drawings')
# i18n-tasks-use t('configurations.dp_primer_black_drawings')
# i18n-tasks-use t('configurations.dp_markers_drawings')
# i18n-tasks-use t('configurations.dp_sandblasting_drawings')
# i18n-tasks-use t('configurations.dp_pattern_drawings') -%>
<%= t "configurations.#{type}_drawings" %> changing the closing tag to |
@davidwessman Seems like we might need to do a bit more AST hacking, can you please have a look at this and the other issue? |
Yes, we need to decide on a format! |
Ideally we'd support all of the above |
I have started working on handling the ERB-comments differently that should help for both this issue and #434 but did not manage to get it completely working yet. |
@glebm Should all of these formats be supported? <!-- Inside the same ERB-tag -->
<%
# i18n-tasks-use t('ruby_comment_same_erb_tag')
inside_erb = FakeTranslate.single_inside
%>
<%
# i18n-tasks-use t('multiple_ruby_comment_same_erb_tag1')
# i18n-tasks-use t('multiple_ruby_comment_same_erb_tag2')
# i18n-tasks-use t('multiple_ruby_comment_same_erb_tag3')
inside_erb = FakeTranslate.multiple_inside
%>
<!-- ERB-comments before ERB-tag -->
<%# i18n-tasks-use t('erb_comment_before_erb_tag') %>
<%= FakeTranslate.with_erb_comment_before %>
<%# i18n-tasks-use t('multiple_erb_comment_before_erb_tag1') %>
<%# i18n-tasks-use t('multiple_erb_comment_before_erb_tag2') %>
<%# i18n-tasks-use t('multiple_erb_comment_before_erb_tag3') %>
<%= FakeTranslate.multiple_with_erb_comment_before %>
<%# i18n-tasks-use t('multiple_erb_comment_before_erb_tag1')
i18n-tasks-use t('multiple_erb_comment_before_erb_tag2')
i18n-tasks-use t('multiple_erb_comment_before_erb_tag3') %>
<%= FakeTranslate.multiple_one_tag_with_erb_comment_before %>
<!-- Ruby-comments before ERB-tag -->
<% # i18n-tasks-use t('ruby_comment_before_erb_tag') %>
<%= FakeTranslate.with_ruby_comment_before %>
<% # i18n-tasks-use t('multiple_ruby_comment_before_erb_tag1') %>
<% # i18n-tasks-use t('multiple_ruby_comment_before_erb_tag2') %>
<% # i18n-tasks-use t('multiple_ruby_comment_before_erb_tag3') %>
<%= FakeTranslate.multiple_with_ruby_comment_before %>
<%
# i18n-tasks-use t('multiple_ruby_comment_before_erb_tag1')
# i18n-tasks-use t('multiple_ruby_comment_before_erb_tag2')
# i18n-tasks-use t('multiple_ruby_comment_before_erb_tag3')
%>
<%= FakeTranslate.multiple_one_tag_with_ruby_comment_before %> |
Yeah, I think all of the above are variations of how people write ERB comments, so they should ideally all be supported |
@afdev82 could you try to install from the main-branch and see if it works better for you now? |
All examples in my first post are working now, thank you! <%# i18n-tasks-use t('multiple_erb_comment_before_erb_tag1')
# i18n-tasks-use t('multiple_erb_comment_before_erb_tag2')
# i18n-tasks-use t('multiple_erb_comment_before_erb_tag3') %>
<%= FakeTranslate.multiple_one_tag_with_erb_comment_before %> Or <%#
# i18n-tasks-use t('multiple_erb_comment_before_erb_tag1')
# i18n-tasks-use t('multiple_erb_comment_before_erb_tag2')
# i18n-tasks-use t('multiple_erb_comment_before_erb_tag3') %>
<%= FakeTranslate.multiple_one_tag_with_erb_comment_before %> I don't know if they should be supported too. |
OK, I didn't know that. |
Oh, no worries! I had to find out the difference for this issue. |
Released v1.0.6! |
Hi all,
I've just upgraded to v1 (1.0.5) and I noticed that the health task now is failing due to some unused translations.
E.g., this piece of code was fine with the v0.9.37:
Now if I run
bundle exec i18n-tasks health
, I'm getting unused keys warnings:I noticed that if I write the code in different ways I'm getting different results:
In this way I'm still getting a warning for the last entry, but if I write the comments inside normal <% %> tags, it's fine:
Well, so what is the right way to use the magic comments inside the ERB files?
Thank you for your support!
The text was updated successfully, but these errors were encountered: