|
The current locale is also used for formatting numbers and dates. The printf-based formatting in wxString takes care of this automatically. Consider this snippet: wxString::Format(wxT("%.1f") , myDouble); Here, Format uses the correct decimal separator. And for date formatting: wxDateTime t = wxDateTime::Now(); wxString str = t.Format(); Format presents the current date and time in the correct language and format. Have a look at the API documentation to see all the possibilities for passing a format description to the Format calljust don't forget that you will probably have to translate this format string as well for using it in a different language because the sequence for different parts of the date can differ among languages. If you want to add the correct thousands separator or just want to know the correct character for the decimal point, you can ask the locale object for the corresponding strings using the GetInfo method: wxString info = m_locale.GetInfo(wxLOCALE_THOUSANDS_SEP, wxLOCALE_CAT_NUMBER) ; |
|