Skip to content

Commit

Permalink
Merge pull request #628 from Shallowmallow/LocaleFix
Browse files Browse the repository at this point in the history
Fusion locales only when getting String
  • Loading branch information
ianharrigan authored Sep 2, 2024
2 parents 79873fe + 19d1be9 commit 8a501e3
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions haxe/ui/locale/LocaleManager.hx
Original file line number Diff line number Diff line change
Expand Up @@ -256,33 +256,25 @@ class LocaleManager {
}
stringMap.set(k, v);
}

localeId = StringTools.replace(localeId, "-", "_");
var parts = localeId.split("_");
if (parts.length > 1) {
var parent = _localeMap.get(parts[0]);
if (parent != null) {
for (k in parent.keys()) {
if (stringMap.exists(k) == false) {
stringMap.set(k, parent.get(k));
}
}
}
}
}

private function getStrings(localeId:String):Map<String, String> {
var strings = _localeMap.get(localeId);
if (strings != null) {
return strings;
}

localeId = StringTools.replace(localeId, "-", "_");
var parts = localeId.split("_");
if (!_localeMap.exists(parts[0])) {
return _localeMap.get("en");
}
return _localeMap.get(parts[0]);

var parentLocale = _localeMap.get(parts[0]);
var locale = _localeMap.get(parts[0]);

var mergedLocale:Map<String, String> = new Map();
mergedLocale = parentLocale.copy();
for (k in locale.keys()) {
var v = locale.get(k);
mergedLocale.set(k, v);
}
return mergedLocale;
}

public function hasString(id:String):Bool {
Expand Down

0 comments on commit 8a501e3

Please sign in to comment.