gettext:regenerate task fails when a locale file has been removed
Summary
When a locale file is deleted, the git ignored files (gitlab.edit.po
and gitlab.po.timestamp
) remain on local dev environments and the gettext:regenerate
task will fail to reset the .po
files. This means there are a lot of changes to files that don't need to be committed. This is because the git checkout
command fails at the end of the rake task: https://gitlab.com/gitlab-org/gitlab/blob/421ac63d/lib/tasks/gettext.rake#L41-41
Steps to reproduce
- Create a new
locale/<language-code>/gitlab.po
file - run
rails gettext:regenerate
- Delete the file created in the first step
- run
rails gettext:regenerate
What is the current bug behavior?
All locale files have uncommitted changes
What is the expected correct behavior?
Only the gitlab.pot
file has uncommitted changes
Proposed fix
-
Only checkout files that actually exist at the end of the rake task. Done in !41473 (merged) -
At the start of the task, force remove locale folders (ie locale/ml_IN
) if the folder does not contain agitlab.po
file.
Workaround
Manually delete the entire locale folder that no longer contains a gitlab.po
file.
For example:
$ rm -rf locale/ml_IN/
Edited by Josianne Hyson