Home » U++ Library support » U++ Libraries and TheIDE: i18n, Unicode and Internationalization » Translation in static members
Re: Translation in static members [message #31113 is a reply to message #31112] |
Sat, 05 February 2011 18:38 |
|
dolik.rce wrote on Sat, 05 February 2011 19:29 | I'll answer myself
The simplest and probably correct solution is to use t_GetLngString() whenever using the static member, instead when initializing it:#include <Core/Core.h>
using namespace Upp;
#define TFILE <test/test.t>
#include <Core/t.h>
//simple shorthand, to keep code nice looking
#define _t(X) t_GetLngString(X)
struct test{
static const char* str;
};
const char* test::str=tt_("translation");
CONSOLE_APP_MAIN{
SetLanguage(GetSystemLNG());
test t;
DUMP(_t(t.str)); //<- added _t() to translate the string at runtime
}
The _t macro is quite handy thing. It would actually work with t_ as well, but that confuses theide when syncing the translations. Maybe there could be some shorthand for t_GetLngString added in the U++, what do you think?
Honza
|
This is very simple:
if you have static property than you can address only: ClassName::StaticPropertyName or from method of class by simple StaticPropertyName.
Hope if this help you!
|
|
|
Goto Forum:
Current Time: Sat May 11 15:29:29 CEST 2024
Total time taken to generate the page: 0.02870 seconds
|