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

Support customization of text in connection forms from connectors or other packages #58

Open
altvod opened this issue Oct 31, 2023 · 1 comment

Comments

@altvod
Copy link
Contributor

altvod commented Oct 31, 2023

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

@altvod
Copy link
Contributor Author

altvod commented Oct 31, 2023

Exceptions also make use of the translatable texts, so it would be logical to also extend this interface to wherever the main exception-generating places are (e.g. USM, executors/adapters).

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

No branches or pull requests

1 participant