weblate icon indicating copy to clipboard operation
weblate copied to clipboard

Custom source language for translations

Open michael-smt opened this issue 5 months ago • 3 comments

Describe the problem

It is cumbersome to maintain similar languages without causing duplicated efforts and diverging translations. Changes in one related language are not reflected in the other, even when both were previously translated to the same string.

Related problem descriptions:

  • https://github.com/WeblateOrg/weblate/issues/2320
  • https://github.com/WeblateOrg/weblate/issues/3412

Solution brainstorm

Additional option in the project language workflow customization settings to configure a different source language.

With such a "tree" of languages, a "child" translation can have a different source language ("parent") instead of the base language file.

Changes in the parent language create a "source string changed" invalidation in the child language.

With reviews active, a child unit can only be translated when the parent unit is in state "Approved" or "Waiting for review".

Describe alternatives you have considered

No response

Screenshots

No response

Additional context

Constraints:

  • Inheritance loops should not be possible.
  • State invalidation should behave the same as between intermediate, source and translation

Useful in combination with:

  • https://github.com/WeblateOrg/weblate/issues/19625 to not have duplicate translations and rely on the translation framework's fallback
  • https://github.com/WeblateOrg/weblate/issues/20043 to still keep the other custom translation workflow settings to default

This could potentially be a more flexible replacement for the intermediate language feature.

michael-smt avatar Jun 15 '26 12:06 michael-smt

Implementation should reuse the existing Unit.source_unit relation instead of adding a parallel source graph.

Proposed approach:

  1. Add nullable source_language to WorkflowSetting. Empty means component source language.
  2. Expose it in WorkflowSettingForm, likely only for project-language settings.
  3. Validate same-language parents, missing project languages, and inheritance loops.
  4. Add Translation.effective_source_language / effective_source_translation near existing workflow properties in Translation.
  5. Change source linking so Unit.update_source_unit() and Translation.add_unit() link to the effective parent unit, not always component.get_source().
  6. Reuse Unit.update_source_units(), but trigger it for custom parent translations too, not only template translations at unit.py#L1720-L1722.
  7. Generalize intermediate-only read-only gating in get_unit_state() and update_state().
  8. Update source labels in templates, for example translate.html and translate.html#L787.

nijel avatar Jul 01 '26 11:07 nijel

Some additional aspects that might be relevant:

  • Deleting a language that is configured as source of another language
  • Moving a component to another project with different source language workflow settings
  • Visibility of this feature in the language listing (source.svg icon, ordering, indent?)

michael-smt avatar Jul 02 '26 07:07 michael-smt

Thank you for your report — the issue has now been resolved.

The fix has been merged into the repository and will be included in the upcoming Weblate 2026.10 release.

  • If you encounter any issues with the fix, please comment in this thread.
  • If you experience a similar but separate issue, open a new report so we can track it properly.
  • If you find Weblate helpful, consider supporting its development.

github-actions[bot] avatar Oct 01 '26 11:10 github-actions[bot]