Skip to content

Cleanup editor translation related methods #107999

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

timothyqiu
Copy link
Member

@timothyqiu timothyqiu commented Jun 26, 2025

  • Unify logic for loading editor/property/doc/extractable translations.
  • Replace legacy TranslationServer methods with translation domains for internal translations.
    • Methods like doc_translate() and doc_translate_plural() predates translation domains. Nowadays, they are just proxy methods for calling translate() and transalte_plural() on the corresponding domain.
  • Only pre-create editor/property/doc translation domains in editor builds.
  • Prevent adding null translation.
    • We used to error & skip null translations when iterating.
  • Fixes potential loading of duplicated editor translations.
    • For example, duplicated translations can be added by switching editor's language back and forth.
  • Add internal has_translation_for_locale() instead of calling get_loaded_locales().has().

- Unify logic for loading editor/property/doc/extractable translations.
- Replace legacy `TranslationServer` methods with translation domains for internal translations.
- Only pre-create editor/property/doc translation domains in editor builds.
- Prevent adding `null` translation.
- Fixes potential loading of duplicated editor translations.
- Add internal `has_translation_for_locale()` instead of calling `get_loaded_translations().has()`.
@timothyqiu timothyqiu force-pushed the translation-cleanup branch from ce7c6e6 to be24c69 Compare June 26, 2025 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant