trWeb

Translates text based on the language of the current web request.

The first overload performs a direct translation of the given translation key/text. The second overload can select from a set of plural forms based on the given integer value (msgid_plural).

  1. string trWeb(string text, string context)
    @safe
    string
    trWeb
    (
    string text
    ,
    string context = null
    )
  2. string trWeb(string text, string plural_text, int count, string context)

Parameters

text string

The translation key

context string

Optional context/namespace identifier (msgctxt)

Examples

struct TRC {
	import std.typetuple;
	alias languages = TypeTuple!("en_US", "de_DE", "fr_FR");
	//mixin translationModule!"test";
}

@translationContext!TRC
class WebService {
	void index(HTTPServerResponse res)
	{
		res.writeBody(trWeb("This text will be translated!"));
	}
}

See Also

Meta