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

Rename Arabic locale from ar_SA to ar to enable fallbacks #27

Merged
merged 1 commit into from Jun 23, 2022

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Jun 22, 2022

Fixes #25.

Changes proposed in this pull request:

  • Rename ar_SA to ar so it can be activated with both humanize.i18n.activate("ar_SA") and humanize.i18n.activate("ar_SA")
  • Some other files don't need this, they already have fallbacks
  • For example, this didn't work before, and does afterwards:
import humanize

print(humanize.ordinal(5))

for code in (
    "pt_BR",
    "pt_PT",
    "pt",
    "zh_CN",
    "zh_HK",
    "zh",
    "ar_SA",
    "ar",  # FileNotFoundError: [Errno 2] No translation file found for domain: 'humanize'
):
    print(code)
    x = humanize.i18n.activate(code)
    print(x.info())
    print(humanize.ordinal(5))
    humanize.i18n.deactivate()
    print()

@hugovk hugovk merged commit 3ddae94 into python-humanize:main Jun 23, 2022
@hugovk hugovk deleted the rename-ar_SA-to-ar branch June 23, 2022 15:06
@hugovk hugovk changed the title Rename Arabic locale from ar_SA to ar to enable fallbacks Rename Arabic locale from ar_SA to ar to enable fallbacks Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: Fixed For any bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No translation when using shortened language code for Arabic
1 participant