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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[49795] Avoid zh-TW overwriting zh-CN translation file
Christophe Bliard8af4a60c8024
diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.ymlindex ea722ce1818..205c58e518d 100644--- a/.github/workflows/crowdin.yml+++ b/.github/workflows/crowdin.yml@@ -78,9 +78,6 @@ jobs:env:OPENPROJECT_CROWDIN_PROJECT: ${{ secrets.OPENPROJECT_CROWDINV2_PROJECT }}OPENPROJECT_CROWDIN_API_KEY: ${{ secrets.OPENPROJECT_CROWDINV2_API_KEY }}- - name: "Fixing translation names"- run: |- ruby script/i18n/fix_crowdin_translation_filenames.rb- name: "Commit translations"run: |git config user.name "OpenProject Actions CI"diff --git a/crowdin.yml b/crowdin.ymlindex 215fe218343..c8aca54fd7d 100644--- a/crowdin.yml+++ b/crowdin.yml@@ -10,25 +10,67 @@ files: [{"source": "/config/locales/en.yml","translation": "/config/locales/crowdin/%two_letters_code%.yml",+ "languages_mapping": {+ "two_letters_code": {+ "ckb": "ckb-IR",+ "zh-CN": "zh-CN",+ "zh-TW": "zh-TW",+ }+ }},{"source": "/config/locales/js-en.yml","translation": "/config/locales/crowdin/js-%two_letters_code%.yml",+ "languages_mapping": {+ "two_letters_code": {+ "ckb": "ckb-IR",+ "zh-CN": "zh-CN",+ "zh-TW": "zh-TW",+ }+ }},{"source": "/config/locales/en.seeders.yml","translation": "/config/locales/crowdin/%two_letters_code%.seeders.yml",+ "languages_mapping": {+ "two_letters_code": {+ "ckb": "ckb-IR",+ "zh-CN": "zh-CN",+ "zh-TW": "zh-TW",+ }+ }},{"source": "/modules/**/config/locales/en.yml","translation": "/modules/**/config/locales/crowdin/%two_letters_code%.yml",+ "languages_mapping": {+ "two_letters_code": {+ "ckb": "ckb-IR",+ "zh-CN": "zh-CN",+ "zh-TW": "zh-TW",+ }+ }},{"source": "/modules/**/config/locales/js-en.yml","translation": "/modules/**/config/locales/crowdin/js-%two_letters_code%.yml",+ "languages_mapping": {+ "two_letters_code": {+ "ckb": "ckb-IR",+ "zh-CN": "zh-CN",+ "zh-TW": "zh-TW",+ }+ }},{"source": "/modules/**/config/locales/en.seeders.yml","translation": "/modules/**/config/locales/crowdin/%two_letters_code%.seeders.yml",+ "languages_mapping": {+ "two_letters_code": {+ "ckb": "ckb-IR",+ "zh-CN": "zh-CN",+ "zh-TW": "zh-TW",+ }+ }},]diff --git a/script/i18n/fix_crowdin_translation_filenames.rb b/script/i18n/fix_crowdin_translation_filenames.rbdeleted file mode 100644index d2160c41a6f..00000000000--- a/script/i18n/fix_crowdin_translation_filenames.rb+++ /dev/null@@ -1,47 +0,0 @@-require 'fileutils'--Dir.glob('**/config/locales/crowdin/*.yml').each do |crowdin_file|- # Get the line that contains the first language key- language_key = nil- filename = File.basename(crowdin_file)-- # Skip the empty in-context translations- next if filename.include?('lol.')-- File.readlines(crowdin_file).each do |line|- if line.match(/^\s*(\S{2,}):\s*$/)- language_key = $1- break- end- end-- # Read the language code from the YML index- if language_key.nil?- raise "Failed to detect language from #{crowdin_file}"- end-- # Remove any escaped language names- language_key.delete!('"')-- # the files should be named like their translation-key- new_filename =- case filename- when /\Ajs-.+\z/- "js-#{language_key}.yml"- when /.+\.seeders\.yml\z/- "#{language_key}.seeders.yml"- else- "#{language_key}.yml"- end-- directory = File.dirname(crowdin_file)- new_filepath = File.join(directory, new_filename)-- next if crowdin_file == new_filepath-- puts "Renaming #{crowdin_file} to #{new_filepath}"- FileUtils.mv crowdin_file,- new_filepath,- force: true,- verbose: true-end