Strings.getEncoded

Get the text for id according to the user's preferred language(s).

  1. template getEncoded(string id, S, string file = __FILE__, uint line = __LINE__)
  2. template getEncoded(string id, S)
  3. S getEncoded()
    struct Strings()
    version(D_Ddoc)
    pure nothrow @safe @nogc static
    S
    getEncoded
    (
    string id
    S
    )
    ()

Parameters

id

identifier of string resource (the name attribute)

S

encoding for returned string, either string, wstring or dstring Complexity: O(1). The upper bound is proportional to the number of translations provided at compile-time. The number of string resources does not affect runtime.

Examples

void main()
{
    import std.stdio, i18n.text;
    writeln(strings.hello_world); // Default encoding
    writeln(strings.getEncoded!("hello_world", wstring)); // UTF-16
}

Meta