ralphje / django-internationalflavor

Complementing django-localflavor with fields that are applicable to multiple countries
Other
25 stars 19 forks source link

Translations of Form Fields and Error Messages Not Working #23

Open andre-fuchs opened 1 year ago

andre-fuchs commented 1 year ago

I use this package to implement an IBAN and a BIC field in a form. The multilingual site is based on the Wagtail CMS and the Django framework, of course. The two fields are working like a charm, only the translations are missing. I have seen the locale directory of this package and found all necessary translations in the .PO-files. How do I get them to work? Here are my language settings, to give a bit more context:

# settings.py
LANGUAGE_CODE = 'en'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True

WAGTAIL_CONTENT_LANGUAGES = LANGUAGES = [
    ('en', _('English')),
    ('de', _('German')),
]

LOCALE_PATHS = (
    os.path.join(BASE_DIR, 'locale'),
)
# forms.py
class SubscriptionForm(forms.Form):
    iban = IBANFormField(required=False, label=_('IBAN'))
    bic = BICFormField(required=False, label=_('BIC'))
ralphje commented 1 year ago

Could you elaborate which translations are missing exactly?

The translations for IBAN, BIC, English and German will be missing because you probably have a po file with these defined as well. The other translations should work from what I can see, though perhaps the locale path override provides issues.

toabi commented 11 months ago

I just integrated this to my project, which uses

LANGUAGE_CODE = 'de-de'
TIME_ZONE = 'Europe/Berlin'
USE_I18N = True
USE_TZ = True

on validation errors I still get an english error strings for the VATNumberField.