On Wed, Sep 17, 2003 at 02:15:35PM +0100, Angus Leeming spake thusly:
> 
> Martin Vermeer wrote:

...

> > 
> > Like this?
> 
> No, because this is code executed when the xformsBC constructor is 
> invoked.
>  xformsBC(ButtonController const &,
> -                string const & = _("Cancel"), string const & = _("Close"));
> +                string const & = N_("Cancel"), string const & = N_("Close"));
> 
> ie
> void foo() {
>         ButtonController const & bc = ...;
>         xformsBC xbc(bc);
> }
> will result in calls to the 'string const _(string const &);' 
> function, passing args "Cancel" and "Close".
> 
> To continue. This results in output to screen of 'hello'
> 
> string str = _("hello");
> void foo() {
>         std::cout << str << std::endl;
> }
> 
> For reasons I don't follow, _(...) does not work on static strings.
> 
> 
> This will also output 'hello'
> 
> string str = "hello";
> void foo() {
>         std::cout << _(str) << std::endl;
> }
> 
> The scripts that extract the string for translation in the po 
> database won't find the contents of str.
> 
> This, however, will print out 'bonjour' if LANG=fr_FR and a .gmo 
> file existed
> string str = N_("hello");
> void foo() {
>         std::cout << _(str) << std::endl;
> }
> 
> D'ya follow?
> N_(...) is simply an identifier used to extract the translatable 
> strings by the po scripts. Someone comes along and fills in the 
> translation. Thereater _("hello") will result in the gettext 
> machinary finding the translation for "hello" and returning that as 
> the output from _(...).
> 
> 
> Angus
 
Yes, I know how gettext works -- I did the first Dutch and Finnish
translations remember? But I still don't get what Lars wanted
me to do. Please bend it in copperwire for me. Remember I'm a little
dumb :-)

- Martin 

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to