Commit Graph

11 Commits

Author SHA1 Message Date
Jehan 5a78326589 app: allows for empty string as language.
Language detection was not working fine on Windows when the language was
an empty string rather than NULL.
2022-07-07 22:13:28 +02:00
Jehan 25e35e17fe app: detect system language with a more robust logic.
langinfo.h is not on all systems apparently and/or the locale item we
test for may not be available everywhere. Actually even on Linux, after
testing more deeply, I could create cases where nl_langinfo() would not
return a result (if the locale is broken through environment variable
for instance). setlocale() seems to always return usable value so far,
so I fallback on it. As a last resort, I look at environment variables
(even though these may contain invalid contents.

As for Windows and macOS, I try to use more platform-specific methods.
In macOS in particular, as I understood from reports, GIMP follows
correctly the language preference order, which means we should not look
at a single (top) lang, but at the whole list of prefered languages as a
single settings to determine whether the language was changed or not.

Should fix on Windows:

> fatal error: langinfo.h: No such file or directory

and on macOS:

> error: use of undeclared identifier '_NL_IDENTIFICATION_LANGUAGE'
2022-07-07 18:58:50 +02:00
Jehan a7a027706b app: reload plug-ins when language changes between runs.
Since localization is fully handled plug-in side now (see #8124), we
need to make sure the query functions are run again for all plug-ins
when the UI language changes (otherwise we might end up with
localizations from the previously used languages).

We were already reloading plug-ins when explicitly changing the lang in
the Preferences, but this new implementation is much better as it's
generic. In particular, it will also handle the case when the system
language changes (or when you play with locale environment variables).
2022-07-06 19:33:00 +02:00
Jehan 39890a49eb Issue #4871: Plug-ins not translated.
Revert "app: also localize LC_TIME to GUI language."
This reverts commit a4e65ac836.

LC_TIME format apparently does not accept the broader format with just
the lang part, for instance "fr". The region is necessary, like "fr_FR".
In our supported languages, we were mostly using lang only except for a
few langs where we support regional variants.
This makes sense as time format may be quite different depending on
regions (dates are quite different in GB vs US, though that was actually
one of the cases where we were using accurate locale format).

And the main issue is that it was not only breaking time localization.
Normal string localization (LANGUAGE) got somehow broken as well by
broken LC_TIME.

Anyway for now let's just stick to whatever OS-set time format (even
though it may differ from GIMP Preferences-set language defaults).
2020-04-01 18:02:42 +02:00
Jehan a4e65ac836 app: also localize LC_TIME to GUI language.
When we set the GUI language through Preferences, also set LC_TIME, so
that locale-aware date functions also produce the right formats.

For instance, I use this in the About dialog to format the release date
of the last version of GIMP.
2019-12-29 22:59:16 +01:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Michael Natterer ca2156ee35 app: language.c contains no translatable strings, remove "gimp-intl.h" 2016-10-21 18:44:39 +02:00
Jehan fe481275e2 Bug 675554 - fix overriden language environment variables on Windows.
If any of the locale environment variables used for UI language is set
(LANGUAGE, LC_ALL, LC_MESSAGES and LANG), do not let Windows' default UI
language override these.
Language set in GIMP preferences still have higher priority.
2013-10-16 00:33:17 +13:00
Michael Natterer 22a5c173ba app: don't map several windows language codes to one language string
So e.g. "english" is not always just "en", but "en_UK", "en_US" etc.
This should fix issues similar to bug #690535. Used
http://en.wikipedia.org/wiki/ISO_3166-1 as reference.
2013-01-07 01:32:58 +01:00
João S. O. Bueno 5b4f58b08a Addresses bug #690535 - fix brazilian portuguese on Windows 2012-12-21 18:12:39 -02:00
Mukund Sivaraman e4204e453a app: Move language specific code into language.[ch] 2011-09-06 23:12:36 +05:30