GNOME Bugzilla – Bug 770708
First language preference is ignored when multiple languages are set under Location and Region
Last modified: 2017-12-23 08:51:00 UTC
System Language (for me English (US)) is not used (I get the language of my locale which I never selected -- the drop down menu in preferences shows the default "System Language"). Choosing explicitly for EN-US works fine, though (after relaunch). MacOS 10.11.6 on a late 2012 iMac. Hint: my language of second choice in the system prefs is Dutch, and maybe the fetch of the "system language" id fails, so it reverts to Dutch.
Why do you have a locale different than your system language? I guess this is the question whose answer is needed. Normally Unix systems heavily rely on the locale mechanism, and setting a system language should be equivalent to set a new locale. Does OSX use a different localization mechanism?
There are many reasons in non-English speaking reasons to have an English UI rather than the local language: expats, international organisations in Europe with its small and multilingual regions; English is the Lingua Franca, and in technical settings, its wordings, documentation, menus and keywords are much more precise than often inaccurate translations in the local language; I have been teaching in English all my life and need(ed) to communicate with my students in the proper jargon; ... Another rationale for choosing a language different from the system language is that it may be necessary to use an app like GIMP to do demonstrations to a public different form the working environment (especially in this age of laptops and international travel). Moreover on the Mac, the preferences contain a priority list of languages to be used by each application. The application itself automatically picks from its resources the first language in that list for which it has a string dictionary for text items in that language. In other words, for the macOS platform specific expected behavior that the fo However, it is OK for individual apps to choose their own language prefs, which can override the system ones, so the GIMP approach is fine (with language names in their own language: Deutsch, Nederlands, Français,...), except that when it states "System language", it should use the above mentioned mechanism, provided by the system. It should be said that GIMP.app for macOS already has all these resources in the proper format and location (<app bundle="/Applications/GIMP.app">/Contents/Resources/<2LetterLanguageCode>.lproj/<someAppName="GtkOSXApplication">.string) for the system language selection to work. All that needs to be done for the default (menu item="System Language") is ask the system to provide the proper language code. My point is just that GIMP on macOS doesn't operate as advertised in the wording of its own language prefs menu for the default "System Language" case. Almost perfect, but not platform expected behavior for the default case.
There are many reasons in non-English speaking regions to have an English UI rather than the local language: expats, international organisations in Europe with its small and multilingual regions; English is the Lingua Franca, and in technical settings, its wordings, documentation, menus and keywords are much more precise than often inaccurate translations in the local language; I have been teaching in English all my life and need(ed) to communicate with my students in the proper jargon; ... Another rationale for choosing a language different from the system language is that it may be necessary to use an app like GIMP to do demonstrations to a public different form the working environment (especially in this age of laptops and international travel). Moreover on the Mac, the preferences contain a priority list of languages to be used by each application. The application itself automatically picks from its resources the first language in that list for which it has a string dictionary for text items in that language. In other words, for the macOS platform specific expected behavior that the fo However, it is OK for individual apps to choose their own language prefs, which can override the system ones, so the GIMP approach is fine (with language names in their own language: Deutsch, Nederlands, Français,...), except that when it states "System language", it should use the above mentioned mechanism, provided by the system. It should be said that GIMP.app for macOS already has all these resources in the proper format and location (<app bundle="/Applications/GIMP.app">/Contents/Resources/<2LetterLanguageCode>.lproj/<someAppName="GtkOSXApplication">.string) for the system language selection to work. All that needs to be done for the default (menu item="System Language") is ask the system to provide the proper language code. My point is just that GIMP on macOS doesn't operate as advertised in the wording of its own language prefs menu for the default "System Language" case. Almost perfect, but not platform expected behavior for the default case.
Sorry for the duplicate post just to edit one misspelled word. -- couldn't find how to delete the superfluous comment.
> There are many reasons in non-English speaking reasons to have an English UI rather than the local language <snip> Not sure if there is misunderstanding since there was no problem on this topic. Of course there are good reasons to have your UI in whatever language you want, which is why GIMP provides the possibility. I was noting though that you were saying that you had a system locale different from your system language, even though you said you did nothing to set a different locale. So I just wonder how this could happen. GIMP indeed uses the locale to find the default language. So just to make sure I understand: your OSX system preferences have US English as top language (and Dutch as second), all other applications in OSX are in English, but GIMP which shows up in Dutch by default (when set as "System Language" in GIMP preferences). And when you type the command `locale` in a terminal, it shows a list of "nl" locales (especially in LANG or LANGUAGE or LC_ALL). Is that a good summary?
Your 2.8.14 is outdated. Please try the latest 2.8.18 DMG and report back.
To be sure, I updated GIMP to 2.8.18 in which the UI pref still remembered forcing US English, then reset the language pref to 'System Language', restarted GIMP and got again menus, splash screen, etc., in Dutch. FYI, my System language preferences are US English (US), Nederlands, Español, Français, Deutsch, in that order. Terminal>locale yields 'LANG=0', 'LC_ALL='. Apart from that your last paragraph "So... correctly summarizes the situation. Please note that I was not aware of the Unix mechanisms behind this (and the 'locale' command, which appeared in Darwin 10.4), therefore I have been using the term 'locale' rather loosely, as the UI language preferred by the user.
Thanks for checking. Kris, could you have a look at this?
FYI: Terminal>locale yields: LANG=; LC_COLLATE="C"; LC_CTYPE="UTF-8"; LC_MESSAGES="C"; LC_MONETARY="C"; LC_NUMERIC="C"; LC_TIME="C"; LC_ALL= I read somewhere that only BSD style Unixen know about the string UTF-8. I also read that macOS has a richer, native API than getdefaultlocale, namely: (and its Cocoa equivalent, NSLocale; watch Swift API conventions for yet another name).
BTW, do we know why this seems to have worked for people in the past?
Bug 771196 has additional information - seems like we skip the first language in the list, specifically. Do we have an off-by-one error somewhere?
I guess we need to add some OS X specific code to app/language.c, we only special case windows there, and the UNIX-style default impl is obviously not good enough on OS X.
*** Bug 771196 has been marked as a duplicate of this bug. ***
Let's use the summary of the duplicate.
I have the same issue, running GIMP 2.8.18 under macOS 10.12 (16A323). I'm using GIMP since ages, but it was never a problem for me so far as I never had multiple languages set (I always set my OS language to EN-US). Now that there is Siri in macOS I wanted to play with it, so I added my native language "German." But it is NOT the primary language, and when I display my environment, I see the following related to locale: LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 Still GIMP suddenly came up in German. I was using a somewhat older version (2.8.8?), and after I upgraded to 2.8.18 I could finally force the language to English. Using "System setting" made GIMP come up in German.
I have the same problem, so my bug report https://bugzilla.gnome.org/show_bug.cgi?id=771807 should be marked as a duplicate of this. I see a language chooser on Gimp 2.8.18 running on OSX 10.11 but the language chooser is missing when running on macOS 10.12 with the same Gimp version. Is there a command line switch that can force the language? Or can I copy over a preference file from a machine running OSX 10.11 and Gimp 2.8.18 to my macOS 10.12 machine?
Actually that was Gimp 2.8.14 that didn't have a language chooser. It is there in Gimp 2.8.18 on macOS Sierra. Sorry for that.
*** Bug 771807 has been marked as a duplicate of this bug. ***
Setting the "newcomers" tag. That should not be too hard to debug and get a proper OSX implementation for a OSX dev.
BTW, we should check what gettext does - the command line utility, in this case: http://linuxcommand.org/man_pages/gettext1.html
Please allow me to summarize to determine whether I have understood the bug report correctly: - In OS X it is possible to give multiple language preferences, one language is selected as "primary". - In GIMP you can select a language preference. When set to a specific language, this works fine. - In GIMP you can select "System Language" as language preference. This should choose the language selected in OS X preferences as "Primary". But this is no longer happening. So the problem is that when "System Language" is chosen, not the OS X "Primary" language is selected but another. I cannot immediately reproduce this myself and unfortunately I cannot upgrade to Sierra at this moment. However, I have an idea what might be going wrong. When "System Language" is selected in GIMP, then setlocale() is initialized with the empty string. This would indicate to initialize using the native environment. For OS X, gettext appears to determine the default language using CFLocaleCopyCurrent(). However, the Apple documentation notes: "Note that locale settings are independent of the user’s language setting. The language of the current locale may not correspond to the language at the first index in the AppleLanguages array from user defaults. For more details, see Locale Concepts in Locales Programming Guide; see also CFLocaleCopyPreferredLanguages." So it could be well possible that CFLocaleCopyCurrent() gives a locale that is different from the primary language on Sierra. To test this hypothesis I have written a simple Python script (see attachment) that prints the result of both CFLocaleCopyCurrent() and CFLocaleCopyPreferredLanguages() to the terminal. Could some users that experience this problem on Mac OS Sierra please inspect the source code of the Python script and if confident run the script within the Terminal? And please post the output in this bug report. The script only performs two CoreFoundation calls. The output for my system (10.11.5) is as follows, the latter two languages were added for testing: " The default locale used by GIMP is: en_NL The preferred languages configured for this system are: en nl de es " So, we would be interested to know whether the default locale *differs* from the first preferred language.
Created attachment 338077 [details] Test script written in Python that prints OS X locale settings to the terminal
$ /usr/bin/python showlang.py The default locale used by GIMP is: en_US_POSIX@currency=EUR The preferred languages configured for this system are: en-US de-US This is on macOS 10.12.1 Beta (16B2548a).
The default locale used by GIMP is: en_US The preferred languages configured for this system are: en-US th-US my-US ksw-Mymr-US I had already set the language in GIMP to English earlier. The way GIMP was displaying before on Sierra was first showing the last language in the list (Sgaw-Karen/Myanmar) and then substituting the earlier languages where strings were missing.
The default locale used by GIMP is: en_CA The preferred languages configured for this system are: en-CA en-GB gd-CA hi-CA ja-CA ru-CA el-CA I had set the second language to English - Great Britain just so it would stop defaulting to any of the foreign languages within my list.
Thanks for the responses. Based on these we can say that "So it could be well possible that CFLocaleCopyCurrent() gives a locale that is different from the primary language on Sierra." does not hold, at least when run stand-alone. We do note that the preferred languages are now suffixed with the region, which was not the case before Sierra. This appears to be explained in: https://developer.apple.com/library/content/technotes/tn2418/_index.html GIMP configures gettext with the empty string for the system language, causing gettext to use the "default locale". The OS X menus for GIMP use the usual Cocoa translation system and therefore take another path. According to the text linked above, Sierra attempts to perform "smart language fallbacks" for missing translations. This may explain a difference between language selected for the menus and the other interface text. But this does not explain why the main interface text would use a locale different from the default locale. (Unless the default locale is changed somehow after the menus started displaying). So I will have to dig a bit deeper in how localizations are set ...
*** Bug 773559 has been marked as a duplicate of this bug. ***
*** Bug 773158 has been marked as a duplicate of this bug. ***
*** Bug 772393 has been marked as a duplicate of this bug. ***
*** Bug 772392 has been marked as a duplicate of this bug. ***
*** Bug 771951 has been marked as a duplicate of this bug. ***
I am happy to announce that I seem to have managed to reproduce the problem, by immediately inserting the preferred language output from Sierra into gettext. As already noted Sierra now includes region suffixes and I suspect this is causing the problem. And as noted by others, it indeed looks like the first language is ignored. My plan is to work out a fix and roll a DMG for you all to test (and then use if it fixes the problem ;).
Suspecting a gettext bug, I am moving this to the DMG package component.
The problem here is that the English language as fallback is handled in a special way by gettext. This is caused by the fact that English is the default language for many programs and a translation file does not exist for the default language. If you try a language setting such as: LANG="en_FR:de_CA:nl" then most of the interface will show in German, if en_FR does not exist. "en" is tried as fallback, but the translation file does not exist. Therefore, in the Mac OS X support for gettext, iteration of the preferred languages is stopped as soon as English is detected. This ensures English functions as primary fallback (if no translation is shown, the untranslated string (typically English) is show). The identification only checked for "en", but in Sierra the region is always suffixed, so English was left undetected. The attached patch fixes this. I will also submit the patch to the gettext developers. I hope to have an updated DMG image later today for testing.
Created attachment 339188 [details] [review] gettext: fix English fallback for macOS Sierra
Test building available here: https://download.gimp.org/pub/gimp/v2.8/osx/testing/gimp-2.8.18-x86_64.6nov2016.dmg SHA1 checksum: 99e80cecbdcd779ab3b586683856f9ee23e8e98c Please report back whether it works and fixes the problem; thanks!
... and for users of BitTorrent clients: https://download.gimp.org/pub/gimp/v2.8/osx/testing/gimp-2.8.18-x86_64.6nov2016.dmg.torrent
The Test building in Comment 37 solved this bug for me. Thank you Kristian Rietveld for your quick dispatch of this bug. Fwiw, I have: sh> /usr/bin/python ~/Downloads/showlang.py The default locale used by GIMP is: en_US The preferred languages configured for this system are: en-US hi-US sh> Sadly, I do not read Hindi, so the broken version of GIMP was very broken for me. But now all is peaceful in GIMP menu-land again.
Additional info: Bug appears in GIMP 2.8.16 and 2.8.18 on MacOS Sierra 10.12.1 Thanks again.
Now works for me as well. I'm on macOS Sierra 10.12.2 Beta (16C32f). For reference: $ /usr/bin/python showlang.py The default locale used by GIMP is: en_US_POSIX@currency=EUR The preferred languages configured for this system are: en-US de-US To test your fix I set GIMP back to use "System Settings", and GIMP's UI language is still English. Thank you!
Thanks for testing. We have submitted the patch to the gettext developers: https://savannah.gnu.org/bugs/index.php?49560 We'll patch gettext in our DMG image for the upcoming releases.
Can we just move this updated DMG out of the testing area, rename it and close this bug?
*** Bug 774559 has been marked as a duplicate of this bug. ***
(In reply to Michael Natterer from comment #43) > Can we just move this updated DMG out of the testing area, rename it > and close this bug? schumaml has just done so. I will commit the gettext patch & build file changes to GIMP git once I get around to it (probably this weekend) and then close this bug.
Fixed in gimp-2-8. commit f2e483df028ca05bcfbf3dcdd92e89ed1d67dd7a Author: Kristian Rietveld <kris@loopnest.org> Date: Sat Nov 19 21:25:54 2016 +0100 Bug 770708 - First language preference is ignored when multiple ... ... languages are set under Location and Region We tracked this down to be a gettext bug, so include the gettext patch into our DMG build. The gettext patch has also been submitted upstream.
*** Bug 775289 has been marked as a duplicate of this bug. ***
*** Bug 787967 has been marked as a duplicate of this bug. ***
*** Bug 791886 has been marked as a duplicate of this bug. ***