Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add --keep-translation flag to merge command #132

Closed
mrtryhard opened this issue Jul 30, 2024 · 1 comment
Closed

Feature request: Add --keep-translation flag to merge command #132

mrtryhard opened this issue Jul 30, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers p:n Priority: normal question Further information is requested

Comments

@mrtryhard
Copy link
Owner

mrtryhard commented Jul 30, 2024

Enhancement's description:
Merge currently has this issue where you cannot just receive additional strings upon an existing translation.

It would be much better to add a flag that allows taking in only new messages and contexts without overriding the existing base messages / contexts.

Use case

  • Translatable strings are extracted from software, producing base-new.ts
  • An already, previous translation version exists japanese-old.ts
  • You want to keep the already translated strings, but you might want to update the location, line number, comments, etc.

Expected behavior / output:

./qt-ts-tools merge japanese-old.ts base-new.ts --keep-translation -o japanese-to-translate.ts

The file japanese-to-translate.ts contains the new locations, messages, and context from the base-new.ts file, and keeps the already translated strings.

Sample translation file

To be refined

Sample expected / correct output file

To be refined

Question

  • Should it be the default behaviour ? Should it be a flag to override existing translation ?
@mrtryhard mrtryhard added enhancement New feature or request good first issue Good for newcomers p:n Priority: normal question Further information is requested labels Jul 30, 2024
@mrtryhard mrtryhard self-assigned this Aug 3, 2024
@mrtryhard mrtryhard changed the title Feature request: Add --new-only flag to merge command Feature request: Add --keep-translation flag to merge command Aug 3, 2024
mrtryhard added a commit that referenced this issue Aug 4, 2024
This covers a specific use case where you want to add new strings on your translation file, but don't want to lose translations. This helps also updating locations.
mrtryhard added a commit that referenced this issue Aug 4, 2024
…tion

fixes #132: Add `keep-translation` to merge command.
@mrtryhard
Copy link
Owner Author

Note
This ticket changes the merge behavior a little bit, notably:

  • Order of merged messages and contexts (although it was not and is never promised to be sorted, you need to use sort for that)
  • location nodes are now updated with the right file information.
  • translator_comment is now updated

Feel free to report a bug if some behavior is questionable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers p:n Priority: normal question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant