Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

I'll answer myself Smile

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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: What you didn't know about theide..
Next Topic: There are too short lines after synchronization. t files.
Goto Forum:
  


Current Time: Sat May 11 12:29:42 CEST 2024

Total time taken to generate the page: 0.02623 seconds