Skip to content

No translation when using shortened language code for Arabic #25

@jensenbox

Description

@jensenbox

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions