Re: [Widelands-public] GetText _() macro and #ifdef
Status: Beta
Brought to you by:
sirver
From: Nicolai H. <pre...@gm...> - 2010-04-22 09:43:35
|
On Wednesday 21 April 2010 21:47:32 Jari Hautio wrote: > Hi All! > > I have small request for everyone: please do not use #ifdefs inside > internalization macro _(). Otherwise it breaks visual studio build. > > For example following code breaks the build: > std::cout << > _("first line\n" > #ifdef FOOBAR > "Conditional line\n" > #endif > "last line\n"); That could would also break the translation itself, wouldn't it? So it's really not just a matter of compiler compatibility, but of making sure that translated strings are always the same. cu, Nicolai > > Using separate macro for conditionally built part works: > std::cout > << _("first line\n") > #ifdef FOOBAR > << _("Conditional line\n") > #endif > << _("last line\n"); > > As an added benefit, translation units now nicely follow the logic in > ifdefs. > > Cheers, > Jari > > --------------------------------------------------------------------------- > --- _______________________________________________ > Widelands-public mailing list > Wid...@li... > https://lists.sourceforge.net/lists/listinfo/widelands-public > -- Lerne, wie die Welt wirklich ist, aber vergiss niemals, wie sie sein sollte. |