Skip to content

Missing translations for tax category #13237

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

Conversation

ashishp91
Copy link

@ashishp91 ashishp91 commented Mar 30, 2025

What? Why?

When tax category is null for a product then by default the row value is set to none. Changing the return value to I18n("none") returns the value none in the appropriate translation.

What should we test?

  1. Login as an admin.
  2. Go to profile icon -> administration.
  3. Click on Reports.
  4. Scroll down to All Products and click on it.
  5. Generate a report for a product without a tax category.

Release notes

Changelog Category (reviewers may add a label for the release notes):

  • User facing changes
  • API changes (V0, V1, DFC or Webhook)
  • Technical changes only
  • Feature toggled

The title of the pull request will be included in the release notes.

Dependencies

Documentation updates

@github-project-automation github-project-automation bot moved this to All the things 💤 in OFN Delivery board Mar 30, 2025
@sigmundpetersen sigmundpetersen moved this from All the things 💤 to Code review 🔎 in OFN Delivery board Mar 30, 2025
@sigmundpetersen sigmundpetersen moved this from Code review 🔎 to In Progress ⚙ in OFN Delivery board Mar 30, 2025
@sigmundpetersen sigmundpetersen moved this from In Progress ⚙ to Code review 🔎 in OFN Delivery board Apr 1, 2025
@dacook dacook self-requested a review April 2, 2025 00:24
Copy link
Member

@dacook dacook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, welcome and thanks for the contribution!

I don't think it's necessary to add a unit test, as it's already well covered by report tests (as you found out!)

I think it was a good idea to consider the existing translation. However, this none translation string is a very general string (it is at the top level of the locale file) and it would be good to have a more specific string this specific purpose.
Would you be able to create a new entry under the reports: section instead? (https://github.com/openfoodfoundation/openfoodnetwork/blob/master/config/locales/en.yml#L1762). This will allow translators more flexibility to choose the best translation for that context.

It would be helpful to use the existing lowercase "none" string, which will avoid the need to change any report specs.

@github-project-automation github-project-automation bot moved this from Code review 🔎 to In Progress ⚙ in OFN Delivery board Apr 2, 2025
@ashishp91
Copy link
Author

ashishp91 commented Apr 7, 2025

Hello @dacook I've moved the none translation under reports. Please let me know if you need anything else. Thanks

@sigmundpetersen sigmundpetersen moved this from In Progress ⚙ to Code review 🔎 in OFN Delivery board Apr 7, 2025
@sigmundpetersen sigmundpetersen requested a review from dacook April 7, 2025 13:35
Copy link
Member

@dacook dacook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for following up and making extra changes. I'm sorry but I'll need to request some more changes though:

  1. There's no need to add translations for other languages. Can you please remove these because the manager of each locale may need to choose a different word to suit their context. The only file for us to change is the default en.yml
  2. For en.yml, can you please choose lowercase "none"? This is what it was before, so users won't experience any change. (Imagine if somebody was using a spreadsheet formula on a report which failed because the string didn't match).
  3. In tests, we actually prefer to hardcode the expected text instead of using the I18n.t helper. This is easier to read, which helps avoid errors. So if the string remains lowercase "none", the specs can stay the same as before.

Feel free to rewrite the git history if you're comfortable with that (eg with git rebase -i, otherwise it's ok to keep adding commits.

@github-project-automation github-project-automation bot moved this from Code review 🔎 to In Progress ⚙ in OFN Delivery board Apr 7, 2025
@ashishp91 ashishp91 force-pushed the missing_translations_for_tax_category branch from c41a468 to 2da1709 Compare April 12, 2025 06:31
@ashishp91
Copy link
Author

Hello @dacook, I have made the changes as requested. Silly of me that I didn't ask that earlier in slack dm, I thought about hardcoding and updating all the locales previously. But then I thought you might have your own bandwidth for tasks and dm'ing you might consume that.

@ashishp91 ashishp91 closed this Apr 13, 2025
@github-project-automation github-project-automation bot moved this from In Progress ⚙ to Done in OFN Delivery board Apr 13, 2025
@ashishp91 ashishp91 deleted the missing_translations_for_tax_category branch April 13, 2025 18:07
@dacook
Copy link
Member

dacook commented Apr 13, 2025

Hi @ashishp91 , that's ok, there's always lots of questions when getting started on this codebase, it's not easy at all. Another challenge is that we might not be online at the same times, so don't be afraid to ask questions in the #dev channel, where people in your timezone may be able to help.

I'm sorry if I sounded negative before. We really appreciate the effort you put in to set this up, and I think it's worth continuing with what you had here. But sadly I see you have deleted your fork. Are you sure you don't want to continue on it?

@ashishp91
Copy link
Author

Hey @dacook, My apologies, but I don't know how my repo got deleted. I've changed my github password. I've created #13256 to cover the changes.

I appreciate you guys taking time to review the PR and the way you've created the repo to help open source contributions. Thank you for all the hard work you guys have done. My contribution won't possible without that :)

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

Successfully merging this pull request may close these issues.

[Missing translation] "none" is not translatable
2 participants