0

I am having issues with Flask-babel. I cant create a translation for Japanese.

pybabel: error: unknown locale 'jp'

Is this a Flask-Babel issue?

That is the same error when a language does not exists. But, german works. So.....babel does nit support Japanese?

Is there an alternative to Babel that support a major language like Japanese?

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Tampa
  • 75,446
  • 119
  • 278
  • 425

2 Answers2

5

Babel does support Japanese and indeed, the error comes because 'jp' is not a valid locale.

Babel uses language codes from CLDR (which I believe are the standardized language codes from ISO et al). In your case the confusion comes from the language/territory split ('de' for German language, 'AT' for Austrian territory, 'DE' for Germany, ...).

The language code for Japanese is 'ja', territory is 'JP'. So you should use just 'ja' or 'ja_JP'.

Felix Schwarz
  • 2,938
  • 4
  • 28
  • 41
0

flask-babel is the integration of flask and babel so you can refer to the list of babel

check here https://babel.pocoo.org/en/latest/api/core.html?highlight=japan#babel.core.Locale.default

mike
  • 71
  • 3