Skip to content
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

Not scanning t('string') if added into array #490

Open
leoplct opened this issue Feb 11, 2023 · 1 comment
Open

Not scanning t('string') if added into array #490

leoplct opened this issue Feb 11, 2023 · 1 comment

Comments

@leoplct
Copy link

leoplct commented Feb 11, 2023

I add the string into an array of string, but the i18n-tasks unused marks it as "unused". It pass if it's moved outside of array.

<% 
    warnings = []
%>

<% warnings << t("item_groups.alerts.out_of_budget") %>

<% if warnings.size > 0%>
    <ul class="ul-danger">
          <% warnings.each do |msg| %>
          <li><%=msg%></li>
          <% end %>
      </ul>
<% end %>

instead this works

<%  msg = t("item_groups.alerts.out_of_budget") 

    <% warnings.push(msg) %>
@davidwessman
Copy link
Collaborator

I tried to write a test case for this, and the only syntax I found not to work correctly was without parentheses:

<% warnings << t 'this_key' %>

would get marked as unused. Can you include your version of the gem and a copy of your config file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants