IniLikeGroup.localizedValue

Perform locale matching lookup as described in Localized values for keys.

class IniLikeGroup
@safe const nothrow
string
localizedValue
(
string key
,
string locale
,
string defaultValue = null
)

Return Value

Type: string

the localized value associated with key and locale, or defaultValue if group does not contain item with this key.

Examples

auto lilf = new IniLikeFile;
lilf.addGroup("Entry");
auto group = lilf.group("Entry");
assert(group.name == "Entry"); 
group["Name"] = "Programmer";
group["Name[ru_RU]"] = "Разработчик";
group["Name[ru@jargon]"] = "Кодер";
group["Name[ru]"] = "Программист";
group["Name[de_DE@dialect]"] = "Programmierer"; //just example
group["GenericName"] = "Program";
group["GenericName[ru]"] = "Программа";
assert(group["Name"] == "Programmer");
assert(group.localizedValue("Name", "ru@jargon") == "Кодер");
assert(group.localizedValue("Name", "ru_RU@jargon") == "Разработчик");
assert(group.localizedValue("Name", "ru") == "Программист");
assert(group.localizedValue("Name", "nonexistent locale") == "Programmer");
assert(group.localizedValue("Name", "de_DE@dialect") == "Programmierer");
assert(group.localizedValue("GenericName", "ru_RU") == "Программа");

See Also

currentLocale

Meta