Improve gettext regeneration performance
What does this MR do and why?
When regenerating our locale/gitlab.pot
file with all externalized
translation, we currently call the gettext:find
command from the
gettext_i18n_rails
gem. Under the hood this task calls:
gettext:setup
-
gettext:po:update
, which calls:-
gettext:pot:create
to create the pot file -
gettext:po:*:update
on every locale
-
We are actually not interested in updating the po
files as part of
this regeneration process, because we actively revert changes on them as
part of our gettext:regenerate
task. (Our po
files are updated based
on updates from Crowdin).
Therefore we can simplify our regeneration process to actively call:
gettext:setup
gettext:pot:create
This cuts down the regeneration time dramatically (157s => 48s) on my machine.
As an added benefit, I've just updated the gettext:updated_check
command to use our updated gettext:regenerate
, which also means we
will have these performance benefits in CI.
Screenshots or screen recordings
N/A
How to set up and validate locally
- Change any externalized string
- Run
bundle exec rake gettext:regenerate
orbundle exec rake gettext:updated_check
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.