1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxLocale
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 // --- --- --- generated code begins here --- --- ---
13 The languages supported by wxLocale.
15 This enum is generated by misc/languages/genlang.py
16 When making changes, please put them into misc/languages/langtabl.txt
20 /// User's default/preferred language as got from OS.
23 /// Unknown language, returned if wxLocale::GetSystemLanguage fails.
32 wxLANGUAGE_ARABIC_ALGERIA
,
33 wxLANGUAGE_ARABIC_BAHRAIN
,
34 wxLANGUAGE_ARABIC_EGYPT
,
35 wxLANGUAGE_ARABIC_IRAQ
,
36 wxLANGUAGE_ARABIC_JORDAN
,
37 wxLANGUAGE_ARABIC_KUWAIT
,
38 wxLANGUAGE_ARABIC_LEBANON
,
39 wxLANGUAGE_ARABIC_LIBYA
,
40 wxLANGUAGE_ARABIC_MOROCCO
,
41 wxLANGUAGE_ARABIC_OMAN
,
42 wxLANGUAGE_ARABIC_QATAR
,
43 wxLANGUAGE_ARABIC_SAUDI_ARABIA
,
44 wxLANGUAGE_ARABIC_SUDAN
,
45 wxLANGUAGE_ARABIC_SYRIA
,
46 wxLANGUAGE_ARABIC_TUNISIA
,
47 wxLANGUAGE_ARABIC_UAE
,
48 wxLANGUAGE_ARABIC_YEMEN
,
53 wxLANGUAGE_AZERI_CYRILLIC
,
54 wxLANGUAGE_AZERI_LATIN
,
57 wxLANGUAGE_BELARUSIAN
,
68 wxLANGUAGE_CHINESE_SIMPLIFIED
,
69 wxLANGUAGE_CHINESE_TRADITIONAL
,
70 wxLANGUAGE_CHINESE_HONGKONG
,
71 wxLANGUAGE_CHINESE_MACAU
,
72 wxLANGUAGE_CHINESE_SINGAPORE
,
73 wxLANGUAGE_CHINESE_TAIWAN
,
79 wxLANGUAGE_DUTCH_BELGIAN
,
81 wxLANGUAGE_ENGLISH_UK
,
82 wxLANGUAGE_ENGLISH_US
,
83 wxLANGUAGE_ENGLISH_AUSTRALIA
,
84 wxLANGUAGE_ENGLISH_BELIZE
,
85 wxLANGUAGE_ENGLISH_BOTSWANA
,
86 wxLANGUAGE_ENGLISH_CANADA
,
87 wxLANGUAGE_ENGLISH_CARIBBEAN
,
88 wxLANGUAGE_ENGLISH_DENMARK
,
89 wxLANGUAGE_ENGLISH_EIRE
,
90 wxLANGUAGE_ENGLISH_JAMAICA
,
91 wxLANGUAGE_ENGLISH_NEW_ZEALAND
,
92 wxLANGUAGE_ENGLISH_PHILIPPINES
,
93 wxLANGUAGE_ENGLISH_SOUTH_AFRICA
,
94 wxLANGUAGE_ENGLISH_TRINIDAD
,
95 wxLANGUAGE_ENGLISH_ZIMBABWE
,
103 wxLANGUAGE_FRENCH_BELGIAN
,
104 wxLANGUAGE_FRENCH_CANADIAN
,
105 wxLANGUAGE_FRENCH_LUXEMBOURG
,
106 wxLANGUAGE_FRENCH_MONACO
,
107 wxLANGUAGE_FRENCH_SWISS
,
112 wxLANGUAGE_GERMAN_AUSTRIAN
,
113 wxLANGUAGE_GERMAN_BELGIUM
,
114 wxLANGUAGE_GERMAN_LIECHTENSTEIN
,
115 wxLANGUAGE_GERMAN_LUXEMBOURG
,
116 wxLANGUAGE_GERMAN_SWISS
,
118 wxLANGUAGE_GREENLANDIC
,
124 wxLANGUAGE_HUNGARIAN
,
125 wxLANGUAGE_ICELANDIC
,
126 wxLANGUAGE_INDONESIAN
,
127 wxLANGUAGE_INTERLINGUA
,
128 wxLANGUAGE_INTERLINGUE
,
129 wxLANGUAGE_INUKTITUT
,
133 wxLANGUAGE_ITALIAN_SWISS
,
138 wxLANGUAGE_KASHMIRI_INDIA
,
141 wxLANGUAGE_KINYARWANDA
,
151 wxLANGUAGE_LITHUANIAN
,
152 wxLANGUAGE_MACEDONIAN
,
155 wxLANGUAGE_MALAYALAM
,
156 wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM
,
157 wxLANGUAGE_MALAY_MALAYSIA
,
162 wxLANGUAGE_MOLDAVIAN
,
163 wxLANGUAGE_MONGOLIAN
,
166 wxLANGUAGE_NEPALI_INDIA
,
167 wxLANGUAGE_NORWEGIAN_BOKMAL
,
168 wxLANGUAGE_NORWEGIAN_NYNORSK
,
174 wxLANGUAGE_PORTUGUESE
,
175 wxLANGUAGE_PORTUGUESE_BRAZILIAN
,
178 wxLANGUAGE_RHAETO_ROMANCE
,
181 wxLANGUAGE_RUSSIAN_UKRAINE
,
186 wxLANGUAGE_SCOTS_GAELIC
,
188 wxLANGUAGE_SERBIAN_CYRILLIC
,
189 wxLANGUAGE_SERBIAN_LATIN
,
190 wxLANGUAGE_SERBO_CROATIAN
,
195 wxLANGUAGE_SINHALESE
,
198 wxLANGUAGE_SLOVENIAN
,
201 wxLANGUAGE_SPANISH_ARGENTINA
,
202 wxLANGUAGE_SPANISH_BOLIVIA
,
203 wxLANGUAGE_SPANISH_CHILE
,
204 wxLANGUAGE_SPANISH_COLOMBIA
,
205 wxLANGUAGE_SPANISH_COSTA_RICA
,
206 wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC
,
207 wxLANGUAGE_SPANISH_ECUADOR
,
208 wxLANGUAGE_SPANISH_EL_SALVADOR
,
209 wxLANGUAGE_SPANISH_GUATEMALA
,
210 wxLANGUAGE_SPANISH_HONDURAS
,
211 wxLANGUAGE_SPANISH_MEXICAN
,
212 wxLANGUAGE_SPANISH_MODERN
,
213 wxLANGUAGE_SPANISH_NICARAGUA
,
214 wxLANGUAGE_SPANISH_PANAMA
,
215 wxLANGUAGE_SPANISH_PARAGUAY
,
216 wxLANGUAGE_SPANISH_PERU
,
217 wxLANGUAGE_SPANISH_PUERTO_RICO
,
218 wxLANGUAGE_SPANISH_URUGUAY
,
219 wxLANGUAGE_SPANISH_US
,
220 wxLANGUAGE_SPANISH_VENEZUELA
,
221 wxLANGUAGE_SUNDANESE
,
224 wxLANGUAGE_SWEDISH_FINLAND
,
239 wxLANGUAGE_UKRAINIAN
,
241 wxLANGUAGE_URDU_INDIA
,
242 wxLANGUAGE_URDU_PAKISTAN
,
244 wxLANGUAGE_UZBEK_CYRILLIC
,
245 wxLANGUAGE_UZBEK_LATIN
,
246 wxLANGUAGE_VALENCIAN
,
247 wxLANGUAGE_VIETNAMESE
,
257 /// For custom, user-defined languages.
258 wxLANGUAGE_USER_DEFINED
261 // --- --- --- generated code ends here --- --- ---
266 This is the layout direction stored in wxLanguageInfo and returned by
267 wxApp::GetLayoutDirection(), wxWindow::GetLayoutDirection(),
268 wxDC::GetLayoutDirection() for RTL (right-to-left) languages support.
270 enum wxLayoutDirection
273 wxLayout_LeftToRight
,
278 Encapsulates a ::wxLanguage indentifier together with OS-specific information
279 related to that language.
281 struct WXDLLIMPEXP_BASE wxLanguageInfo
284 /// It should be greater than @c wxLANGUAGE_USER_DEFINED when defining your own
285 /// language info structure.
288 /// Canonical name of the language, e.g. @c fr_FR.
289 wxString CanonicalName
;
293 Win32 language identifiers (LANG_xxxx, SUBLANG_xxxx).
297 wxUint32 WinLang
, WinSublang
;
300 /// Human-readable name of the language.
301 wxString Description
;
303 /// The layout direction used for this language.
304 wxLayoutDirection LayoutDirection
;
306 /// Return the LCID corresponding to this language.
308 wxUint32
GetLCID() const;
310 /// Return the locale name corresponding to this language usable with
311 /// @c setlocale() on the current system.
312 wxString
GetLocaleName() const;
317 The category of locale settings.
319 @see wxLocale::GetInfo()
321 enum wxLocaleCategory
323 /// Number formatting.
326 /// Date/time formatting.
329 /// Monetary values formatting.
333 Default category for the wxLocaleInfo value.
335 This category can be used for values which only make sense for a single
336 category, e.g. wxLOCALE_SHORT_DATE_FMT which can only be used with
337 wxLOCALE_CAT_DATE. As this is the default value of the second parameter
338 of wxLocale::GetInfo(), wxLOCALE_CAT_DATE can be omitted when asking
339 for wxLOCALE_SHORT_DATE_FMT value.
347 The values understood by wxLocale::GetInfo().
349 Note that for the @c wxLOCALE_*_FMT constants (the date and time formats),
350 the strings returned by wxLocale::GetInfo() use strftime() or,
351 equivalently, wxDateTime::Format() format. If the relevant format
352 couldn't be determined, an empty string is returned -- there is no
353 fallback value so that the application could determine the best course
354 of actions itself in such case.
356 All of these values are used with @c wxLOCALE_CAT_DATE in wxLocale::GetInfo() or,
357 more typically, with @c wxLOCALE_CAT_DEFAULT as they only apply to a single category.
362 The thousands separator.
364 This value can be used with either wxLOCALE_CAT_NUMBER or
365 wxLOCALE_CAT_MONEY categories.
367 wxLOCALE_THOUSANDS_SEP
,
370 The character used as decimal point.
372 This value can be used with either wxLOCALE_CAT_NUMBER or
373 wxLOCALE_CAT_MONEY categories.
375 wxLOCALE_DECIMAL_POINT
,
380 Notice that short and long date formats may be the same under POSIX
381 systems currently but may, and typically are, different under MSW or OS X.
385 wxLOCALE_SHORT_DATE_FMT
,
392 wxLOCALE_LONG_DATE_FMT
,
395 Date and time format.
399 wxLOCALE_DATE_TIME_FMT
,
413 wxLocale class encapsulates all language-dependent settings and is a
414 generalization of the C locale concept.
416 In wxWidgets this class manages message catalogs which contain the translations
417 of the strings used to the current language.
419 For a list of the supported languages, please see ::wxLanguage enum values.
420 These constants may be used to specify the language in wxLocale::Init and
421 are returned by wxLocale::GetSystemLanguage.
424 In wxPerl you can't use the '_' function name, so
425 the @c Wx::Locale module can export the @c gettext and
426 @c gettext_noop under any given name.
429 # this imports gettext ( equivalent to Wx::GetTranslation
430 # and gettext_noop ( a noop )
432 use Wx::Locale qw(:default);
437 print gettext( "Panic!" );
439 button = Wx::Button-new( window, -1, gettext( "Label" ) );
442 If you need to translate a lot of strings, then adding gettext( ) around
443 each one is a long task ( that is why _( ) was introduced ), so just choose
444 a shorter name for gettext:
447 use Wx::Locale 'gettext' = 't',
448 'gettext_noop' = 'gettext_noop';
453 print t( "Panic!!" );
462 @see @ref overview_i18n, @ref page_samples_internat, wxXLocale
468 This is the default constructor and it does nothing to initialize the object:
469 Init() must be used to do that.
474 See Init() for parameters description.
476 wxLocale(int language
,
477 int flags
= wxLOCALE_LOAD_DEFAULT
| wxLOCALE_CONV_ENCODING
);
480 See Init() for parameters description.
482 The call of this function has several global side effects which you should
483 understand: first of all, the application locale is changed - note that this
484 will affect many of standard C library functions such as printf() or strftime().
485 Second, this wxLocale object becomes the new current global locale for the
486 application and so all subsequent calls to ::wxGetTranslation() will try to
487 translate the messages using the message catalogs for this locale.
489 wxLocale(const wxString
& name
,
490 const wxString
& short = wxEmptyString
,
491 const wxString
& locale
= wxEmptyString
,
492 bool bLoadDefault
= true,
493 bool bConvertEncoding
= false);
496 The destructor, like the constructor, also has global side effects: the
497 previously set locale is restored and so the changes described in
498 Init() documentation are rolled back.
503 Add a catalog for use with the current locale: it is searched for in standard
504 places (current directory first, then the system one), but you may also prepend
505 additional directories to the search path with AddCatalogLookupPathPrefix().
507 All loaded catalogs will be used for message lookup by GetString() for
510 In this overload, @c msgid strings are assumed
511 to be in English and written only using 7-bit ASCII characters.
512 If you have to deal with non-English strings or 8-bit characters in the
513 source code, see the instructions in @ref overview_nonenglish.
516 @true if catalog was successfully loaded, @false otherwise (which might
517 mean that the catalog is not found or that it isn't in the correct format).
519 bool AddCatalog(const wxString
& domain
);
522 Add a catalog for use with the current locale: it is searched for in standard
523 places (current directory first, then the system one), but you may also prepend
524 additional directories to the search path with AddCatalogLookupPathPrefix().
526 All loaded catalogs will be used for message lookup by GetString() for
529 This overload takes two additional arguments, @a msgIdLanguage and @a msgIdCharset.
532 The catalog domain to add.
535 Specifies the language of "msgid" strings in source code
536 (i.e. arguments to GetString(), wxGetTranslation() and the _() macro).
537 It is used if AddCatalog() cannot find any catalog for current language:
538 if the language is same as source code language, then strings from source
539 code are used instead.
542 Lets you specify the charset used for msgids in sources
543 in case they use 8-bit characters (e.g. German or French strings).
544 This argument has no effect in Unicode build, because literals in sources are
545 Unicode strings; you have to use compiler-specific method of setting the right
546 charset when compiling with Unicode.
549 @true if catalog was successfully loaded, @false otherwise (which might
550 mean that the catalog is not found or that it isn't in the correct format).
552 bool AddCatalog(const wxString
& domain
, wxLanguage msgIdLanguage
,
553 const wxString
& msgIdCharset
);
556 Add a prefix to the catalog lookup path: the message catalog files will
557 be looked up under prefix/lang/LC_MESSAGES, prefix/lang and prefix
560 This only applies to subsequent invocations of AddCatalog().
562 static void AddCatalogLookupPathPrefix(const wxString
& prefix
);
565 Adds custom, user-defined language to the database of known languages.
566 This database is used in conjunction with the first form of Init().
568 static void AddLanguage(const wxLanguageInfo
& info
);
571 This function may be used to find the language description structure for the
572 given locale, specified either as a two letter ISO language code (for example,
573 "pt"), a language code followed by the country code ("pt_BR") or a full, human
574 readable, language description ("Portuguese-Brazil").
576 Returns the information for the given language or @NULL if this language
577 is unknown. Note that even if the returned pointer is valid, the caller
578 should @e not delete it.
580 @see GetLanguageInfo()
582 static const wxLanguageInfo
* FindLanguageInfo(const wxString
& locale
);
585 Returns the canonical form of current locale name. Canonical form is the
586 one that is used on UNIX systems: it is a two- or five-letter string in xx or
587 xx_YY format, where xx is ISO 639 code of language and YY is ISO 3166 code of
588 the country. Examples are "en", "en_GB", "en_US" or "fr_FR".
589 This form is internally used when looking up message catalogs.
590 Compare GetSysName().
592 wxString
GetCanonicalName() const;
595 Returns the header value for header @a header.
596 The search for @a header is case sensitive. If an @a domain is passed,
597 this domain is searched. Else all domains will be searched until a
598 header has been found.
600 The return value is the value of the header if found. Else this will be empty.
602 wxString
GetHeaderValue(const wxString
& header
,
603 const wxString
& domain
= wxEmptyString
) const;
606 Returns the ::wxLanguage constant of current language.
608 Note that you can call this function only if you used the form of
609 Init() that takes ::wxLanguage argument.
611 int GetLanguage() const;
614 Returns a pointer to wxLanguageInfo structure containing information about
615 the given language or @NULL if this language is unknown. Note that even if
616 the returned pointer is valid, the caller should @e not delete it.
618 See AddLanguage() for the wxLanguageInfo description.
619 As with Init(), @c wxLANGUAGE_DEFAULT has the special meaning if passed
620 as an argument to this function and in this case the result of
621 GetSystemLanguage() is used.
623 static const wxLanguageInfo
* GetLanguageInfo(int lang
);
626 Returns English name of the given language or empty string if this
629 See GetLanguageInfo() for a remark about special meaning of @c wxLANGUAGE_DEFAULT.
631 static wxString
GetLanguageName(int lang
);
634 Returns the locale name as passed to the constructor or Init().
636 This is a full, human-readable name, e.g. "English" or "French".
638 const wxString
& GetLocale() const;
641 Returns the current short name for the locale (as given to the constructor or
642 the Init() function).
644 const wxString
& GetName() const;
647 Retrieves the translation for a string in all loaded domains unless the @a domain
648 parameter is specified (and then only this catalog/domain is searched).
650 Returns original string if translation is not available (in this case an
651 error message is generated the first time a string is not found; use
652 wxLogNull to suppress it).
654 @remarks Domains are searched in the last to first order, i.e. catalogs
655 added later override those added before.
657 virtual const wxString
& GetString(const wxString
& origString
,
658 const wxString
& domain
= wxEmptyString
) const;
661 Retrieves the translation for a string in all loaded domains unless the @a domain
662 parameter is specified (and then only this catalog/domain is searched).
664 Returns original string if translation is not available (in this case an
665 error message is generated the first time a string is not found; use
666 wxLogNull to suppress it).
668 This form is used when retrieving translation of string that has different
669 singular and plural form in English or different plural forms in some
671 It takes two extra arguments: @a origString parameter must contain the
672 singular form of the string to be converted.
674 It is also used as the key for the search in the catalog.
675 The @a origString2 parameter is the plural form (in English).
677 The parameter @a n is used to determine the plural form.
678 If no message catalog is found @a origString is returned if 'n == 1',
679 otherwise @a origString2.
681 See GNU gettext manual for additional information on plural forms handling.
682 This method is called by the wxGetTranslation() function and _() macro.
684 @remarks Domains are searched in the last to first order, i.e. catalogs
685 added later override those added before.
687 virtual const wxString
& GetString(const wxString
& origString
,
688 const wxString
& origString2
, size_t n
,
689 const wxString
& domain
= wxEmptyString
) const;
692 Returns current platform-specific locale name as passed to setlocale().
693 Compare GetCanonicalName().
695 wxString
GetSysName() const;
698 Tries to detect the user's default font encoding.
699 Returns wxFontEncoding() value or @c wxFONTENCODING_SYSTEM if it
700 couldn't be determined.
702 static wxFontEncoding
GetSystemEncoding();
705 Tries to detect the name of the user's default font encoding.
706 This string isn't particularly useful for the application as its form is
707 platform-dependent and so you should probably use GetSystemEncoding() instead.
709 Returns a user-readable string value or an empty string if it couldn't be
712 static wxString
GetSystemEncodingName();
715 Tries to detect the user's default language setting.
717 Returns the ::wxLanguage value or @c wxLANGUAGE_UNKNOWN if the language-guessing
720 static int GetSystemLanguage();
723 Get the values of the given locale-dependent datum.
725 This function returns the value of the locale-specific option specified
726 by the given @a index.
729 One of the elements of wxLocaleInfo enum.
731 The category to use with the given index or wxLOCALE_CAT_DEFAULT if
732 the index can only apply to a single category.
734 The option value or empty string if the function failed.
736 static wxString
GetInfo(wxLocaleInfo index
,
737 wxLocaleCategory cat
= wxLOCALE_CAT_DEFAULT
);
740 Initializes the wxLocale instance.
742 The call of this function has several global side effects which you should
743 understand: first of all, the application locale is changed - note that
744 this will affect many of standard C library functions such as printf()
746 Second, this wxLocale object becomes the new current global locale for
747 the application and so all subsequent calls to wxGetTranslation() will
748 try to translate the messages using the message catalogs for this locale.
751 ::wxLanguage identifier of the locale.
752 @c wxLANGUAGE_DEFAULT has special meaning -- wxLocale will use system's
753 default language (see GetSystemLanguage()).
755 Combination of the following:
756 - wxLOCALE_LOAD_DEFAULT: Load the message catalog for the given locale
757 containing the translations of standard wxWidgets messages
759 - wxLOCALE_CONV_ENCODING: Automatically convert message catalogs to
760 platform's default encoding. Note that it will do only basic
761 conversion between well-known pair like iso8859-1 and windows-1252 or
762 iso8859-2 and windows-1250. See @ref overview_nonenglish for
763 detailed description of this behaviour.
764 Note that this flag is meaningless in Unicode build.
766 @return @true on success or @false if the given locale couldn't be set.
768 bool Init(int language
= wxLANGUAGE_DEFAULT
,
769 int flags
= wxLOCALE_LOAD_DEFAULT
| wxLOCALE_CONV_ENCODING
);
773 This form is deprecated, use the other one unless you know what you are doing.
776 The name of the locale. Only used in diagnostic messages.
778 The standard 2 letter locale abbreviation; it is used as the
779 directory prefix when looking for the message catalog files.
781 The parameter for the call to setlocale().
782 Note that it is platform-specific.
784 May be set to @false to prevent loading of the message catalog for the
785 given locale containing the translations of standard wxWidgets messages.
786 This parameter would be rarely used in normal circumstances.
787 @param bConvertEncoding
788 May be set to @true to do automatic conversion of message catalogs to
789 platform's native encoding. Note that it will do only basic conversion
790 between well-known pair like iso8859-1 and windows-1252 or iso8859-2
792 See @ref overview_nonenglish for detailed description of this behaviour.
794 bool Init(const wxString
& name
, const wxString
& short = wxEmptyString
,
795 const wxString
& locale
= wxEmptyString
, bool bLoadDefault
= true,
796 bool bConvertEncoding
= false);
799 Check whether the operating system and/or C run time environment supports
800 this locale. For example in Windows 2000 and Windows XP, support for many
801 locales is not installed by default. Returns @true if the locale is
804 The argument @a lang is the ::wxLanguage identifier. To obtain this for a
805 given a two letter ISO language code, use FindLanguageInfo() to obtain its
806 wxLanguageInfo structure.
807 See AddLanguage() for the wxLanguageInfo description.
811 static bool IsAvailable(int lang
);
814 Check if the given catalog is loaded, and returns @true if it is.
816 According to GNU gettext tradition, each catalog normally corresponds to
817 'domain' which is more or less the application name.
821 bool IsLoaded(const wxString
& domain
) const;
824 Returns @true if the locale could be set successfully.
832 // ============================================================================
833 // Global functions/macros
834 // ============================================================================
836 /** @addtogroup group_funcmacro_string */
840 This macro is identical to _() but for the plural variant of
843 @return A const wxString.
847 #define wxPLURAL(string, plural, n)
850 This macro doesn't do anything in the program code -- it simply expands to
851 the value of its argument.
853 However it does have a purpose which is to mark the literal strings for the
854 extraction into the message catalog created by @c xgettext program. Usually
855 this is achieved using _() but that macro not only marks the string for
856 extraction but also expands into a wxGetTranslation() call which means that
857 it cannot be used in some situations, notably for static array
860 Here is an example which should make it more clear: suppose that you have a
861 static array of strings containing the weekday names and which have to be
862 translated (note that it is a bad example, really, as wxDateTime already
863 can be used to get the localized week day names already). If you write:
866 static const char * const weekdays[] = { _("Mon"), ..., _("Sun") };
868 // use weekdays[n] as usual
871 The code wouldn't compile because the function calls are forbidden in the
872 array initializer. So instead you should do this:
875 static const char * const weekdays[] = { wxTRANSLATE("Mon"), ...,
876 wxTRANSLATE("Sun") };
878 // use wxGetTranslation(weekdays[n])
881 Note that although the code @b would compile if you simply omit
882 wxTRANSLATE() in the above, it wouldn't work as expected because there
883 would be no translations for the weekday names in the program message
884 catalog and wxGetTranslation() wouldn't find them.
886 @return A const wxChar*.
890 #define wxTRANSLATE(string)
893 This function returns the translation of @a string in the current
894 @c locale(). If the string is not found in any of the loaded message
895 catalogs (see @ref overview_i18n), the original string is returned. In
896 debug build, an error message is logged -- this should help to find the
897 strings which were not yet translated. If @a domain is specified then only
898 that domain/catalog is searched for a matching string. As this function is
899 used very often, an alternative (and also common in Unix world) syntax is
900 provided: the _() macro is defined to do the same thing as
903 This function calls wxLocale::GetString().
905 @note This function is not suitable for literal strings in Unicode builds
906 since the literal strings must be enclosed into _T() or wxT() macro
907 which makes them unrecognised by @c xgettext, and so they are not
908 extracted to the message catalog. Instead, use the _() and wxPLURAL()
909 macro for all literal strings.
911 @see wxGetTranslation(const wxString&, const wxString&, size_t, const wxString&)
915 const wxString
& wxGetTranslation(const wxString
& string
,
916 const wxString
& domain
= wxEmptyString
);
919 This is an overloaded version of
920 wxGetTranslation(const wxString&, const wxString&), please see its
921 documentation for general information.
923 This version is used when retrieving translation of string that has
924 different singular and plural forms in English or different plural forms in
925 some other language. Like wxGetTranslation(const wxString&,const wxString&),
926 the @a string parameter must contain the singular form of the string to be
927 converted and is used as the key for the search in the catalog. The
928 @a plural parameter is the plural form (in English). The parameter @a n is
929 used to determine the plural form. If no message catalog is found,
930 @a string is returned if "n == 1", otherwise @a plural is returned.
932 See GNU gettext Manual for additional information on plural forms handling:
933 <http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms>
934 For a shorter alternative see the wxPLURAL() macro.
936 This function calls wxLocale::GetString().
940 const wxString
& wxGetTranslation(const wxString
& string
,
941 const wxString
& plural
, size_t n
,
942 const wxString
& domain
= wxEmptyString
);
945 This macro expands into a call to wxGetTranslation(), so it marks the
946 message for the extraction by @c xgettext just as wxTRANSLATE() does, but
947 also returns the translation of the string for the current locale during
950 Don't confuse this with _T()!
954 const wxString
& _(const wxString
& string
);