Browse Source

Add missing locale file for ga and add rake task to check for it (#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
Eugen Rochko 2 months ago
parent
commit
9361981388
No account linked to committer's email address
3 changed files with 18 additions and 0 deletions
  1. 2
    0
      .circleci/config.yml
  2. 1
    0
      app/javascript/mastodon/locales/ga.json
  3. 15
    0
      lib/tasks/repo.rake

+ 2
- 0
.circleci/config.yml View File

@@ -173,9 +173,11 @@ jobs:
173 173
     <<: *defaults
174 174
     steps:
175 175
       - *attach_workspace
176
+      - *install_system_dependencies
176 177
       - run: bundle exec i18n-tasks check-normalized
177 178
       - run: bundle exec i18n-tasks unused -l en
178 179
       - run: bundle exec i18n-tasks check-consistent-interpolations
180
+      - run: bundle exec rake repo:check_locales_files
179 181
 
180 182
 workflows:
181 183
   version: 2

+ 1
- 0
app/javascript/mastodon/locales/ga.json View File

@@ -0,0 +1 @@
1
+{}

+ 15
- 0
lib/tasks/repo.rake View File

@@ -76,4 +76,19 @@ namespace :repo do
76 76
       tmp.unlink
77 77
     end
78 78
   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
79 94
 end

Loading…
Cancel
Save