Change wxLocaleIdent ctor to take char* rather than wxString

This is convenient, as it allows using a simple string such as "en" as
an argument to the functions taking wxLocaleIdent and rely on implicit
conversion, whereas previously explicitly writing either wxString("en")
or wxLocaleIdent("en") would be necessary.
This commit is contained in:
Vadim Zeitlin
2021-08-29 18:53:29 +02:00
parent ddd60d5a39
commit 20e3697f00
2 changed files with 11 additions and 3 deletions

View File

@@ -118,8 +118,13 @@ public:
// Leave language empty
wxLocaleIdent() { }
// Construct name from language
wxLocaleIdent(const wxString& language) : m_language(language) { }
// Construct from language, i.e. a two-letter ISO 639-1 code (or a
// three-letter ISO 639-2 code if there is no ISO 639-1 code for this
// language).
wxLocaleIdent(const char* language)
: m_language(wxString::FromAscii(language))
{
}
// Set language
wxLocaleIdent& Language(const wxString& language)

View File

@@ -184,11 +184,14 @@ public:
/**
Constructor with language.
Note that this constructor is non-explicit, allowing to pass just a
simple string, such as "en", to functions taking wxLocaleIdent.
@param language
ISO 639 language code.
See Language() for more detailed info.
*/
wxLocaleIdent(const wxString& language);
wxLocaleIdent(const char* language);
/**
Set language.