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

Can't set locale Macbook with macOS 12.6.3 #1321

Open
DivingDuck opened this issue Mar 7, 2023 · 2 comments · May be fixed by #1352
Open

Can't set locale Macbook with macOS 12.6.3 #1321

DivingDuck opened this issue Mar 7, 2023 · 2 comments · May be fixed by #1352

Comments

@DivingDuck
Copy link
Collaborator

Follow up for issue #1308 (comment),

This need some more investigation as
a) the language combination is wrong,
b) we use from the coding eg. de-AT only the first part for identifying the language, so it should find a fallback,
c) I'm not sure if the warning is from Pronterface, I can't even find any message string for this window. Strange.

Check if the implemented workaround issue #1154 is still needed for macOS builds

@neofelis2X,
can you please add the log file from Pronterface here? Maybe this will show us some more useful information.
For creating the logging file you need to set up a log path in: -->Settings -->Options -->User interface -->Log path
It must be an existing folder where you have full access to. The log file name will be set from Pronterface: Printrun.log

PronterfaceLogPath

@neofelis2X
Copy link
Contributor

There is nothing in the logfile, unfortunately.

2023-03-07 21:08:02,888 - Not connected to printer.
2023-03-07 21:08:02,889 - Disconnecting from printer...
2023-03-07 21:08:02,889 - Exiting program. Goodbye!

One comment on a): As far as my computer is concerned, the language combination is not wrong or incorrect. In fact, it's just how I set it up. System language in English and region is Austria. Gives 'en_AT'. I know that this is a highly unusual combination, but on the mac it is a perfectly good setting to have. The issue might be an edge-case tho. :)

I wrote a python script to test a few different methods. The result is that most likely locale.setlocale() (util.py line 34) cannot digest this unusual locale. When I set en_GB for example, it runs just fine.

wx.Locale.GetSystemLanguage: 180
wx.Locale.GetLanguageCanonicalName: en_AT
locale.getdefaultlocale: ('en_AT', 'UTF-8')
os.getenv: en_AT.UTF-8
locale.setlocale...
Traceback (most recent call last):
File "/.../Printrun/locale_test.py", line 22, in
locale.setlocale(locale.LC_ALL, '')
File "/.../python3.10/locale.py", line 620, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting

And on a side note, locale.getdefaultlocale() in utils.py will be deprecated in py3.11. But it's not the problem here. :)

@rockstorm101
Copy link
Collaborator

One comment on a): As far as my computer is concerned, the language combination is not wrong or incorrect. In fact, it's just how I set it up. System language in English and region is Austria. Gives 'en_AT'. I know that this is a highly unusual combination

I agree, it is unusual but not impossible. As @DivingDuck said on his point b), we should be able to fallback to a sensible default in these cases.

rockstorm101 added a commit that referenced this issue May 11, 2023
Make the gettext installation platform agnostic and leverage the fact
that gettext automatically:
 * Searches for translations on default system folders
 * Guesses system language from environment variables

Fixes #1321
@rockstorm101 rockstorm101 linked a pull request May 11, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants