Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Replace inconsistent i18n wit htask

Oliver Güntherf7616d4ffafc
diff --git a/.github/workflows/i18n-tasks.yml b/.github/workflows/i18n-tasks.yml
new file mode 100644
index 00000000000..fdc79ac2324
--- /dev/null
+++ b/.github/workflows/i18n-tasks.yml
@@ -0,0 +1,44 @@
+name: i18n-inconsistency-check
+
+on:
+ push:
+ branches:
+ - dev
+ - release/*
+ paths-ignore:
+ - 'docs/**'
+ - 'help/**'
+ pull_request:
+ types: [opened, reopened, synchronize]
+ paths-ignore:
+ - 'docs/**'
+ - 'help/**'
+ - 'packaging/**'
+ - '.pkgr.yml'
+
+permissions:
+ contents: read
+
+jobs:
+ i18n-tasks:
+ permissions:
+ contents: read
+ if: github.repository == 'opf/openproject'
+ name: I18n inconsistency check
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Setup Ruby
+ uses: ruby/setup-ruby@v1
+
+ - name: Setup i18n-tasks
+ run: |
+ gem install i18n-tasks
+
+ - name: Run inconsistent translations check
+ run: |
+ i18n-tasks \
+ check-consistent-interpolations \
+ --config config/i18n-tasks-all-files.yml
diff --git a/spec/i18n_spec.rb b/spec/i18n_spec.rb
index acb2500075e..193b3f66c49 100644
--- a/spec/i18n_spec.rb
+++ b/spec/i18n_spec.rb
@@ -9,7 +9,6 @@ RSpec.describe "I18n" do
let(:i18n) { I18n::Tasks::BaseTask.new }
let(:missing_keys) { i18n.missing_keys }
let(:unused_keys) { i18n.unused_keys }
- let(:inconsistent_interpolations) { i18n.inconsistent_interpolations }
it "does not have missing keys" do
pending "Enable when i18n-tasks is enabled across the project, otherwise this spec will report false positives"
@@ -30,17 +29,4 @@ RSpec.describe "I18n" do
"Please run `i18n-tasks normalize' to fix"
expect(non_normalized).to be_empty, error_message
end
-
- context "for all i18n files" do
- let(:root_dir) { Pathname.new(__FILE__).dirname.join("..") }
- let(:config_file) { root_dir.join("config/i18n-tasks-all-files.yml") }
- let(:i18n) { I18n::Tasks::BaseTask.new(config_file:) }
-
- it "does not have inconsistent interpolations" do
- config_file_relative_path = config_file.relative_path_from(Dir.pwd)
- error_message = "#{inconsistent_interpolations.leaves.count} i18n keys have inconsistent interpolations.\n" \
- "Run 'i18n-tasks check-consistent-interpolations --config #{config_file_relative_path}' to show them"
- expect(inconsistent_interpolations).to be_empty, error_message
- end
- end
end