original locale to match to
first key locale, can be empty
second key locale, can be empty
a locale which is considered a better alternative or an empty string if none of alternatives match the provided locale. Note: Empty locale is considered a better choice than a locale that does not match the original one.
string locale = "ru_RU.UTF-8@jargon"; assert(selectKeyLocale(string.init, "ru_RU", "ru@jargon") == string.init); assert(selectKeyLocale(locale, "fr_FR", string.init) == string.init); assert(selectKeyLocale(locale, string.init, "de_DE") == string.init); assert(selectKeyLocale(locale, "fr_FR", "de_DE") == string.init); assert(selectKeyLocale(locale, "ru", string.init) == "ru"); assert(selectKeyLocale(locale, "ru", "ru@jargon") == "ru@jargon"); assert(selectKeyLocale(locale, "ru_RU", string.init) == "ru_RU"); assert(selectKeyLocale(locale, "ru_RU", "ru") == "ru_RU"); assert(selectKeyLocale(locale, "ru_RU", "ru@jargon") == "ru_RU"); assert(selectKeyLocale(locale, "ru_RU", "ru_RU@jargon") == "ru_RU@jargon"); assert(selectKeyLocale("en_US.UTF-8", "en", "en_GB") == "en"); assert(selectKeyLocale("en_US.UTF-8", string.init, "en_GB") == string.init);
Between two key locales (i.e. locales found in keys of .ini-like file) select a better match for the provided locale. The "goodness" is determined using algorithm described in Localized values for keys.