Skip to content

fix: normalize paths in extracted translation files#409

Open
mirekys wants to merge 1 commit intoinveniosoftware:masterfrom
oarepo:contribution-normalize-babel-paths
Open

fix: normalize paths in extracted translation files#409
mirekys wants to merge 1 commit intoinveniosoftware:masterfrom
oarepo:contribution-normalize-babel-paths

Conversation

@mirekys
Copy link

@mirekys mirekys commented Feb 12, 2026

Description

This PR adds a path normalization step to the translation extraction process. When pybabel extracts messages from source code, it includes absolute file paths in the .pot file. This is problematic for shared translation templates because:

  1. Absolute paths are machine-specific and break portability
  2. They cause unnecessary diffs when different developers run extraction
  3. They expose local filesystem structure

The fix adds a _normalize_paths() method that replaces absolute paths with relative paths by stripping the project path prefix from all file references in the .pot file. This ensures consistent, portable translation templates.

Checklist

Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:

Frontend

Reminder

By using GitHub, you have already agreed to the GitHub's Terms of Service including that:

  1. You license your contribution under the same terms as the current repository's license.
  2. You agree that you have the right to license your contribution under the current repository's license.

* Always normalize absolute paths to relative paths in extracted .pot files

* Fixes issue where translation extraction produced absolute paths
  instead of relative paths

* This makes the extracted files portable and consistent across
  different development environments

* Adds test for _normalize_paths() method
@mirekys mirekys changed the title cli: normalize paths in extracted translation files fix: normalize paths in extracted translation files Feb 12, 2026
@mirekys mirekys requested a review from utnapischtim February 25, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant