currentLocale

Retrieve current locale probing environment variables LC_TYPE, LC_ALL and LANG (in this order)

@safe nothrow
string
currentLocale
()

Return Value

Type: string

locale in posix form or an empty string if could not determine locale. Note: this function does not cache its results.

Examples

if (environment.get("CI") != "true") { //for some reason it can't set environment variables in Travis CI
    environment["LANG"] = "ru_RU";
    assert(currentLocale() == "ru_RU");
    environment["LC_ALL"] = "de_DE";
    assert(currentLocale() == "de_DE");
    environment["LC_CTYPE"] = "fr_BE";
    assert(currentLocale() == "fr_BE");
}

Meta