From 4a6e4a46a356e9abf0760e2d481bbec321cc3adf Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Fri, 13 Jun 2003 10:16:19 +0000 Subject: [PATCH] added wxLocale::GetLanguageName git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21099 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/locale.tex | 7 +++++++ include/wx/intl.h | 4 ++++ src/common/intl.cpp | 10 ++++++++++ 3 files changed, 21 insertions(+) diff --git a/docs/latex/wx/locale.tex b/docs/latex/wx/locale.tex index d6f8d46d2c..ed44298e9e 100644 --- a/docs/latex/wx/locale.tex +++ b/docs/latex/wx/locale.tex @@ -446,6 +446,13 @@ returned pointer is valid, the caller should {\it not} delete it. See \helpref{AddLanguage}{wxlocaleaddlanguage} for the wxLanguageInfo description. +\membersection{wxLocale::GetLanguageName}\label{wxlocalegetlanguagename} + +\constfunc{static wxString}{GetLanguageName}{\param{int }{lang}} + +Returns English name of the given language or empty string if this +language is unknown. + \membersection{wxLocale::GetLocale}\label{wxlocalegetlocale} diff --git a/include/wx/intl.h b/include/wx/intl.h index aaae8d3e25..7d92024a86 100644 --- a/include/wx/intl.h +++ b/include/wx/intl.h @@ -455,6 +455,10 @@ public: // Returns NULL if no info found, pointer must *not* be deleted by caller static const wxLanguageInfo *GetLanguageInfo(int lang); + // Returns language name in English or empty string if the language + // is not in database + static wxString GetLanguageName(int lang); + // Find the language for the given locale string which may be either a // canonical ISO 2 letter language code ("xx"), a language code followed by // the country code ("xx_XX") or a Windows full language name ("Xxxxx...") diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 0d83c0db88..684c9a5f25 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -1448,6 +1448,16 @@ const wxLanguageInfo *wxLocale::GetLanguageInfo(int lang) return NULL; } +/* static */ +wxString wxLocale::GetLanguageName(int lang) +{ + const wxLanguageInfo *info = GetLanguageInfo(lang); + if ( !info ) + return wxEmptyString; + else + return info->Description; +} + /* static */ const wxLanguageInfo *wxLocale::FindLanguageInfo(const wxString& locale) { -- 2.45.2