Commit graph

74150 commits

Author SHA1 Message Date
Vadim Zeitlin
c4b71b3694 Merge branch 'default-locale-improve'
Improvements for handling default locale under macOS and Unix.

See #23119, #23147, #23226.

Closes #23114.
2023-02-08 17:33:19 +01:00
Miguel Gimenez
64b604d672 Update Spanish translation 2023-02-08 17:27:02 +01:00
Vadim Zeitlin
db14662116 Don't use LC_MESSAGES for determining locale on non-glibc systems
LC_MESSAGES should only be used for getting the translations language,
so using GetLocaleFromEnvironment(), which uses its value if LC_ALL was
not set, in wxUILocaleImplUnix::InitLocaleNameAndCodeset() was wrong for
the cases when we did call it from there, i.e. when not using glibc and
so _NL_LOCALE_NAME is not defined.

Correct this by replacing GetLocaleFromEnvironment() querying all
environment variables at once with GetLocaleFromEnvVar() getting the
value from just the one environment variable specified by caller and
not calling it for LC_MESSAGES from InitLocaleNameAndCodeset().

See #23217.
2023-02-07 13:12:21 +01:00
Vadim Zeitlin
d8edc746e2 Don't make internal wxGenericTreeCtrl classes visible
Remove WXDLLEXPORT from the internal classes used only inside the
implementation.

Also remove forward declarations of classes not used in the header from
it.
2023-02-07 11:06:39 +01:00
Vadim Zeitlin
b6a42b4ef4 Remove Mac workaround from wxFont unit test not needed any more
After #23144 was fixed, calling DumpFont() doesn't modify the font under
Mac any longer, so we don't need to avoid calling it there.
2023-02-07 10:59:54 +01:00
Vadim Zeitlin
1cf59d345b Remove fallback on locale using different region under Unix
Historically, we used to fall back on any locale using the same
language, if the exactly requested locale was unavailable. This doesn't
seem such a great idea, and results in unexpected behaviour, such as
returning true from wxUILocale::IsSupported() for locales such as
"en-FR" that are not really supported at all.

Remove this fallback and just return false if the locale with the
specified region is not supported.

Still choose any supported region if the region is omitted entirely,
however.
2023-02-07 00:23:31 +01:00
Vadim Zeitlin
3dfe253d3c Fix GetSystemLocale() return value for "C" locale
This was broken by the recent changes, so fix it again: we do still want
to return wxLANGUAGE_ENGLISH_US for this particular locale.
2023-02-06 21:31:16 +01:00
Vadim Zeitlin
f1b38c2500 Merge branch 'mac-menu-i18n'
Fix "Window" menu item translation under macOS.

Closes #23204.
2023-02-06 21:04:14 +01:00
Vadim Zeitlin
8dd9cfdbd0 Merge branch 'update-message-catalogs' of https://github.com/utelle/wxWidgets
Update all message catalogs to use appropriate context for the existing
macOS menu labels translations.

See #23229.
2023-02-06 21:03:24 +01:00
Vadim Zeitlin
cb62721e24 Rename variables containing translations of menu item text
Use "Translated" prefix for them instead of much less clear "Alternate"
one.

No real changes.
2023-02-06 21:00:21 +01:00
Stefan Csomor
94f51a5c8a use properly translated string when creating default window menu 2023-02-06 20:59:44 +01:00
Vadim Zeitlin
3e571ef253 Merge branch 'gtk-treectrl-text-size'
Improve size and handling of in-place editor in wxGenericTreeCtrl.

See #23001.
2023-02-06 19:47:42 +01:00
Vadim Zeitlin
4f6ddcf511 Hard code text control margins for GTK 2
Using GTKGetPreferredSize() doesn't always seem to return the correct
values, resulting in making the control too big, so just hard code the
smaller margins there.
2023-02-06 19:47:09 +01:00
utelle
d89a03a6dc
Update German message catalog 2023-02-06 17:49:38 +01:00
utelle
f2bf82782e
Update message catalogs
At least commit [f7d0742](f7d0742715) added several message ids with context (Mac OS port). That requires an update of the message catalogs.
2023-02-06 17:22:28 +01:00
Tobias Taschner
b9e776ae43 Allow calling wxWebViewEdge::SetUserAgent() after Create()
Additionally implement wxWebViewEdge::GetUserAgent() via SDK.

This functionality is available with the slightly newer
WebView2 SDK required by previous changes.

See #23225.
2023-02-06 13:55:30 +01:00
Vadim Zeitlin
85f76a8b98 Merge branch 'str_test_fix' of https://github.com/pavel-t/wxWidgets
Improve wxString unit tests, check for self-move-assignment.

See #23223.
2023-02-06 13:48:33 +01:00
Ulrich Telle
e983bd1288 Return English names for wxLOCALE_FORM_ENGLISH under Mac
Fix wxUILocale::GetLocalizedName(wxLOCALE_FORM_ENGLISH) to actually
returns the names in English by using the en-US locale for obtaining
them.

Closes #23190.

Co-Authored-by: Lauri Nurmi <lanurmi@iki.fi>
2023-02-06 00:21:19 +01:00
Vadim Zeitlin
2ca76449bf Fail if environment variables define unknown locale under Unix
Don't always "succeed" in wxUILocale::UseDefault() and, consequently, in
wxLocale::Init(wxLANGUAGE_DEFAULT), under Unix systems, even if the
locale couldn't actually be set, as it can happen if the environment
variables contain a locale which is not supported on the current system,
e.g. a "mixed" locale such as "en_FR", or even a completely invalid
string such as "bloordyblop", which still used to succeed.

For now only fix it for reasonably modern systems with locale_t support,
it could be done even for the ancient ones without it later too if
anybody still cares about them.

Closes #23218.
2023-02-06 00:11:31 +01:00
Artur Wieczorek
dce28fe788 Mark deprecated variables as used internally
When v3.2 compatibility is enabled all deprecated variables are still
present and initialized.
2023-02-05 20:08:00 +01:00
Artur Wieczorek
3b9672ce19 Ignore commit regarding comments only 2023-02-05 19:14:32 +01:00
Artur Wieczorek
159c3b1c6d Don't cache strings and variant values in wxPGGlobalVarsClass
Optimization gain is doubtful but complexity is high.
2023-02-05 19:07:25 +01:00
Artur Wieczorek
2df05fb915 Get rid of obsoleted comments 2023-02-05 19:06:54 +01:00
Artur Wieczorek
ff7476fcd0 Pass size to wxToolbar::SetToolBitmapSize() given in logical pixels
Previously the size was given DIPs but now logical pixels are used.
2023-02-05 19:06:26 +01:00
Artur Wieczorek
ad6bb3a10a Adjust propgrid sample to look better on HiDPI display 2023-02-05 19:05:44 +01:00
Vadim Zeitlin
856c0371fa Remove outdated special case for Mac from wxSetlocale()
This function must be used for setting the default CRT locale only and
we can't request arbitrary locales support from it under Mac as it
doesn't support any kind of mixed locales, such as "en-FR".

We do support them in wxUILocale, and calling wxUILocale::UseDefault()
from wxLocale::Init(wxLANGUAGE_DEFAULT) actually worked, but then this
function failed because wxSetlocale(LC_ALL, "") did not work for such
locales.

Fix this simply by removing Mac-specific code from this function.

This makes wxLocale::Init(wxLANGUAGE_DEFAULT) work as well as it ever
can under Mac.
2023-02-05 17:15:01 +01:00
Vadim Zeitlin
e3146f9ac0 Create valid (if empty) "C" locale under macOS
Use [NSLocale systemLocale] instead of trying to create a locale with
the name "C" which just fails and doesn't create any NSLocale at all.

If nothing else, this makes the behaviour of wxUILocale::GetCurrent()
consistent on all platforms as its GetLocaleId() now returns "C"
everywhere.
2023-02-05 16:58:39 +01:00
Vadim Zeitlin
14714856b3 Add wxUILocale::GetSystemLocaleId()
This function replaces the existing GetSystemLocale() as it can
represent the locales that don't have any corresponding wxLanguage
values and for which GetSystemLocale() has no choice but to return
wxLANGUAGE_UNKNOWN.
2023-02-05 16:45:14 +01:00
Vadim Zeitlin
9f2a416f81 Return wxLANGUAGE_UNKNOWN from GetSystemLocale() in mixed locales
After the changes of the previous commit, GetSystemLocale() started
returning the language, found as due to the fallback logic implemented
in FindLanguageInfo(), for mixed locales, e.g. it would return English
for en_FR which is wrong as the actual locale is rather the French one,
using decimal comma and not period in this case.

Make it always return wxLANGUAGE_UNKNOWN for the mixed locales for now.
2023-02-05 15:51:33 +01:00
Vadim Zeitlin
c13b3645a8 Fix wxUILocale::FindLanguageInfo() to work for mixed locales
When looking for the language information, we must recognize the
language independently of the region it is followed by, so en_FR is
still English and fr_DE is still French, even if the full locale is
unknown, but this wasn't the case before.

Fix this by comparing the language part of wxLanguageInfo with just the
language of wxLocaleIdent we're trying to match, instead of comparing it
with its full BCP47 tag, which is never going to match.
2023-02-05 15:51:33 +01:00
Ulrich Telle
98a9cd0688 Don't ignore LC_XXX in wxUILocaleImpl::GetPreferredUILanguages()
Previously, if LANGUAGE was set, the other locale-related environment
variables (LC_ALL, LC_MESSAGES, LANG) were simply ignored, which seems
wrong as the user running the program after explicitly setting LC_ALL
expects it to use this locale and not en_US from the default value of
LANGUAGE on a typical Linux system using English.

So handle LANGUAGE as a source of supplementary information, but still
honour all the other environment variables. This goes against an
explicit GNU gettext manual recommendation, but this recommendation
seems to only make sense in the usual case, when the first element of
LANGUAGE is the same as LC_ALL/LANG value, but not when they differ.

See #23146.
2023-02-05 15:51:33 +01:00
Vadim Zeitlin
d6c041e69b Don't assume that wxLocale::Init(wxLANGUAGE_DEFAULT) succeeds
At least under macOS it fails when the system locale is something like
en_DE, for example, as setlocale() doesn't support such locales.

Use wxUILocale::GetSystemLanguage() instead of wxLANGUAGE_DEFAULT.
2023-02-05 15:51:33 +01:00
Vadim Zeitlin
f0b54bef2f Handle wxLANGUAGE_DEFAULT specially in wxLocale::IsAvailable()
Check if using Init(wxLANGUAGE_DEFAULT) is going to succeed by actually
calling wxSetLocale(LC_ALL, "") in this special case, as we can't if
it's going to work otherwise if we don't recognize the language.
2023-02-05 15:51:33 +01:00
Vadim Zeitlin
ce04dbc024 Recommend using wxUILocale::GetSystemLanguage() in wxLocale docs
The wxUILocale function really returns the default language unlike the
one in wxLocale which must kepe using the default locale for
compatibility, making its name confusing.
2023-02-05 15:51:33 +01:00
Vadim Zeitlin
4c23721743 Add a pseudo test to show system locale and language
This can be useful to compare the results of calling
wxUILocale::GetSystemLanguage() and the function with the same name in
wxLocale (which actually corresponds to wxUILocale::GetSystemLocale()).
2023-02-05 15:51:33 +01:00
Pavel Tyunin
de59024f53
Better move constructor test
Previous version didn't actually call the move constructor.
2023-02-05 13:09:08 +02:00
Pavel Tyunin
1a46836e88
Remove unused test variables 2023-02-05 13:09:07 +02:00
Pavel Tyunin
e04a8de87a
Remove duplicated assign() tests and move remaining ones from AssignOp 2023-02-05 13:09:06 +02:00
Vadim Zeitlin
8b696319e7 Make comment in wxLocale::GetLanguageInfo() even more detailed
Explain that we need to call our (i.e. wxLocale) GetSystemLanguage()
here instead of letting wxUILocale::GetLanguageInfo() call its own (i.e.
wxUILocale) GetSystemLanguage() which does _not_ do the same thing.

No real changes, just try to explain this confusing code better.
2023-02-04 13:36:53 +01:00
Vadim Zeitlin
109e8e0f83 Merge branch 'rvalue_string' of https://github.com/pavel-t/wxWidgets
Add move operations and rvalue support to wxString.

See #23215.
2023-02-04 13:19:35 +01:00
Pavel Tyunin
099c5f1cac
Quick fix to avoid regression in assign() with length 2023-02-03 22:09:52 +02:00
Pavel Tyunin
62f83858a0
Add tests for wxString assignment operator 2023-02-03 22:09:52 +02:00
Pavel Tyunin
974feb4c39
Add tests for wxString move constructors 2023-02-03 22:09:52 +02:00
Pavel Tyunin
31ca15fa47
Add noexcept to wxString::swap() 2023-02-03 22:09:52 +02:00
Pavel Tyunin
e438079485
Add non-member swap to wxString 2023-02-03 22:09:52 +02:00
Pavel Tyunin
bcda42a082
Add rvalue versions of wxString assignment and construction functions 2023-02-03 22:09:52 +02:00
Pavel Tyunin
d00a072dc5
Add move operations to wxString 2023-02-03 22:09:51 +02:00
Pavel Tyunin
5b951caa79
Add string arrays benchmarks 2023-02-03 22:09:51 +02:00
Vadim Zeitlin
489e4c869e Don't make in-place editor too large initially
As we don't call IncreaseSizeForText() in the ctor any longer, redo the
same check there too.

Also prefer using GetClientSize() to GetSize() for determining the
available size, the difference is not big, but the former is more
correct.
2023-02-03 18:18:22 +01:00
Vadim Zeitlin
9a3e732c51 Fix height returned from MSW DoGetSizeFromTextSize() too
This is identical to 44e9218e03 (Don't always increase height in
DoGetSizeFromTextSize(), 2023-02-02) for wxGTK and ensures that we don't
make the returned height too big when a valid height is specified on
input.
2023-02-03 16:26:30 +00:00