mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
unordered_map for locale, and const functions where possible
This commit is contained in:
+4
-4
@@ -77,16 +77,16 @@ String identity(const String& key) {
|
||||
return key;
|
||||
}
|
||||
|
||||
String SubLocale::tr(const String& key, DefaultLocaleFun def) {
|
||||
map<String,String>::const_iterator it = translations.find(canonical_name_form(key));
|
||||
String SubLocale::tr(const String& key, DefaultLocaleFun def) const {
|
||||
auto it = translations.find(canonical_name_form(key));
|
||||
if (it == translations.end()) {
|
||||
return def(key);
|
||||
} else {
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
String SubLocale::tr(const String& subcat, const String& key, DefaultLocaleFun def) {
|
||||
map<String,String>::const_iterator it = translations.find(subcat + _("_") + canonical_name_form(key));
|
||||
String SubLocale::tr(const String& subcat, const String& key, DefaultLocaleFun def) const {
|
||||
auto it = translations.find(subcat + _("_") + canonical_name_form(key));
|
||||
if (it == translations.end()) {
|
||||
return def(key);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user