Translations:Development/FAQs/Technical FAQ/39/en: Difference between revisions

From KDE TechBase
(Importing a new version from external source)
 
(No difference)

Latest revision as of 17:40, 19 July 2019

Information about message (contribute)
This message has no documentation. If you know where or how this message is used, you can help other translators by adding documentation to this message.
Message definition (Development/FAQs/Technical FAQ)
If you do
<code>QString translatedStuff = i18n("foobar");</code> translatedStuff will contain the translation of "foobar", while for <code> const char *markedStuff = I18N_NOOP("foobar");</code> <tt>markedStuff</tt> will still contain literal "foobar", but translators will know you want "foobar" translated so you can later on do <code>QString translatedStuff = i18n(markedStuff);</code> and get the translation of "foobar", which wouldn't work without that I18N_NOOP. 
So, normally you want to just use i18n(), but in cases where you absolutely need to pass something untranslated, but still need to translate it later or in the case that you have something to be translated before the KInstance exists, use <code>I18N_NOOP()</code>.

If you do QString translatedStuff = i18n("foobar"); translatedStuff will contain the translation of "foobar", while for const char *markedStuff = I18N_NOOP("foobar"); markedStuff will still contain literal "foobar", but translators will know you want "foobar" translated so you can later on do QString translatedStuff = i18n(markedStuff); and get the translation of "foobar", which wouldn't work without that I18N_NOOP. So, normally you want to just use i18n(), but in cases where you absolutely need to pass something untranslated, but still need to translate it later or in the case that you have something to be translated before the KInstance exists, use I18N_NOOP().