Home » U++ Library support » U++ Libraries and TheIDE: i18n, Unicode and Internationalization » Translation in static members
Re: Translation in static members [message #31112 is a reply to message #31111] |
Sat, 05 February 2011 18: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
|
|
|
Goto Forum:
Current Time: Sat May 11 12:29:42 CEST 2024
Total time taken to generate the page: 0.02623 seconds
|