Fix issue #26274 (PR #26354)

23 views
Skip to first unread message

Ulrich Telle

unread,
Apr 5, 2026, 5:09:11 PM (4 days ago) Apr 5
to wx-...@googlegroups.com, Subscribed

On Windows the default locale instantiated by wxUILocale::UseDefault() referenced the locale configured for regional formatting in the Windows settings. This could lead to unintended behaviour (like using the wrong layout direction), if the locale for the Windows display language differs from the locale for regional formatting.

This has been fixed by referencing the locale corresponding to the display language resp the regional formatting depending on the locale property in question.

Additionally, the German translation of the internat sample was updated.


You can view, comment on, or merge this pull request online at:

  https://github.com/wxWidgets/wxWidgets/pull/26354

Commit Summary

  • 2e0a9b6 Fix issue #26274
  • 5d619ce Update German translation of the internat sample

File Changes

(6 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26354@github.com>

Ulrich Telle

unread,
Apr 5, 2026, 5:12:21 PM (4 days ago) Apr 5
to wx-...@googlegroups.com, Push

@utelle pushed 1 commit.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26354/before/5d619cea827cf60c7d9c09eb1f360aab07464188/after/dfdb14fd2033aebe6c3efa37dc72c5ece8414415@github.com>

Ulrich Telle

unread,
Apr 5, 2026, 6:39:52 PM (4 days ago) Apr 5
to wx-...@googlegroups.com, Subscribed
utelle left a comment (wxWidgets/wxWidgets#26354)

AFAICT the failing checks have nothing to do with my changes.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26354/c4189649039@github.com>

VZ

unread,
Apr 5, 2026, 7:40:20 PM (4 days ago) Apr 5
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26354)

Yes, we really need to stop using Ubuntu 18.04 for the CI jobs, its repositories are unusably flaky... I've restarted the failed CI jobs, let's hope they fare better this time.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26354/c4189731804@github.com>

VZ

unread,
Apr 5, 2026, 7:52:01 PM (4 days ago) Apr 5
to wx-...@googlegroups.com, Subscribed

@vadz approved this pull request.

Thanks! I didn't test this yet but it looks like it should work fine, let's merge it (maybe after minor tweaks if you'd like to address the comments below) to see what we're missing...


In include/wx/uilocale.h:

>  
     static wxUILocale ms_current;
 
     wxUILocaleImpl* m_impl;
+    bool m_isDefault;

Minor, but I'd prefer to do it like this:

⬇️ Suggested change
-    bool m_isDefault;
+    bool m_isDefault = false;

and remove the initialization above.


In src/common/uilocale.cpp:

> @@ -854,6 +855,7 @@ bool wxUILocale::UseLocaleName(const wxString& localeName)
 
     impl->Use();
     ms_current = wxUILocale(impl);
+    ms_current.m_isDefault = false;

This is unnecessary?


In src/msw/uilocale.cpp:

> @@ -173,14 +171,23 @@ WXDLLIMPEXP_BASE wxString wxGetMSWDateTimeFormat(wxLocaleInfo index)
         return wxString{};
     }
 
+    // Determine the name of the locale to be used for querying the date/time format
+    // Use a nullptr in case of the system default locale

OK, this works because LOCALE_NAME_USER_DEFAULT is defined as NULL, but it would still be better/more clear to use LOCALE_NAME_USER_DEFAULT as name value.


In src/msw/uilocale.cpp:

> +    wxString DoGetInfoDisplay(LCTYPE lctype) const
+    {
+        wchar_t buf[256];
+        if ( !::GetLocaleInfoEx(m_nameDisplay, lctype, buf, WXSIZEOF(buf)) )
+        {
+            wxLogLastError(wxT("GetLocaleInfoEx"));
+            return wxString();
+        }
+
+        return buf;

I'm not sure if it's really better to duplicate DoGetInfo() (which is pretty short, of course, but still) than to add an extra parameter for it. I.e. maybe it would be better to use DoGetInfo(m_nameDisplay, lctype) instead of DoGetInfoDisplay(lctype) etc?


In src/msw/uilocale.cpp:

> @@ -820,7 +853,8 @@ class wxUILocaleImplName : public wxUILocaleImpl
         return wxLocaleNumberFormatting(groupSeparator, grouping, decimalSeparator, fractionalDigits);
     }
 
-    const wchar_t* const m_name;
+    const wchar_t* const m_nameRegion;  // Name of locale for regional formatting
+    const wchar_t*       m_nameDisplay; // Name of locale for display language

I think we need to explain in the comment here that it is usually equal to m_nameRegion and only different from it when using default locale.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26354/review/4059951116@github.com>

Ulrich Telle

unread,
Apr 6, 2026, 2:20:40 AM (4 days ago) Apr 6
to wx-...@googlegroups.com, Push

@utelle pushed 1 commit.

  • ab34290 Apply changes requested in review


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26354/before/dfdb14fd2033aebe6c3efa37dc72c5ece8414415/after/ab3429078cec5c8725b015c83a5ecc3b041cdb91@github.com>

Ulrich Telle

unread,
Apr 6, 2026, 2:21:07 AM (4 days ago) Apr 6
to wx-...@googlegroups.com, Subscribed

@utelle commented on this pull request.


In include/wx/uilocale.h:

>  
     static wxUILocale ms_current;
 
     wxUILocaleImpl* m_impl;
+    bool m_isDefault;

Done.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26354/review/4060591034@github.com>

Ulrich Telle

unread,
Apr 6, 2026, 2:28:15 AM (4 days ago) Apr 6
to wx-...@googlegroups.com, Subscribed

@utelle commented on this pull request.


In src/common/uilocale.cpp:

> @@ -854,6 +855,7 @@ bool wxUILocale::UseLocaleName(const wxString& localeName)
 
     impl->Use();
     ms_current = wxUILocale(impl);
+    ms_current.m_isDefault = false;

Although wxUILocale::UseDefault() and wxUILocale:UseLocaleName() are meant to be called only once, it is not forbidden or prevented. And one older application of mine - still using wxLocale - allows to change the UI language (resp locale) on the fly. In such a case it is necessary to reset m_isDefault. So, yes, I think it is necessary.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26354/review/4060609405@github.com>

Ulrich Telle

unread,
Apr 6, 2026, 2:28:25 AM (4 days ago) Apr 6
to wx-...@googlegroups.com, Subscribed

@utelle commented on this pull request.


In src/msw/uilocale.cpp:

> @@ -173,14 +171,23 @@ WXDLLIMPEXP_BASE wxString wxGetMSWDateTimeFormat(wxLocaleInfo index)
         return wxString{};
     }
 
+    // Determine the name of the locale to be used for querying the date/time format
+    // Use a nullptr in case of the system default locale

Done.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26354/review/4060609865@github.com>

Ulrich Telle

unread,
Apr 6, 2026, 2:29:02 AM (4 days ago) Apr 6
to wx-...@googlegroups.com, Subscribed

@utelle commented on this pull request.


In src/msw/uilocale.cpp:

> +    wxString DoGetInfoDisplay(LCTYPE lctype) const
+    {
+        wchar_t buf[256];
+        if ( !::GetLocaleInfoEx(m_nameDisplay, lctype, buf, WXSIZEOF(buf)) )
+        {
+            wxLogLastError(wxT("GetLocaleInfoEx"));
+            return wxString();
+        }
+
+        return buf;

I applied the proposed change.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26354/review/4060611404@github.com>

Ulrich Telle

unread,
Apr 6, 2026, 2:36:49 AM (4 days ago) Apr 6
to wx-...@googlegroups.com, Push

@utelle pushed 1 commit.

  • 9d7a9b8 Add comment for locale name member variables


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26354/before/ab3429078cec5c8725b015c83a5ecc3b041cdb91/after/9d7a9b8e61687ab3854d01cc67e2a25bda7fd0ea@github.com>

Ulrich Telle

unread,
Apr 6, 2026, 2:37:03 AM (4 days ago) Apr 6
to wx-...@googlegroups.com, Subscribed

@utelle commented on this pull request.


In src/msw/uilocale.cpp:

> @@ -820,7 +853,8 @@ class wxUILocaleImplName : public wxUILocaleImpl
         return wxLocaleNumberFormatting(groupSeparator, grouping, decimalSeparator, fractionalDigits);
     }
 
-    const wchar_t* const m_name;
+    const wchar_t* const m_nameRegion;  // Name of locale for regional formatting
+    const wchar_t*       m_nameDisplay; // Name of locale for display language

Done.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26354/review/4060635327@github.com>

Ulrich Telle

unread,
Apr 6, 2026, 2:38:56 AM (4 days ago) Apr 6
to wx-...@googlegroups.com, Push

@utelle pushed 1 commit.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26354/before/9d7a9b8e61687ab3854d01cc67e2a25bda7fd0ea/after/ce15b58cd8774ff84e439cd2854c8345e9c37945@github.com>

VZ

unread,
Apr 6, 2026, 12:10:08 PM (4 days ago) Apr 6
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26354)

Great, thanks, I'll merge and push this soon.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26354/c4193384706@github.com>

VZ

unread,
Apr 6, 2026, 6:06:11 PM (3 days ago) Apr 6
to wx-...@googlegroups.com, Subscribed

Closed #26354 via d3734f2.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26354/issue_event/24237923867@github.com>

Reply all
Reply to author
Forward
0 new messages