ResourceLoader: Add language code matching for localized resources

Near matching was not implemented like in TranslationServer, so a
resource remapped for 'ru' (but not 'ru_RU') would not be used as
fallback if the system locale was 'ru_RU'.

Fixes #34058.
This commit is contained in:
Rémi Verschelde
2019-12-04 16:50:43 +01:00
parent 0fcb68ffa1
commit 95242b7faf
2 changed files with 44 additions and 18 deletions

View File

@@ -1065,6 +1065,9 @@ StringName TranslationServer::translate(const StringName &p_message) const {
// form. If not found, we fall back to a near match (another locale with
// same language code).
// Note: ResourceLoader::_path_remap reproduces this locale near matching
// logic, so be sure to propagate changes there when changing things here.
StringName res;
String lang = get_language_code(locale);
bool near_match = false;