Skip to content

Commit 9aaede6

Browse files
Gargronhiyuki2578
authored andcommitted
Add missing locale file for ga and add rake task to check for it (mastodon#11813)
* Add missing locale file for ga and add rake task to check for it * Update lib/tasks/repo.rake Co-Authored-By: Yamagishi Kazutoshi <ykzts@desire.sh> * Fix check-i18n build
1 parent 7a387aa commit 9aaede6

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,11 @@ jobs:
189189
<<: *defaults
190190
steps:
191191
- *attach_workspace
192+
- *install_system_dependencies
192193
- run: bundle exec i18n-tasks check-normalized
193194
- run: bundle exec i18n-tasks unused -l en
194195
- run: bundle exec i18n-tasks check-consistent-interpolations
196+
- run: bundle exec rake repo:check_locales_files
195197

196198
workflows:
197199
version: 2
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

lib/tasks/repo.rake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,19 @@ namespace :repo do
7676
tmp.unlink
7777
end
7878
end
79+
80+
task check_locales_files: :environment do
81+
pastel = Pastel.new
82+
83+
missing_yaml_files = I18n.available_locales.reject { |locale| File.exist?(Rails.root.join('config', 'locales', "#{locale}.yml")) }
84+
missing_json_files = I18n.available_locales.reject { |locale| File.exist?(Rails.root.join('app', 'javascript', 'mastodon', 'locales', "#{locale}.json")) }
85+
86+
if missing_json_files.empty? && missing_yaml_files.empty?
87+
puts pastel.green('OK')
88+
else
89+
puts pastel.red("Missing YAML files: #{pastel.bold(missing_yaml_files.join(', '))}") unless missing_yaml_files.empty?
90+
puts pastel.red("Missing JSON files: #{pastel.bold(missing_json_files.join(', '))}") unless missing_json_files.empty?
91+
exit(1)
92+
end
93+
end
7994
end

0 commit comments

Comments
 (0)