Instead of creating Translatable instances with a fixed i18n domain from within the form, we need to implement some kind of factory that would be accessible via SR and would create translatables with a custom domain given a translation key.
Let's call it TextProvider. It would look something like this:
from dl_i18n.localizer_base import Translatable
class TextProvider:
def get_translatable(self, text_key: str, default_i18n_domain: str) -> Translatable:
...
This TextProvider instance can be supplied to form factory instances so that they can implement a method like this:
SomeFormFactory:
text_provider: TextProvider
default_i18n_domain: str
def get_translatable(self, text_key: str) -> Translatable:
return self.text_provider.get_translatable(text_key, default_i18n_domain=self.default_i18n_domain)
Packages provide custom texts in their own i18n domains, and a list of these custom domains should be provided via settings to the TextProvider instance.
Internal issue: BI-4909
Instead of creating
Translatableinstances with a fixed i18n domain from within the form, we need to implement some kind of factory that would be accessible via SR and would create translatables with a custom domain given a translation key.Let's call it
TextProvider. It would look something like this:This
TextProviderinstance can be supplied to form factory instances so that they can implement a method like this:Packages provide custom texts in their own i18n domains, and a list of these custom domains should be provided via settings to the
TextProviderinstance.Internal issue: BI-4909