-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
Add a cop to enforce internationalization #624
Comments
@pirj How do you think this will be better implemented? Just checking for strings in models/controllers/etc would give a lot of false positives. So this should be implemented as checking specific methods and their arguments? Like |
Exactly. |
I think this would be a useful cop, but should be disabled by default. The majority of apps only target a single locale, and this approach requires extra effort. (and I would support updating the styleguide to reflect this nuance). |
Fair enough. Some thoughts aloud. Even though the app might be a single locale, it's easier for non-tech staff to edit a singe YAML file to fix copy rather than update code. I've seen this in practice a couple of times. Surely, adding new entries to model validation will still require developer's effort, due to a non-trivial structure, but updating existing non-default ones is possible. When the cop is disabled by default, it's nearly ever used. Some cops just don't apply in certain cases, and it's a usual routine to disable them on a new project, e.g. It reminds me of "the business logic should naturally reside in the model" and the "keep complicated formatting logic out of views". It's tempting to have logic in controllers and views, and putting it to where it belongs is an extra effort, too. |
#620 brought up a problem with user-facing string appearing directly in models.
Describe the solution you'd like
Add a cop that enforces https://rails.rubystyle.guide/#locale-texts, at least for basic cases for the start.
The text was updated successfully, but these errors were encountered: