From 49137ba1e1e8c2310084470af6929fc64484ca70 Mon Sep 17 00:00:00 2001 From: Lauri Nurmi Date: Thu, 27 Oct 2016 17:23:49 +0300 Subject: [PATCH] Use a better example for wxTRANSLATE Since even the text itself acknowledged the example is bad, use another example that is not bad. --- interface/wx/translation.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/interface/wx/translation.h b/interface/wx/translation.h index abe020ff73..0da0e20c1b 100644 --- a/interface/wx/translation.h +++ b/interface/wx/translation.h @@ -466,29 +466,28 @@ public: initialization. Here is an example which should make it more clear: suppose that you have a - static array of strings containing the weekday names and which have to be - translated (note that it is a bad example, really, as wxDateTime already - can be used to get the localized week day names already). If you write: + static array of strings containing the names of chemical elements, which + have to be translated. If you write: @code - static const char * const weekdays[] = { _("Mon"), ..., _("Sun") }; + static const char * const elements[] = { _("Hydrogen"), _("Helium"), ... }; ... - // use weekdays[n] as usual + // use elements[n] as usual @endcode The code wouldn't compile because the function calls are forbidden in the array initializer. So instead you should do this: @code - static const char * const weekdays[] = { wxTRANSLATE("Mon"), ..., - wxTRANSLATE("Sun") }; + static const char * const elements[] = { wxTRANSLATE("Hydrogen"), + wxTRANSLATE("Helium"), ... }; ... - // use wxGetTranslation(weekdays[n]) + // use wxGetTranslation(elements[n]) @endcode Note that although the code @b would compile if you simply omit wxTRANSLATE() in the above, it wouldn't work as expected because there - would be no translations for the weekday names in the program message + would be no translations for the element names in the program message catalog and wxGetTranslation() wouldn't find them. @return A const wxChar*.