Support » Everything else WordPress » Internationalization / Localization and gettext

  • This isn’t a question about WordPress, but about one of its components: gettext. That’s the localization framework that drives all of the translations printed by the __() and _e() functions.

    My question is about how gettext expects its input — if I’m developing in German for example, can I wrap my German messages using this function? Or do the “original” messages always need to be in English?

    Some translation engines work based off of a number, e.g. error #123 gets looked up in the English, German, or Japanese file and prints the translated message corresponding to “123”. But from what I’ve read about gettext it seems that it uses English as the common denominator. Is that true? Does anyone know?

Viewing 1 replies (of 1 total)
  • For the record, gettext basically uses “message ids”, so if you happen to be writing your messages in German, then that’s treated as a unique message identifier (in the same way that an error code or message #123 is treated as a message identifier).

    What that means is that the messages passed to the __() functions are language agnostic. All of those identifiers will appear in your language .pot file, and they are language agnostic UNTIL you actually translate them into a .po file. Now, in practice, those message identifiers are in your native language, so the act of “translating” your identifiers from your .pot file to your locale’s .po file is nothing more than copying and pasting.

    This means you can rely on gettext and use any language you want to identify your messages.

Viewing 1 replies (of 1 total)
  • The topic ‘Internationalization / Localization and gettext’ is closed to new replies.