Function dropEncodingPart

Drop encoding part from locale (it's not used in constructing localized keys).

String dropEncodingPart(String) (
  String locale
) pure nothrow @safe
if (isSomeString!String && is(ElementEncodingType!String : char));

Returns

Locale string with encoding part dropped out or original string if encoding was not present.

Example

assert("ru_RU.UTF-8".dropEncodingPart() == "ru_RU");
string locale = "ru_RU";
assert(locale.dropEncodingPart() is locale);