-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add wxUILocale class usable under macOS #2464
Commits on Aug 7, 2021
-
Extract wxLocaleSetter from the tests into a private header
This will allow using this class in the library code too. No real changes yet, this is a pure refactoring. This commit is best viewed using git --color-moved option.
Configuration menu - View commit details
-
Copy full SHA for a4940bf - Browse repository at this point
Copy the full SHA a4940bfView commit details -
Allow using wxLOCALE_CAT_DEFAULT for numeric or money locale info
Make GetInfo() return information for numbers by default in the Unix version too instead of asserting, as this is more consistent with the MSW and Mac versions and also seems more useful.
Configuration menu - View commit details
-
Copy full SHA for 33ae58e - Browse repository at this point
Copy the full SHA 33ae58eView commit details -
Interpret empty language as "default" in the internat sample
This provides a more convenient way of testing wxLANGUAGE_DEFAULT than selecting it from the dialog shown on startup. This commit is best viewed ignoring whitespace-only changes.
Configuration menu - View commit details
-
Copy full SHA for 93190d6 - Browse repository at this point
Copy the full SHA 93190d6View commit details -
Show more locale-dependent controls in the internat sample
Show that file dialogs, spin and calendar controls also respect the selected locale conventions.
Configuration menu - View commit details
-
Copy full SHA for 1f74e7c - Browse repository at this point
Copy the full SHA 1f74e7cView commit details
Commits on Aug 14, 2021
-
Show using wxNumberFormatter in the internat sample too
This shows that C and UI (or OS) locales can be different.
Configuration menu - View commit details
-
Copy full SHA for 7dc6462 - Browse repository at this point
Copy the full SHA 7dc6462View commit details -
Use wxTranslations directly instead of passing by wxLocale
This is slightly more verbose, but more clear and allows to separate the translations-related part from locale-changing one.
Configuration menu - View commit details
-
Copy full SHA for 4db5de9 - Browse repository at this point
Copy the full SHA 4db5de9View commit details -
Use a panel in internat sample to make it look better under MSW
Creating the controls directly on wxFrame is not recommended and looks ugly under MSW due to the wrong background being used, so add an intermediate panel.
Configuration menu - View commit details
-
Copy full SHA for e0cd2c6 - Browse repository at this point
Copy the full SHA e0cd2c6View commit details -
Add an option to skip changing locale in the internat sample
Show that we can use the translations to the user language even without changing the locale.
Configuration menu - View commit details
-
Copy full SHA for 4adb58b - Browse repository at this point
Copy the full SHA 4adb58bView commit details -
Stop allowing to select the language in the internat sample
Restrict the choice to using the current system locale or not using it, as setting any other language doesn't, and can't, work under macOS.
Configuration menu - View commit details
-
Copy full SHA for eb5bffd - Browse repository at this point
Copy the full SHA eb5bffdView commit details -
Don't load translations when setting the locale is disabled too
It makes more sense to skip loading the translations too, if the user decided not to use the current locale. This commit is best viewed ignoring whitespace-only changes.
Configuration menu - View commit details
-
Copy full SHA for 31677e5 - Browse repository at this point
Copy the full SHA 31677e5View commit details -
Add internat sample command line option to skip the locale dialog
Getting this dialog all the time is annoying when testing, so add another command line option to set the locale unconditionally. This commit is best viewed ignoring whitespace-only changes.
Configuration menu - View commit details
-
Copy full SHA for afe04f7 - Browse repository at this point
Copy the full SHA afe04f7View commit details -
Extract wxLOCALE_XXX constants into their own header
No real changes, just make it possible to use these constants without including the entire wx/intl.h. Note that the existing headers including wx/intl.h need to keep including it, unfortunately, as not doing it any longer would break compilation of any code including them which relies on _() or wxGetTranslation() being defined after including e.g. wx/dc.h. This was, of course, never guaranteed, but in practice it worked for a very long time, so don't break it now. This commit is best viewed with --color-moved git option.
Configuration menu - View commit details
-
Copy full SHA for b6d4eda - Browse repository at this point
Copy the full SHA b6d4edaView commit details -
Display locale information directly in the main sample frame
This is more convenient than having to open the "About" dialog to see the details of the locale being used. It also makes it unnecessary to store wxLocale reference in the frame class, simplifying the sample code.
Configuration menu - View commit details
-
Copy full SHA for b12961f - Browse repository at this point
Copy the full SHA b12961fView commit details
Commits on Aug 20, 2021
-
Add wxUILocale with minimal functionality
Use it in the sample to show what (little) it can do right now.
Configuration menu - View commit details
-
Copy full SHA for b9cbe67 - Browse repository at this point
Copy the full SHA b9cbe67View commit details -
Remove obsolete AIX workaround from wxLocale code
This code, added back in 420de41 (workaround for buggy setlocale() under AIX (without this wxLocale didn't work at all), 2005-09-18), is probably irrelevant anyhow because AIX 5.2 must not be used any more, but also seems to have lost its purpose at some time during the intervening years, as we don't use "retloc" as argument to setlocale() anyhow, so it is doubly safe to simply remove it.
Configuration menu - View commit details
-
Copy full SHA for 8f20dd3 - Browse repository at this point
Copy the full SHA 8f20dd3View commit details -
Use Core Foundation for testing locale availability under Mac
Using setlocale() is not the right way to do it there, try checking if the locale is supported by Core Foundation instead of whether it's supported by the Unix layer which is neglected and not used under Mac.
Configuration menu - View commit details
-
Copy full SHA for 59a4505 - Browse repository at this point
Copy the full SHA 59a4505View commit details -
Move wxLanguageInfo declaration to wx/localedefs.h too
No real changes, just allow wxUILocale code to use this struct without including the full wx/intl.h. This commit is best viewed with --color-moved git option.
Configuration menu - View commit details
-
Copy full SHA for 405bb3e - Browse repository at this point
Copy the full SHA 405bb3eView commit details -
Untangle Mac and POSIX code in wxLocale::GetSystemLanguage()
Most of the code in this function was Unix-specific and didn't make sense for Mac, where we never have to apply the workarounds in it nor deal with languages specified without the territory etc, so separate Mac branch using CoreFouundation API from the rest of the Unix code to make things more understandable. No real changes.
Configuration menu - View commit details
-
Copy full SHA for d3a1aba - Browse repository at this point
Copy the full SHA d3a1abaView commit details -
Move platform-specific parts of wxLocale::Init() to wxUILocale
This is tidier than using #ifdefs in the same common file and also ensures that initializing wxLocale affects wxUILocale too, which will be important for compatibility when the code elsewhere is modified to use wxUILocale::GetInfo() instead of wxLocale::GetInfo() in the upcoming commits. This commit is best viewed with --color-moved git option.
Configuration menu - View commit details
-
Copy full SHA for 37a23e1 - Browse repository at this point
Copy the full SHA 37a23e1View commit details -
Use wxUILocale in wxNumberFormatter
Always use the UI locale conventions for floating point numbers in wxNumberFormatter, making it different from wxString::{To,From}Double() functions that use C locale, which may, or not, correspond to the UI locale.
Configuration menu - View commit details
-
Copy full SHA for b3cab73 - Browse repository at this point
Copy the full SHA b3cab73View commit details -
Use wxUILocale in wxSpinCtrlDouble
This ensures that we use the decimal separator corresponding to the UI locale of the application, rather than C locale, so that e.g. comma is used under macOS even if setlocale() is not used.
Configuration menu - View commit details
-
Copy full SHA for 85d3799 - Browse repository at this point
Copy the full SHA 85d3799View commit details -
Add wxNumberFormatter::Format() for floating point numbers
The existing ToString() is not flexible enough to be used in wxGrid, which supports specifying the width (and not just the precision) as well as using formats other than "%g" and "%f" which are the only ones supported by the existing function. Note that currently the implementation simply calls wxString::Format() and then adjusts the decimal separator, but it could, in principle, use wxUILocale methods for formatting the floating point numbers using native platform functions for doing this, e.g. CFNumberFormatter under macOS.
Configuration menu - View commit details
-
Copy full SHA for 3fc031e - Browse repository at this point
Copy the full SHA 3fc031eView commit details -
Use wxNumberFormatter in wxGrid number renderer and editor
This ensures that the correct, i.e. matching the users default, decimal point separator is used even if setlocale() is not called. Also simplify the code a bit by removing checks for wxUSE_INTL already present in wxNumberFormatter itself.
Configuration menu - View commit details
-
Copy full SHA for e438f9a - Browse repository at this point
Copy the full SHA e438f9aView commit details -
Add wxGetUIDateFormat() helper function
Retrieve thr date format to use, even when wxUSE_INTL==0.
Configuration menu - View commit details
-
Copy full SHA for 8fa853a - Browse repository at this point
Copy the full SHA 8fa853aView commit details -
Use wxUILocale for formatting dates in wxGrid
This is similar to the previous commit and ensures that the correct date format is used even if setlocale() is not called.
Configuration menu - View commit details
-
Copy full SHA for d08fc75 - Browse repository at this point
Copy the full SHA d08fc75View commit details -
Add a wxGrid with numbers and dates to the internat sample
Show that the numbers and dates in wxGrid use the expected formats.
Configuration menu - View commit details
-
Copy full SHA for 8373b14 - Browse repository at this point
Copy the full SHA 8373b14View commit details -
Use wxUILocale for date formatting in wxDataViewDateRenderer
Use the appropriate format for the dates by using the UI, rather than C, locale, similarly to wxGrid.
Configuration menu - View commit details
-
Copy full SHA for c746953 - Browse repository at this point
Copy the full SHA c746953View commit details -
Demonstrate the thousands separator in internat sample too
Use a number > 1000 to show the difference between the locales.
Configuration menu - View commit details
-
Copy full SHA for 9205209 - Browse repository at this point
Copy the full SHA 9205209View commit details