vibe.web.i18n

Internationalization/translation support for the web interface module.

Types 3

private structDeclString
Fields
string context
string key
string pluralKey
string value
string[] pluralValues
private structLangComponents
Fields
DeclString[] messages
string nplurals_expr
string plural_func_expr

Functions 17

fnTranslationContextAttribute!CONTEXT translationContext(CONTEXT)() @propertyAnnotates an interface method or class with translation information.
fnstring determineLanguageByHeader(T)(string accept_language, T allowed_languages) if (isForwardRange!T && is(ElementType!T : string) || is(T == typeof(only()))) @safe pure @nogcDetermines a language code from the value of a header string. Returns: The best match from the Accept-Language header for a language. `null` if there is no supported language.
fnstring determineLanguageByHeader(Tuple...)(string accept_language, Tuple allowed_languages) if (Tuple.length != 1 || is(Tuple[0] : string)) @safe pure @nogcditto
fnstring determineLanguageByHeader(T)(HTTPServerRequest req, T allowed_languages) if (isForwardRange!T && is(ElementType!T : string) || is(T == typeof(only()))) @safe pureditto
fnstring determineLanguageByHeader(Tuple...)(HTTPServerRequest req, Tuple allowed_languages) if (Tuple.length != 1 || is(Tuple[0] : string)) @safe pureditto
fnstring determineLanguage(alias METHOD)(scope HTTPServerRequest req)
private fnsize_t skipToDirective(size_t i, ref string text)
private fnsize_t skipWhitespace(size_t i, ref string text)
private fnsize_t skipLine(size_t i, ref string text)
private fnsize_t skipString(size_t i, ref string text)
private fnsize_t skipIndex(size_t i, ref string text)
private fnstring wrapText(string str)
private fnstring parse_nplurals(string msgstr)
private fnstring parse_plural_expression(string msgstr)
private fnstring dstringUnescape(in string str)
private fnstring locationString(size_t i, string text)

Templates 3

tmpllanguageSeq(CTX)
tmpltr(CTX, string LANG)

Performs the string translation for a statically given language.

The second overload takes a plural form and a number to select from a set of translations based on the plural forms of the target language.

Functions
string tr(string key, string context = null)
string tr(string key, string key_plural, int n, string context = null)
tmplGetTranslationContext(alias METHOD)