mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-05-16 10:06:24 +02:00
53 lines
1.5 KiB
Diff
53 lines
1.5 KiB
Diff
--- a/modules/juce_core/native/juce_SystemStats_linux.cpp
|
|
+++ b/modules/juce_core/native/juce_SystemStats_linux.cpp
|
|
@@ -100,20 +100,37 @@
|
|
String SystemStats::getUserLanguage()
|
|
{
|
|
- #if JUCE_BSD
|
|
- if (auto langEnv = getenv ("LANG"))
|
|
- return String::fromUTF8 (langEnv).upToLastOccurrenceOf (".UTF-8", false, true);
|
|
-
|
|
- return {};
|
|
- #else
|
|
- return getLocaleValue (_NL_ADDRESS_LANG_AB);
|
|
- #endif
|
|
+ #if JUCE_BSD || defined(__MUSL__)
|
|
+ if (auto* lang = ::getenv("LANG"))
|
|
+ {
|
|
+ String langStr(lang);
|
|
+ if (langStr.contains("_"))
|
|
+ return langStr.upToFirstOccurrenceOf("_", false, false);
|
|
+ if (langStr.contains("."))
|
|
+ return langStr.upToFirstOccurrenceOf(".", false, false);
|
|
+ return langStr;
|
|
+ }
|
|
+ return "en";
|
|
+ #else
|
|
+ return getLocaleValue (_NL_ADDRESS_LANG_AB);
|
|
+ #endif
|
|
}
|
|
|
|
String SystemStats::getUserRegion()
|
|
{
|
|
- #if JUCE_BSD
|
|
- return {};
|
|
- #else
|
|
- return getLocaleValue (_NL_ADDRESS_COUNTRY_AB2);
|
|
- #endif
|
|
+ #if JUCE_BSD || defined(__MUSL__)
|
|
+ if (auto* lang = ::getenv("LANG"))
|
|
+ {
|
|
+ String langStr(lang);
|
|
+ if (langStr.contains("_"))
|
|
+ {
|
|
+ auto region = langStr.fromFirstOccurrenceOf("_", false, false);
|
|
+ if (region.contains("."))
|
|
+ return region.upToFirstOccurrenceOf(".", false, false);
|
|
+ return region;
|
|
+ }
|
|
+ }
|
|
+ return "US";
|
|
+ #else
|
|
+ return getLocaleValue (_NL_ADDRESS_COUNTRY_AB2);
|
|
+ #endif
|
|
}
|