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 » Developing U++ » U++ Developers corner » Helper for internazionalize arrays of literals
Re: Helper for internazionalize arrays of literals [message #24325 is a reply to message #24310] Mon, 11 January 2010 08:25 Go to previous messageGo to previous message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
luzr wrote on Sun, 10 January 2010 14:40

BTW, there IMO could be even more effective solutions. E.g.:

#include <Core/Core.h>

using namespace Upp;

struct tt_char {
	const char *s;

	String ToString() const       { return GetLngString(s); }
	operator const char *() const { return ToString(); }
};

CONSOLE_APP_MAIN
{
	static tt_char x[] = {
		tt_("Aborted by user."),
		tt_("Two"),
		tt_("Three")
	};
	
	SetLanguage(LNG_('I','T','I','T'));
	DDUMP(x[0]);
}




mhhhh.... right, yours is much better. I was wrongly thinking that wasn't possible to use a static initializer with a class.
BTW, imho it's worth the trouble because you don't need to remember using the GetLngString on every places you need it... More, with your solution you prcatically don't have any overhead to achieve this.

Ciao

Max
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: GCC compilation options
Next Topic: Template class factory
Goto Forum:
  


Current Time: Sat May 11 15:57:22 CEST 2024

Total time taken to generate the page: 0.02164 seconds