Skip to content

Reflang might not work with locales longer than 2 symbols. #182

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

Open
egor83 opened this issue Mar 10, 2017 · 4 comments
Open

Reflang might not work with locales longer than 2 symbols. #182

egor83 opened this issue Mar 10, 2017 · 4 comments

Comments

@egor83
Copy link

egor83 commented Mar 10, 2017

Reflang works with 2-letter locales ('en', 'de', ...), but fails with longer ('zh_Hans', for instance).
I'll test some more, but I'm quite sure the problem lies here, line 214:
https://github.com/mbi/django-rosetta/pull/60/files#diff-b1b9cc9184baf1c5f4af99b915eb35e3R214
If locale being handled has name longer than 2 letters, it fails and falls back on msgid.
In our experience, switching from 'zh_Hans' to 'zh' helped.


  • Which version of Django are you using?:
    1.8.13

  • Which version of django-rosetta are you using?:
    0.7.12

  • Have you looked trough recent issues and checked this isn't a duplicate?
    Yes - searching for "locale" brings up a few solved issues, but these are about Rosetta in general, and not reflang.

@egor83
Copy link
Author

egor83 commented Mar 10, 2017

Reference language - added for discoverability.

@sipa-echo-zaoa
Copy link

sipa-echo-zaoa commented Apr 15, 2025

@mbi Hi, this issue is still present in the latest version.
I solved it locally by replacing the regex as suggested in the comment above.
Should I open an pr?

@mbi
Copy link
Owner

mbi commented Apr 15, 2025

@sipa-echo-zaoa Yes please! 🙏

@sipa-echo-zaoa
Copy link

@mbi opened following pr #306

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

No branches or pull requests

3 participants