You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, thanks for the great job. I just started using flask-babel and it's been a blast!
I got an error, could you help me to solve it in a proper way?
My browser is set to Brazilian Portuguese and seems like it sends the info 'pt-BR'. But, sadly, the app crashes with the following error:
ValueError: expected only letters, got 'pt-br'
I read a little bit of the Babel's code and realised that get_locale calls Locale.parse. Locale.parse accepts a sep parameter, but seems it is not being used here (because get_locale itself does not pass it nor accepts a sep parameter).
I edited get_locale like the following and it worked:
Line 250 for me:
It is: def get_locale() -> Optional[Locale]: ...
I made: def get_locale(sep: str = None) -> Optional[Locale]: ...
Line 268 for me (still get_locale):
It is: locale = Locale.parse(rv)
I made: locale = Locale.parse(rv, sep=sep)
Is this a bug or is it me who can't use the code properly?
Thank you in advance!
The text was updated successfully, but these errors were encountered:
Hey, thanks for the great job. I just started using flask-babel and it's been a blast!
I got an error, could you help me to solve it in a proper way?
My browser is set to Brazilian Portuguese and seems like it sends the info 'pt-BR'. But, sadly, the app crashes with the following error:
ValueError: expected only letters, got 'pt-br'
I read a little bit of the Babel's code and realised that get_locale calls Locale.parse. Locale.parse accepts a sep parameter, but seems it is not being used here (because get_locale itself does not pass it nor accepts a sep parameter).
I edited get_locale like the following and it worked:
Line 250 for me:
It is:
def get_locale() -> Optional[Locale]: ...
I made:
def get_locale(sep: str = None) -> Optional[Locale]: ...
Line 268 for me (still get_locale):
It is:
locale = Locale.parse(rv)
I made:
locale = Locale.parse(rv, sep=sep)
Is this a bug or is it me who can't use the code properly?
Thank you in advance!
The text was updated successfully, but these errors were encountered: