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

Replace Locale object with just strings #764

Open
rogthefrog opened this issue Dec 18, 2024 · 2 comments
Open

Replace Locale object with just strings #764

rogthefrog opened this issue Dec 18, 2024 · 2 comments
Assignees

Comments

@rogthefrog
Copy link
Contributor

The code is playing fast and loose with types for locales, and sometimes it's sending Locale objects and sometimes just strings, even when the type hint requests one type.

The Locale enum doesn't add much functionality, and it causes issues when the wrong type is passed (e.g. if the code expects a Locale but receives a string, or vice versa, an exception is thrown unless you handle it).

A string + maybe one validation function like is_locale(locale): return locale.lower() in ("en_us", "fr_fr") would simplify things.

@bkorycki @rogthefrog discussed this in Discord.

@rogthefrog rogthefrog self-assigned this Dec 19, 2024
@rogthefrog
Copy link
Contributor Author

Try again with named constants like EN_US and FR_FR

@rogthefrog
Copy link
Contributor Author

#768

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

1 participant