Skip to content

Add error catching to locale.getlocale(locale.LC_ALL, "") #747

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

Merged
merged 6 commits into from
Apr 5, 2025
Merged

Add error catching to locale.getlocale(locale.LC_ALL, "") #747

merged 6 commits into from
Apr 5, 2025

Conversation

N-Hertstein
Copy link
Contributor

Add error handling and fallbacks to en_US or C as language locale in case of misconfigured or minimal system.
Fixes issue #740

N-Hertstein and others added 4 commits March 29, 2025 07:54
Add error handling and fallbacks to en_US or C as language locale in case of misconfigured or minimal system.
@mizaki
Copy link
Contributor

mizaki commented Mar 29, 2025

I don't know how possible it is but what if C.UTF8 or en_US.UTF-8 isn't available (C or en_US instead for example) etc.?

Modify fallback languages from en_US.UTF-8 & C.UTF-8 to en_US & C to avoid errors when UTF-8 is not available.
@N-Hertstein
Copy link
Contributor Author

I don't know how possible it is but what if C.UTF8 or en_US.UTF-8 isn't available (C or en_US instead for example) etc.?

That would be better, fixed it.

@mizaki
Copy link
Contributor

mizaki commented Apr 3, 2025

What I mean is it's not known what will be on the system. So either the locales need to be interrogated and one picked or the best option might be to pass and log an exception.

Copy link
Member

@lordwelch lordwelch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only use C as a fallback it will always exist and log that it's falling back to C logger.error("Couldn't set the locale: unsupported locale setting; falling back to 'C' locale")

Skip falling back to en_US and go straight to C as it is always available.
Add error logging.
@N-Hertstein
Copy link
Contributor Author

N-Hertstein commented Apr 4, 2025

Only use C as a fallback it will always exist and log that it's falling back to C logger.error("Couldn't set the locale: unsupported locale setting; falling back to 'C' locale")

Added as requested

@lordwelch lordwelch merged commit 1641182 into comictagger:develop Apr 5, 2025
1 check passed
@lordwelch lordwelch mentioned this pull request Apr 5, 2025
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

Successfully merging this pull request may close these issues.

3 participants