Fix locale resource remapping with binary conversion on export

(cherry picked from commit 0cf4ba0d84)
This commit is contained in:
David Snopek 2022-07-29 09:30:29 -05:00 committed by Rémi Verschelde
parent 6426f2e9c7
commit 81fa7abb40
1 changed files with 4 additions and 4 deletions

View File

@ -724,6 +724,8 @@ String ResourceLoader::_path_remap(const String &p_path, bool *r_translation_rem
// We also fall back in case of regional locales as done in TranslationServer::translate
// (e.g. 'ru_RU' -> 'ru' if the former has no specific mapping).
// An extra remap may still be necessary afterwards due to the text -> binary converter on export.
String locale = TranslationServer::get_singleton()->get_locale();
ERR_FAIL_COND_V_MSG(locale.length() < 2, p_path, "Could not remap path '" + p_path + "' for translation as configured locale '" + locale + "' is invalid.");
String lang = TranslationServer::get_language_code(locale);
@ -763,12 +765,10 @@ String ResourceLoader::_path_remap(const String &p_path, bool *r_translation_rem
if (path_remaps.has(new_path)) {
new_path = path_remaps[new_path];
}
if (new_path == p_path) { // Did not remap.
} else {
// Try file remap.
Error err;
FileAccess *f = FileAccess::open(p_path + ".remap", FileAccess::READ, &err);
FileAccess *f = FileAccess::open(new_path + ".remap", FileAccess::READ, &err);
if (f) {
VariantParser::StreamFile stream;