Skip to content

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

Merged
hugovk merged 1 commit intopython-humanize:mainfrom
hugovk:rename-ar_SA-to-ar
Jun 23, 2022
Merged

Rename Arabic locale from ar_SA to ar to enable fallbacks#27
hugovk merged 1 commit intopython-humanize:mainfrom
hugovk:rename-ar_SA-to-ar

Conversation

@hugovk
Copy link
Copy Markdown
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 force-pushed the rename-ar_SA-to-ar branch from 08c03f7 to f7d4130 Compare June 22, 2022 13:28
@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