Merge pull request #63629 from dsnopek/fix-locale-remap-with-binary-resources-3.x

[3.x] Fix locale resource remapping with binary conversion on export
This commit is contained in:
Rémi Verschelde 2022-08-08 20:03:56 +02:00 committed by GitHub
commit 8cec1c63c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -735,6 +735,8 @@ String ResourceLoader::_path_remap(const String &p_path, bool *r_translation_rem
// To find the path of the remapped resource, we extract the locale name after
// the last ':' to match the project locale.
// 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.");
@ -764,12 +766,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;