On Monday 19 January 2015 14:42:13 Chusslove Illich wrote:
> > [: Milian Wolff :]
> > Do I really need to store I18N_NOOP2_NOSTRIP and use that with
> > 
> >   i18nc(asdf.context, asdf.translatedString, foo, bar)
> > 
> > then? Or is there a better way, where it would be enough to store a
> > QString in my static data structure? Or is this not possible b/c the
> > translation might be scripted or something like that?
> 
> You could use ki18n* series of functions, which return KLocalizedString,
> which is a "non-finalized" translation. To construct:
> 
>   asdf.translatedString = ki18nc("some context", "some text %1 (%2)");
> 
> and later to substitute arguments and get QString:
> 
>   asdf.translatedString.subs(foo).subs(bar).toString()
> 
> The actual translation lookup and argument substitution all happen in
> toString and in one pass, so this works as expected wrt. early construction
> (e.g. before KLocalizedString::setApplicationDomain is called) and wrt.
> arguments themselves containing placeholder-like sequences (e.g. if foo
> above contained %1).

Thanks! Exactly what I needed.

Bye

-- 
Milian Wolff
m...@milianw.de
http://milianw.de

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

Reply via email to