Function selectLocalizedValue
Same as selectKeyLocale
, but returns a locale bundled with a value in one tuple.
auto auto selectLocalizedValue(String)
(
scope String locale,
String firstLocale,
String firstValue,
String secondLocale,
String secondValue
) pure nothrow @nogc @trusted
if (isSomeString!String && is(ElementEncodingType!String : char));
Example
string locale = "ru_RU.UTF-8@jargon";
assert(selectLocalizedValue(string .init, "ru_RU", "Программист", "ru@jargon", "Кодер") == tuple(string .init, string .init));
assert(selectLocalizedValue(locale, "fr_FR", "Programmeur", string .init, "Programmer") == tuple(string .init, "Programmer"));
assert(selectLocalizedValue(locale, string .init, "Programmer", "de_DE", "Programmierer") == tuple(string .init, "Programmer"));
assert(selectLocalizedValue(locale, "fr_FR", "Programmeur", "de_DE", "Programmierer") == tuple(string .init, string .init));
assert(selectLocalizedValue(string .init, string .init, "Value", string .init, string .init) == tuple(string .init, "Value"));
assert(selectLocalizedValue(locale, string .init, "Value", string .init, string .init) == tuple(string .init, "Value"));
assert(selectLocalizedValue(locale, string .init, string .init, string .init, "Value") == tuple(string .init, "Value"));
assert(selectLocalizedValue(locale, "ru_RU", "Программист", "ru@jargon", "Кодер") == tuple("ru_RU", "Программист"));
assert(selectLocalizedValue(locale, "ru_RU", "Программист", "ru_RU@jargon", "Кодер") == tuple("ru_RU@jargon", "Кодер"));
assert(selectLocalizedValue(locale, "ru", "Разработчик", "ru_RU", "Программист") == tuple("ru_RU", "Программист"));