Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-05-07 19:39:46 +0300
committerBob Van Landuyt <bob@vanlanduyt.co>2018-06-15 15:58:47 +0300
commit9b5339371b500829b87602cfe7ba773e1027109f (patch)
treec21fa625bdedbab6727add0cf84b19cb919215d5 /lib/tasks/gettext.rake
parenta9ebcfa5f55fe8444d9c0058904a9f1dbee7e32e (diff)
Validate if changed translations are checked in
Diffstat (limited to 'lib/tasks/gettext.rake')
-rw-r--r--lib/tasks/gettext.rake26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/tasks/gettext.rake b/lib/tasks/gettext.rake
index 247d7be7d78..efe2997d78e 100644
--- a/lib/tasks/gettext.rake
+++ b/lib/tasks/gettext.rake
@@ -50,6 +50,32 @@ namespace :gettext do
end
end
+ task :updated_check do
+ # Removeing all pre-translated files speeds up `gettext:find` as the
+ # files don't need to be merged.
+ `rm locale/*/gitlab.po`
+
+ # `gettext:find` writes touches to temp files to `stderr` which would cause
+ # `static-analysis` to report failures. We can ignore these
+ silence_stream(STDERR) { Rake::Task['gettext:find'].invoke }
+
+ changed_files = `git diff --name-only`.lines.map(&:strip)
+
+ # reset the locale folder for potential next tasks
+ `git checkout locale`
+
+ if changed_files.include?('locale/gitlab.pot')
+ raise <<~MSG
+ Newly translated strings found, please add them to `gitlab.pot` by running:
+
+ bundle exec rake gettext:find; git checkout locale/*/gitlab.po;
+
+ Then check in the resulting `locale/gitlab.pot`
+
+ MSG
+ end
+ end
+
def report_errors_for_file(file, errors_for_file)
puts "Errors in `#{file}`:"