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

Masks off unused translation keys in activerecord #5242

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nenad-vujicic
Copy link
Contributor

PR replaces .is_already_muted with I18n.t("activerecord.errors.models.user_mute.is_already_muted") in user_mute.rb and adds activerecord.errors.models.user_mute.attributes.subject.format under ignore_unused (in i18n-tasks.yml) since used for formatting above validation error message, so they are not reported as unused anymore.

@nenad-vujicic nenad-vujicic force-pushed the issue_remove_unused_translations_in_activerecords branch from a0cc4d4 to 8c90725 Compare September 30, 2024 16:14
@tomhughes
Copy link
Member

Is this really an improvement though? We're hard coding something that rails does for us automatically in order to keep i18n-tasks happy - is that a good thing?

Adds activerecord.errors.models.user_mute.{attributes.subject.format, is_already_muted} under ignore_unused (in i18n-tasks.yml) so they are not reported as unused anymore.
@nenad-vujicic nenad-vujicic force-pushed the issue_remove_unused_translations_in_activerecords branch from 8c90725 to f862880 Compare September 30, 2024 20:50
@nenad-vujicic nenad-vujicic changed the title Improves unused translation keys in activerecord Masks off unused translation keys in activerecord Sep 30, 2024
@nenad-vujicic
Copy link
Contributor Author

I agree, thanks. Honestly, I couldn't decide which one I didn't like more, hardcoding translating or adding to ignore list in i18n-tasks.yml (the latest commit). Is there a better way to solve this, or should this translation remain reported as unused?

@mmd-osm
Copy link
Collaborator

mmd-osm commented Sep 30, 2024

I was also wondering about this. IMHO the right place to address this issue would be a proper parser in https://github.com/glebm/i18n-tasks, which is able to handle model validation error messages. I didn't find anything in there, maybe we could raise an issue?

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

Successfully merging this pull request may close these issues.

3 participants