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

No translation when using shortened language code for Arabic #25

Closed
jensenbox opened this issue Jun 21, 2022 · 1 comment · Fixed by #27
Closed

No translation when using shortened language code for Arabic #25

jensenbox opened this issue Jun 21, 2022 · 1 comment · Fixed by #27

Comments

@jensenbox
Copy link

What did you do?

I am attempting to use Arabic with the activate function and passing in ar instead of the full ar_SA.

What did you expect to happen?

Fall back to a reasonable default.

What actually happened?

[Errno 2] No translation file found for domain: 'humanize'

What versions are you using?

  • OS: Linux
  • Python: 3.10
  • Humanize: 4.2

Code that causes the problem

humanize.activate('ar')

The root of the issue appears to be that the translation provided by Humanize is for SA (Saudi Arabia) and the default for Python is
https://github.com/python/cpython/blob/main/Lib/locale.py#L916

My recommendation is to reduce the name of the translation directory down from ar_SA to just ar to encompass a greater range of Arabic speakers. Like the Django project has: https://github.com/django/django/blob/main/django/conf/locale/ar/LC_MESSAGES/django.po

Alternatively, it could be renamed to ar_AA to work with the native (to Python) fallback.

@hugovk
Copy link
Member

hugovk commented Jun 22, 2022

Good idea, please see #27 to rename it to ar.

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

Successfully merging a pull request may close this issue.

2 participants