boardpack / pydantic-i18n

pydantic-i18n is an extension to support an i18n for the pydantic error messages.
https://pydantic-i18n.boardpack.org
MIT License
83 stars 11 forks source link

Add "domain" parameter to BabelLoader #289

Closed mozgsml closed 1 month ago

mozgsml commented 2 months ago

Should we add "domain" parameter to BabelLoader init function?

It helps to use third party translates, for example django.

def __init__(self, translations_directory: str, domain: str='messages') :
    ...
    for dir_name in os.listdir(translations_directory):
        locale = Locale.parse(dir_name)
        self.translations[str(locale)] = Translations.load(
            translations_directory, [locale], domain=domain
        )    
dukkee commented 2 months ago

Hello @mozgsml Yes, good point, I will add it to the next release, thank you 👍

dukkee commented 2 months ago

@mozgsml If you have any other additions, please let me know