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 #24304 is a reply to message #24302] Sat, 09 January 2010 21:39 Go to previous messageGo to previous message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
This one corrects a subtle bug and delays loading of strings (needed to setup properly the language) :
class StringTable : public Vector<String>
{
	public:
		StringTable &operator,(const char *s) { Add(s); return *this; }
		String operator[](int i) { ASSERT(i < GetCount()); return GetLngString(At(i)); }
};

#define STRINGTABLE(s) StringTable s; INITBLOCK { s,
#define ENDTABLE ; }


Stringtable must be defined with tt_ :

STRINGTABLE(Test)
    tt_("One"),
    tt_("Two"),
    tt_("Three")
ENDTABLE;


The tt_ macros are needed just to make theide export the translation; can be avoided if no need to sync translations.

Ciao

Max

[Updated on: Sun, 10 January 2010 01:46]

Report message to a moderator

 
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: Sun May 12 04:32:17 CEST 2024

Total time taken to generate the page: 0.02435 seconds