WIP: Add rubocop-i18n
What does this MR do?
Adds rubocop-i18n
(see https://github.com/puppetlabs/rubocop-i18n) to our codebase to detect untranslated strings in Ruby files.
Except for GetText/DecorateFunctionMessage
(https://github.com/puppetlabs/rubocop-i18n#gettextdecoratefunctionmessage) the following cops were enabled:
-
GetText/DecorateString
(https://github.com/puppetlabs/rubocop-i18n#gettextdecoratestring) -
GetText/DecorateStringFormattingUsingInterpolation
(https://github.com/puppetlabs/rubocop-i18n#gettextdecoratefunctionmessage) -
GetText/DecorateStringFormattingUsingPercent
(https://github.com/puppetlabs/rubocop-i18n#gettextdecoratestringformattingusingpercent)
The following MRs were opened to externalize those strings:
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/26845
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/26420
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/26357
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/27106
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/27181
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/27207
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/27220
- https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/10989
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/27369
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/27390
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/27410
EE Port: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/10987
Missed cases
In the following cases rubocop-i18n
wasn't able to detect offenses:
- Strings without a trailing
.
,!
or?
- Individual words
- See https://github.com/puppetlabs/rubocop-i18n#ignored
- This affects for example
title
andplaceholders
attributes in models and services (e.g.pipelines_email_service.rb
orjira_service.rb
)
- Strings that that don't start with a capital letter.
- Concatenated strings, e.g. in split sentences like in
app/helpers/visibility_level_helper.rb
ormilestone_time_for
inapp/helpers/milestones_helper.rb
What are the relevant issue numbers?
https://gitlab.com/gitlab-org/gitlab-ce/issues/57968
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated via this MR -
Documentation reviewed by technical writer or follow-up review issue created -
Tests added for this feature/bug -
Tested in all supported browsers -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides -
Link to e2e tests MR added if this MR has Requires e2e tests label. See the Test Planning Process. -
Security reports checked/validated by reviewer
Edited by Martin Wortschack