1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Internationalization and localisation for wxWidgets
4 // Author: Vadim Zeitlin
5 // Modified by: Michael N. Filippov <michael@idisys.iae.nsk.su>
6 // (2003/09/30 - plural forms support)
9 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 // WARNING: Parts of this file are generated. See misc/languages/README for
20 #include "wx/string.h"
23 #include "wx/hashmap.h"
26 // Make wxLayoutDirection enum available without need for wxUSE_INTL so wxWindow, wxApp
27 // and other classes are not distrubed by wxUSE_INTL
29 enum wxLayoutDirection
38 #include "wx/fontenc.h"
40 // ============================================================================
42 // ============================================================================
44 // ----------------------------------------------------------------------------
46 // ----------------------------------------------------------------------------
48 // gettext() style macros (notice that xgettext should be invoked with
49 // --keyword="_" --keyword="wxPLURAL:1,2" options
50 // to extract the strings from the sources)
51 #ifndef WXINTL_NO_GETTEXT_MACRO
52 #define _(s) wxGetTranslation((s))
53 #define wxPLURAL(sing, plur, n) wxGetTranslation((sing), (plur), n)
56 // another one which just marks the strings for extraction, but doesn't
57 // perform the translation (use -kwxTRANSLATE with xgettext!)
58 #define wxTRANSLATE(str) str
60 // ----------------------------------------------------------------------------
62 // ----------------------------------------------------------------------------
64 class WXDLLIMPEXP_FWD_BASE wxTranslationsLoader
;
65 class WXDLLIMPEXP_FWD_BASE wxLocale
;
66 class WXDLLIMPEXP_FWD_BASE wxLanguageInfoArray
;
69 // ============================================================================
71 // ============================================================================
73 // ----------------------------------------------------------------------------
74 // wxLanguage: defines all supported languages
75 // ----------------------------------------------------------------------------
77 // --- --- --- generated code begins here --- --- ---
80 The languages supported by wxLocale.
82 This enum is generated by misc/languages/genlang.py
83 When making changes, please put them into misc/languages/langtabl.txt
87 /// User's default/preffered language as got from OS.
90 /// Unknown language, returned if wxLocale::GetSystemLanguage fails.
99 wxLANGUAGE_ARABIC_ALGERIA
,
100 wxLANGUAGE_ARABIC_BAHRAIN
,
101 wxLANGUAGE_ARABIC_EGYPT
,
102 wxLANGUAGE_ARABIC_IRAQ
,
103 wxLANGUAGE_ARABIC_JORDAN
,
104 wxLANGUAGE_ARABIC_KUWAIT
,
105 wxLANGUAGE_ARABIC_LEBANON
,
106 wxLANGUAGE_ARABIC_LIBYA
,
107 wxLANGUAGE_ARABIC_MOROCCO
,
108 wxLANGUAGE_ARABIC_OMAN
,
109 wxLANGUAGE_ARABIC_QATAR
,
110 wxLANGUAGE_ARABIC_SAUDI_ARABIA
,
111 wxLANGUAGE_ARABIC_SUDAN
,
112 wxLANGUAGE_ARABIC_SYRIA
,
113 wxLANGUAGE_ARABIC_TUNISIA
,
114 wxLANGUAGE_ARABIC_UAE
,
115 wxLANGUAGE_ARABIC_YEMEN
,
121 wxLANGUAGE_AZERI_CYRILLIC
,
122 wxLANGUAGE_AZERI_LATIN
,
125 wxLANGUAGE_BELARUSIAN
,
131 wxLANGUAGE_BULGARIAN
,
133 wxLANGUAGE_CAMBODIAN
,
136 wxLANGUAGE_CHINESE_SIMPLIFIED
,
137 wxLANGUAGE_CHINESE_TRADITIONAL
,
138 wxLANGUAGE_CHINESE_HONGKONG
,
139 wxLANGUAGE_CHINESE_MACAU
,
140 wxLANGUAGE_CHINESE_SINGAPORE
,
141 wxLANGUAGE_CHINESE_TAIWAN
,
147 wxLANGUAGE_DUTCH_BELGIAN
,
149 wxLANGUAGE_ENGLISH_UK
,
150 wxLANGUAGE_ENGLISH_US
,
151 wxLANGUAGE_ENGLISH_AUSTRALIA
,
152 wxLANGUAGE_ENGLISH_BELIZE
,
153 wxLANGUAGE_ENGLISH_BOTSWANA
,
154 wxLANGUAGE_ENGLISH_CANADA
,
155 wxLANGUAGE_ENGLISH_CARIBBEAN
,
156 wxLANGUAGE_ENGLISH_DENMARK
,
157 wxLANGUAGE_ENGLISH_EIRE
,
158 wxLANGUAGE_ENGLISH_JAMAICA
,
159 wxLANGUAGE_ENGLISH_NEW_ZEALAND
,
160 wxLANGUAGE_ENGLISH_PHILIPPINES
,
161 wxLANGUAGE_ENGLISH_SOUTH_AFRICA
,
162 wxLANGUAGE_ENGLISH_TRINIDAD
,
163 wxLANGUAGE_ENGLISH_ZIMBABWE
,
164 wxLANGUAGE_ESPERANTO
,
171 wxLANGUAGE_FRENCH_BELGIAN
,
172 wxLANGUAGE_FRENCH_CANADIAN
,
173 wxLANGUAGE_FRENCH_LUXEMBOURG
,
174 wxLANGUAGE_FRENCH_MONACO
,
175 wxLANGUAGE_FRENCH_SWISS
,
180 wxLANGUAGE_GERMAN_AUSTRIAN
,
181 wxLANGUAGE_GERMAN_BELGIUM
,
182 wxLANGUAGE_GERMAN_LIECHTENSTEIN
,
183 wxLANGUAGE_GERMAN_LUXEMBOURG
,
184 wxLANGUAGE_GERMAN_SWISS
,
186 wxLANGUAGE_GREENLANDIC
,
192 wxLANGUAGE_HUNGARIAN
,
193 wxLANGUAGE_ICELANDIC
,
194 wxLANGUAGE_INDONESIAN
,
195 wxLANGUAGE_INTERLINGUA
,
196 wxLANGUAGE_INTERLINGUE
,
197 wxLANGUAGE_INUKTITUT
,
201 wxLANGUAGE_ITALIAN_SWISS
,
206 wxLANGUAGE_KASHMIRI_INDIA
,
209 wxLANGUAGE_KINYARWANDA
,
219 wxLANGUAGE_LITHUANIAN
,
220 wxLANGUAGE_MACEDONIAN
,
223 wxLANGUAGE_MALAYALAM
,
224 wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM
,
225 wxLANGUAGE_MALAY_MALAYSIA
,
230 wxLANGUAGE_MOLDAVIAN
,
231 wxLANGUAGE_MONGOLIAN
,
234 wxLANGUAGE_NEPALI_INDIA
,
235 wxLANGUAGE_NORWEGIAN_BOKMAL
,
236 wxLANGUAGE_NORWEGIAN_NYNORSK
,
242 wxLANGUAGE_PORTUGUESE
,
243 wxLANGUAGE_PORTUGUESE_BRAZILIAN
,
246 wxLANGUAGE_RHAETO_ROMANCE
,
249 wxLANGUAGE_RUSSIAN_UKRAINE
,
254 wxLANGUAGE_SCOTS_GAELIC
,
256 wxLANGUAGE_SERBIAN_CYRILLIC
,
257 wxLANGUAGE_SERBIAN_LATIN
,
258 wxLANGUAGE_SERBO_CROATIAN
,
263 wxLANGUAGE_SINHALESE
,
266 wxLANGUAGE_SLOVENIAN
,
269 wxLANGUAGE_SPANISH_ARGENTINA
,
270 wxLANGUAGE_SPANISH_BOLIVIA
,
271 wxLANGUAGE_SPANISH_CHILE
,
272 wxLANGUAGE_SPANISH_COLOMBIA
,
273 wxLANGUAGE_SPANISH_COSTA_RICA
,
274 wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC
,
275 wxLANGUAGE_SPANISH_ECUADOR
,
276 wxLANGUAGE_SPANISH_EL_SALVADOR
,
277 wxLANGUAGE_SPANISH_GUATEMALA
,
278 wxLANGUAGE_SPANISH_HONDURAS
,
279 wxLANGUAGE_SPANISH_MEXICAN
,
280 wxLANGUAGE_SPANISH_MODERN
,
281 wxLANGUAGE_SPANISH_NICARAGUA
,
282 wxLANGUAGE_SPANISH_PANAMA
,
283 wxLANGUAGE_SPANISH_PARAGUAY
,
284 wxLANGUAGE_SPANISH_PERU
,
285 wxLANGUAGE_SPANISH_PUERTO_RICO
,
286 wxLANGUAGE_SPANISH_URUGUAY
,
287 wxLANGUAGE_SPANISH_US
,
288 wxLANGUAGE_SPANISH_VENEZUELA
,
289 wxLANGUAGE_SUNDANESE
,
292 wxLANGUAGE_SWEDISH_FINLAND
,
307 wxLANGUAGE_UKRAINIAN
,
309 wxLANGUAGE_URDU_INDIA
,
310 wxLANGUAGE_URDU_PAKISTAN
,
312 wxLANGUAGE_UZBEK_CYRILLIC
,
313 wxLANGUAGE_UZBEK_LATIN
,
314 wxLANGUAGE_VALENCIAN
,
315 wxLANGUAGE_VIETNAMESE
,
325 /// For custom, user-defined languages.
326 wxLANGUAGE_USER_DEFINED
329 // --- --- --- generated code ends here --- --- ---
331 // ----------------------------------------------------------------------------
332 // wxLanguageInfo: encapsulates wxLanguage to OS native lang.desc.
333 // translation information
334 // ----------------------------------------------------------------------------
336 struct WXDLLIMPEXP_BASE wxLanguageInfo
338 int Language
; // wxLanguage id
339 wxString CanonicalName
; // Canonical name, e.g. fr_FR
341 wxUint32 WinLang
, // Win32 language identifiers
344 wxString Description
; // human-readable name of the language
345 wxLayoutDirection LayoutDirection
;
348 // return the LCID corresponding to this language
349 wxUint32
GetLCID() const;
352 // return the locale name corresponding to this language usable with
353 // setlocale() on the current system
354 wxString
GetLocaleName() const;
357 // for Unix systems GetLocaleName() is trivial so implement it inline here, for
358 // MSW it's implemented in intl.cpp
360 inline wxString
wxLanguageInfo::GetLocaleName() const { return CanonicalName
; }
363 // ----------------------------------------------------------------------------
364 // wxTranslations: message catalogs
365 // ----------------------------------------------------------------------------
367 // this class allows to get translations for strings
368 class WXDLLIMPEXP_BASE wxTranslations
374 // returns current translations object, may return NULL
375 static wxTranslations
*Get();
376 // sets current translations object (takes ownership; may be NULL)
377 static void Set(wxTranslations
*t
);
379 // changes loader to non-default one; takes ownership of 'loader'
380 void SetLoader(wxTranslationsLoader
*loader
);
382 void SetLanguage(wxLanguage lang
);
383 void SetLanguage(const wxString
& lang
);
385 // add standard wxWidgets catalog ("wxstd")
386 bool AddStdCatalog();
388 // add catalog with given domain name and language, looking it up via
389 // wxTranslationsLoader
390 bool AddCatalog(const wxString
& domain
);
391 bool AddCatalog(const wxString
& domain
, wxLanguage msgIdLanguage
);
393 bool AddCatalog(const wxString
& domain
,
394 wxLanguage msgIdLanguage
,
395 const wxString
& msgIdCharset
);
398 // check if the given catalog is loaded
399 bool IsLoaded(const wxString
& domain
) const;
401 // load catalog data directly from file
402 bool LoadCatalogFile(const wxString
& filename
,
403 const wxString
& domain
= wxEmptyString
);
405 // access to translations
406 const wxString
& GetString(const wxString
& origString
,
407 const wxString
& domain
= wxEmptyString
) const;
408 const wxString
& GetString(const wxString
& origString
,
409 const wxString
& origString2
,
411 const wxString
& domain
= wxEmptyString
) const;
413 wxString
GetHeaderValue(const wxString
& header
,
414 const wxString
& domain
= wxEmptyString
) const;
416 // this is hack to work around a problem with wxGetTranslation() which
417 // returns const wxString& and not wxString, so when it returns untranslated
418 // string, it needs to have a copy of it somewhere
419 static const wxString
& GetUntranslatedString(const wxString
& str
);
422 // find best translation for given domain
423 wxString
ChooseLanguageForDomain(const wxString
& domain
,
424 const wxString
& msgIdLang
);
426 // find catalog by name in a linked list, return NULL if !found
427 wxMsgCatalog
*FindCatalog(const wxString
& domain
) const;
429 // same as Set(), without taking ownership; only for wxLocale
430 static void SetNonOwned(wxTranslations
*t
);
431 friend class wxLocale
;
435 wxTranslationsLoader
*m_loader
;
437 wxMsgCatalog
*m_pMsgCat
; // pointer to linked list of catalogs
440 wxStringToStringHashMap m_msgIdCharset
;
445 // abstraction of translations discovery and loading
446 class WXDLLIMPEXP_BASE wxTranslationsLoader
449 wxTranslationsLoader() {}
450 virtual ~wxTranslationsLoader() {}
452 virtual bool LoadCatalog(wxTranslations
*translations
,
453 const wxString
& domain
, const wxString
& lang
) = 0;
456 // standard wxTranslationsLoader implementation, using filesystem
457 class WXDLLIMPEXP_BASE wxFileTranslationsLoader
458 : public wxTranslationsLoader
461 static void AddCatalogLookupPathPrefix(const wxString
& prefix
);
463 virtual bool LoadCatalog(wxTranslations
*translations
,
464 const wxString
& domain
, const wxString
& lang
);
468 // ----------------------------------------------------------------------------
469 // wxLocaleCategory: the category of locale settings
470 // ----------------------------------------------------------------------------
472 enum wxLocaleCategory
483 // default category for wxLocaleInfo values which only apply to a single
484 // category (e.g. wxLOCALE_SHORT_DATE_FMT)
485 wxLOCALE_CAT_DEFAULT
,
490 // ----------------------------------------------------------------------------
491 // wxLocaleInfo: the items understood by wxLocale::GetInfo()
492 // ----------------------------------------------------------------------------
496 // the thousands separator (for wxLOCALE_CAT_NUMBER or MONEY)
497 wxLOCALE_THOUSANDS_SEP
,
499 // the character used as decimal point (for wxLOCALE_CAT_NUMBER or MONEY)
500 wxLOCALE_DECIMAL_POINT
,
502 // the stftime()-formats used for short/long date and time representations
503 // (under some platforms short and long date formats are the same)
505 // NB: these elements should appear in this order, code in GetInfo() relies
507 wxLOCALE_SHORT_DATE_FMT
,
508 wxLOCALE_LONG_DATE_FMT
,
509 wxLOCALE_DATE_TIME_FMT
,
514 // ----------------------------------------------------------------------------
515 // wxLocale: encapsulates all language dependent settings, including current
516 // message catalogs, date, time and currency formats (TODO) &c
517 // ----------------------------------------------------------------------------
519 enum wxLocaleInitFlags
521 wxLOCALE_DONT_LOAD_DEFAULT
= 0x0000, // don't load wxwin.mo
522 wxLOCALE_LOAD_DEFAULT
= 0x0001 // load wxwin.mo?
523 #if WXWIN_COMPATIBILITY_2_8
524 ,wxLOCALE_CONV_ENCODING
= 0x0002 // no longer used, simply remove
525 // it from the existing code
529 class WXDLLIMPEXP_BASE wxLocale
535 // call Init() if you use this ctor
536 wxLocale() { DoCommonInit(); }
538 // the ctor has a side effect of changing current locale
539 wxLocale(const wxString
& name
, // name (for messages)
540 const wxString
& shortName
= wxEmptyString
, // dir prefix (for msg files)
541 const wxString
& locale
= wxEmptyString
, // locale (for setlocale)
542 bool bLoadDefault
= true // preload wxstd.mo?
543 #if WXWIN_COMPATIBILITY_2_8
544 ,bool bConvertEncoding
= true // convert Win<->Unix if necessary?
550 #if WXWIN_COMPATIBILITY_2_8
551 Init(name
, shortName
, locale
, bLoadDefault
, bConvertEncoding
);
553 Init(name
, shortName
, locale
, bLoadDefault
);
557 wxLocale(int language
, // wxLanguage id or custom language
558 int flags
= wxLOCALE_LOAD_DEFAULT
)
562 Init(language
, flags
);
565 // the same as a function (returns true on success)
566 bool Init(const wxString
& name
,
567 const wxString
& shortName
= wxEmptyString
,
568 const wxString
& locale
= wxEmptyString
,
569 bool bLoadDefault
= true
570 #if WXWIN_COMPATIBILITY_2_8
571 ,bool bConvertEncoding
= true
575 // same as second ctor (returns true on success)
576 bool Init(int language
= wxLANGUAGE_DEFAULT
,
577 int flags
= wxLOCALE_LOAD_DEFAULT
);
579 // restores old locale
582 // Try to get user's (or OS's) preferred language setting.
583 // Return wxLANGUAGE_UNKNOWN if language-guessing algorithm failed
584 static int GetSystemLanguage();
586 // get the encoding used by default for text on this system, returns
587 // wxFONTENCODING_SYSTEM if it couldn't be determined
588 static wxFontEncoding
GetSystemEncoding();
590 // get the string describing the system encoding, return empty string if
591 // couldn't be determined
592 static wxString
GetSystemEncodingName();
594 // get the values of the given locale-dependent datum: the current locale
595 // is used, the US default value is returned if everything else fails
596 static wxString
GetInfo(wxLocaleInfo index
,
597 wxLocaleCategory cat
= wxLOCALE_CAT_DEFAULT
);
599 // return true if the locale was set successfully
600 bool IsOk() const { return m_pszOldLocale
!= NULL
; }
602 // returns locale name
603 const wxString
& GetLocale() const { return m_strLocale
; }
605 // return current locale wxLanguage value
606 int GetLanguage() const { return m_language
; }
608 // return locale name to be passed to setlocale()
609 wxString
GetSysName() const;
611 // return 'canonical' name, i.e. in the form of xx[_YY], where xx is
612 // language code according to ISO 639 and YY is country name
613 // as specified by ISO 3166.
614 wxString
GetCanonicalName() const { return m_strShort
; }
616 // add a prefix to the catalog lookup path: the message catalog files will be
617 // looked up under prefix/<lang>/LC_MESSAGES, prefix/LC_MESSAGES and prefix
620 // This only applies to subsequent invocations of AddCatalog()!
621 static void AddCatalogLookupPathPrefix(const wxString
& prefix
)
622 { wxFileTranslationsLoader::AddCatalogLookupPathPrefix(prefix
); }
624 // add a catalog: it's searched for in standard places (current directory
625 // first, system one after), but the you may prepend additional directories to
626 // the search path with AddCatalogLookupPathPrefix().
628 // The loaded catalog will be used for message lookup by GetString().
630 // Returns 'true' if it was successfully loaded
631 bool AddCatalog(const wxString
& domain
)
632 { return m_translations
.AddCatalog(domain
); }
633 bool AddCatalog(const wxString
& domain
, wxLanguage msgIdLanguage
)
634 { return m_translations
.AddCatalog(domain
, msgIdLanguage
); }
635 bool AddCatalog(const wxString
& domain
,
636 wxLanguage msgIdLanguage
, const wxString
& msgIdCharset
);
638 // check if the given locale is provided by OS and C run time
639 static bool IsAvailable(int lang
);
641 // check if the given catalog is loaded
642 bool IsLoaded(const wxString
& domain
) const
643 { return m_translations
.IsLoaded(domain
); }
645 // Retrieve the language info struct for the given language
647 // Returns NULL if no info found, pointer must *not* be deleted by caller
648 static const wxLanguageInfo
*GetLanguageInfo(int lang
);
650 // Returns language name in English or empty string if the language
651 // is not in database
652 static wxString
GetLanguageName(int lang
);
654 // Returns ISO code ("canonical name") of language or empty string if the
655 // language is not in database
656 static wxString
GetLanguageCanonicalName(int lang
);
658 // Find the language for the given locale string which may be either a
659 // canonical ISO 2 letter language code ("xx"), a language code followed by
660 // the country code ("xx_XX") or a Windows full language name ("Xxxxx...")
662 // Returns NULL if no info found, pointer must *not* be deleted by caller
663 static const wxLanguageInfo
*FindLanguageInfo(const wxString
& locale
);
665 // Add custom language to the list of known languages.
666 // Notes: 1) wxLanguageInfo contains platform-specific data
667 // 2) must be called before Init to have effect
668 static void AddLanguage(const wxLanguageInfo
& info
);
670 // retrieve the translation for a string in all loaded domains unless
671 // the szDomain parameter is specified (and then only this domain is
673 // n - additional parameter for PluralFormsParser
675 // return original string if translation is not available
676 // (in this case an error message is generated the first time
677 // a string is not found; use wxLogNull to suppress it)
679 // domains are searched in the last to first order, i.e. catalogs
680 // added later override those added before.
681 const wxString
& GetString(const wxString
& origString
,
682 const wxString
& domain
= wxEmptyString
) const
684 return m_translations
.GetString(origString
, domain
);
686 // plural form version of the same:
687 const wxString
& GetString(const wxString
& origString
,
688 const wxString
& origString2
,
690 const wxString
& domain
= wxEmptyString
) const
692 return m_translations
.GetString(origString
, origString2
, n
, domain
);
695 // this is hack to work around a problem with wxGetTranslation() which
696 // returns const wxString& and not wxString, so when it returns untranslated
697 // string, it needs to have a copy of it somewhere
698 static const wxString
& GetUntranslatedString(const wxString
& str
)
699 { return wxTranslations::GetUntranslatedString(str
); }
701 // Returns the current short name for the locale
702 const wxString
& GetName() const { return m_strShort
; }
704 // return the contents of .po file header
705 wxString
GetHeaderValue(const wxString
& header
,
706 const wxString
& domain
= wxEmptyString
) const
708 return m_translations
.GetHeaderValue(header
, domain
);
711 // These two methods are for internal use only. First one creates
712 // ms_languagesDB if it doesn't already exist, second one destroys
714 static void CreateLanguagesDB();
715 static void DestroyLanguagesDB();
718 bool DoInit(const wxString
& name
,
719 const wxString
& shortName
,
720 const wxString
& locale
);
722 // copy default table of languages from global static array to
723 // m_langugagesInfo, called by InitLanguagesDB
724 static void InitLanguagesDB();
726 // initialize the member fields to default values
729 wxString m_strLocale
, // this locale name
730 m_strShort
; // short name for the locale
731 int m_language
; // this locale wxLanguage value
733 const char *m_pszOldLocale
; // previous locale from setlocale()
734 wxLocale
*m_pOldLocale
; // previous wxLocale
738 wxTranslations m_translations
;
740 static wxLanguageInfoArray
*ms_languagesDB
;
742 wxDECLARE_NO_COPY_CLASS(wxLocale
);
745 // ----------------------------------------------------------------------------
747 // ----------------------------------------------------------------------------
749 // get the current locale object (note that it may be NULL!)
750 extern WXDLLIMPEXP_BASE wxLocale
* wxGetLocale();
752 // get the translation of the string in the current locale
753 inline const wxString
& wxGetTranslation(const wxString
& str
,
754 const wxString
& domain
= wxEmptyString
)
756 wxTranslations
*trans
= wxTranslations::Get();
758 return trans
->GetString(str
, domain
);
760 // NB: this function returns reference to a string, so we have to keep
761 // a copy of it somewhere
762 return wxTranslations::GetUntranslatedString(str
);
764 inline const wxString
& wxGetTranslation(const wxString
& str1
,
765 const wxString
& str2
,
767 const wxString
& domain
= wxEmptyString
)
769 wxTranslations
*trans
= wxTranslations::Get();
771 return trans
->GetString(str1
, str2
, n
, domain
);
773 // NB: this function returns reference to a string, so we have to keep
774 // a copy of it somewhere
776 ? wxTranslations::GetUntranslatedString(str1
)
777 : wxTranslations::GetUntranslatedString(str2
);
782 // the macros should still be defined - otherwise compilation would fail
784 #if !defined(WXINTL_NO_GETTEXT_MACRO)
788 #define wxPLURAL(sing, plur, n) ((n) == 1 ? (sing) : (plur))
791 #define wxTRANSLATE(str) str
793 // NB: we use a template here in order to avoid using
794 // wxLocale::GetUntranslatedString() above, which would be required if
795 // we returned const wxString&; this way, the compiler should be able to
796 // optimize wxGetTranslation() away
798 template<typename TString
>
799 inline TString
wxGetTranslation(TString str
)
802 template<typename TString
, typename TDomain
>
803 inline TString
wxGetTranslation(TString str
, TDomain
WXUNUSED(domain
))
806 template<typename TString
, typename TDomain
>
807 inline TString
wxGetTranslation(TString str1
, TString str2
, size_t n
)
808 { return n
== 1 ? str1
: str2
; }
810 template<typename TString
, typename TDomain
>
811 inline TString
wxGetTranslation(TString str1
, TString str2
, size_t n
,
812 TDomain
WXUNUSED(domain
))
813 { return n
== 1 ? str1
: str2
; }
815 #endif // wxUSE_INTL/!wxUSE_INTL
817 // define this one just in case it occurs somewhere (instead of preferred
819 #if !defined(WXINTL_NO_GETTEXT_MACRO)
820 #if !defined(gettext_noop)
821 #define gettext_noop(str) (str)
828 #endif // _WX_INTL_H_