PIP 5.6.1
Platform-Independent Primitives
Static Public Member Functions | Related Functions | List of all members
PITranslator Class Reference

Translation support. More...

#include <pitranslator.h>

Static Public Member Functions

static PIString tr (const PIString &in, const PIString &context={})
 Returns translated string for "in" in optional "context".
 
static PIString tr (const char *in, const PIString &context={})
 Converts UTF-8 string literal to PIString and translates it.
 
static PIString trNoOp (const PIString &in, const PIString &context={})
 Marks string for translation-aware code paths and returns it unchanged.
 
static PIString trNoOp (const char *in, const PIString &context={})
 UTF-8 overload of trNoOp().
 
static void clear ()
 Clears all loaded translations.
 
static void loadLang (const PIString &short_lang, PIString dir={})
 Clears current translations and loads language files matching "short_lang" from "dir".
 
static void loadConfig (const PIString &content)
 Loads translations from textual configuration content.
 
static bool load (const PIByteArray &content)
 Loads translations from binary content in PIP translation format.
 
static bool loadFile (const PIString &path)
 Loads translations from file and checks its translation header.
 

Related Functions

(Note that these are not member functions.)

#define piTr
 Alias to PITranslator::tr().
 
#define piTrNoOp
 Alias to PITranslator::trNoOp().
 

Detailed Description

Translation support.

Provides translation support with context-aware string wrappers and multiple loading methods. PITranslator stores loaded translations in a process-wide singleton. If translation or context is missing, the source string is returned unchanged.

Synopsis