Georg Baum wrote:
>> - I copied the Alert message verbatim from another place. What do I have
>>    to do if I introduce new internationalized strings? Any suggestions
>>    for a better error message?
> 
> Simply enclose the string with _(). It will appear in the po files the
> next time they are updated. If it is a static string you have to do some
> tricks with _N() IIRC.

Being more explicit:

// N_(...) is a macro that does nothing at all.
// It is used as an identifier by an awk script to extract the string
// for translation by the gettext routines.
// We can't use _(...) here because the function will be called before
// the gettext routines are initialized. Ie, no translation will exist
// in the dataset map.
char const * const static_str = N_("my static string");

int main() {
    // initialise gettext
    ...

    // _(...) is a function that interogates the gettext library for
    // a string matching static_str, returning the translation.
    std::cout << _(static_str) << '\n';

    // gettext has been initialised, so we can combine both steps
    // in one.
    std::cout << _("my dynamic string") << '\n';    

    return 0;
}

-- 
Angus

Reply via email to