Skip to content

script to rewrite yaml files using psych#22533

Open
toy wants to merge 2 commits intorelease/17.3from
rewrite_crowdin_yml_files-script
Open

script to rewrite yaml files using psych#22533
toy wants to merge 2 commits intorelease/17.3from
rewrite_crowdin_yml_files-script

Conversation

@toy
Copy link
Contributor

@toy toy commented Mar 26, 2026

Script to rewrite YAMLs downloaded using crowdin/github-action using ruby library, so that the auto merging script #22249 will not cause irrelevant style changes when auto resolving conflicts.

The script needs to first be present in dev and latest release branches to be able to use it from crowdin workflow changed in #22519.

@toy toy requested a review from Copilot March 26, 2026 17:41
@toy toy force-pushed the rewrite_crowdin_yml_files-script branch from b8dbdb6 to 2d72482 Compare March 26, 2026 17:42
@toy toy changed the base branch from dev to release/17.3 March 26, 2026 17:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Ruby script that rewrites Crowdin-downloaded locale YAML files using Psych so that subsequent auto-merges don’t introduce irrelevant YAML style diffs.

Changes:

  • Add script/i18n/rewrite_crowdin_yml_files to normalize YAML output via YAML.safe_load + YAML.dump
  • Preserve leading header comments from each YAML file before rewriting
  • Print a summary count of rewritten files

@toy toy requested a review from myabc March 26, 2026 17:44
@toy toy force-pushed the rewrite_crowdin_yml_files-script branch from 2d72482 to 4d4a71b Compare March 26, 2026 19:10
@toy toy mentioned this pull request Mar 26, 2026

rewritten_count = crowdin_yml_files.count do |path|
content = File.read(path)
comments = content.lines.take_while { it.start_with?("#") }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@toy stupid question perhaps, but do we actually need to preserve these comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preserving them was the simplest option, alternative is either to inject COPYRIGHT_short content or remove comments. Currently comments in files from crowdin are a squished version of whatever is in relevant en file, so empty, # English strings go here or similar, or the copyright

Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants