diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 7f542fd961c..79cdbc9dd41 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -666,26 +666,37 @@ void EditorExportPlatformIOS::_fix_config_file(const Ref &p_ String locale_files; Vector translations = ProjectSettings::get_singleton()->get("locale/translations"); if (translations.size() > 0) { + Set languages; for (int j = 0; j < translations.size(); j++) { Ref tr = ResourceLoader::load(translations[j]); - if (tr.is_valid()) { - String lang = tr->get_locale(); - locale_files += "D0BCFE4518AEBDA2004A" + itos(j).pad_zeros(4) + " /* " + lang + " */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = " + lang + "; path = " + lang + ".lproj/InfoPlist.strings; sourceTree = \"\"; };"; + if (tr.is_valid() && tr->get_locale() != "en") { + languages.insert(tr->get_locale()); } } + int index = 0; + for (const Set::Element *E = languages.front(); E; E = E->next()) { + const String &lang = E->get(); + locale_files += "D0BCFE4518AEBDA2004A" + itos(index).pad_zeros(4) + " /* " + lang + " */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = " + lang + "; path = " + lang + ".lproj/InfoPlist.strings; sourceTree = \"\"; };\n"; + index++; + } } strnew += lines[i].replace("$pbx_locale_file_reference", locale_files); } else if (lines[i].find("$pbx_locale_build_reference") != -1) { String locale_files; Vector translations = ProjectSettings::get_singleton()->get("locale/translations"); if (translations.size() > 0) { + Set languages; for (int j = 0; j < translations.size(); j++) { Ref tr = ResourceLoader::load(translations[j]); - if (tr.is_valid()) { - String lang = tr->get_locale(); - locale_files += "D0BCFE4518AEBDA2004A" + itos(j).pad_zeros(4) + " /* " + lang + " */,"; + if (tr.is_valid() && tr->get_locale() != "en") { + languages.insert(tr->get_locale()); } } + int index = 0; + for (const Set::Element *E = languages.front(); E; E = E->next()) { + locale_files += "D0BCFE4518AEBDA2004A" + itos(index).pad_zeros(4) + " /* " + E->get() + " */,\n"; + index++; + } } strnew += lines[i].replace("$pbx_locale_build_reference", locale_files); } else if (lines[i].find("$swift_runtime_migration") != -1) { @@ -1957,16 +1968,20 @@ Error EditorExportPlatformIOS::export_project(const Ref &p_p f->store_line("CFBundleDisplayName = \"" + ProjectSettings::get_singleton()->get("application/config/name").operator String() + "\";"); } - for (int i = 0; i < translations.size(); i++) { - Ref tr = ResourceLoader::load(translations[i]); - if (tr.is_valid()) { - String fname = dest_dir + binary_name + "/" + tr->get_locale() + ".lproj"; - tmp_app_path->make_dir_recursive(fname); - FileAccessRef f = FileAccess::open(fname + "/InfoPlist.strings", FileAccess::WRITE); - String prop = "application/config/name_" + tr->get_locale(); - if (ProjectSettings::get_singleton()->has_setting(prop)) { - f->store_line("CFBundleDisplayName = \"" + ProjectSettings::get_singleton()->get(prop).operator String() + "\";"); - } + Set languages; + for (int j = 0; j < translations.size(); j++) { + Ref tr = ResourceLoader::load(translations[j]); + if (tr.is_valid() && tr->get_locale() != "en") { + languages.insert(tr->get_locale()); + } + } + for (const Set::Element *E = languages.front(); E; E = E->next()) { + String fname = dest_dir + binary_name + "/" + E->get() + ".lproj"; + tmp_app_path->make_dir_recursive(fname); + FileAccessRef f = FileAccess::open(fname + "/InfoPlist.strings", FileAccess::WRITE); + String prop = "application/config/name_" + E->get(); + if (ProjectSettings::get_singleton()->has_setting(prop)) { + f->store_line("CFBundleDisplayName = \"" + ProjectSettings::get_singleton()->get(prop).operator String() + "\";"); } } } diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 736c6ab01de..389118c1510 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -897,16 +897,20 @@ Error EditorExportPlatformOSX::export_project(const Ref &p_p f->store_line("CFBundleDisplayName = \"" + ProjectSettings::get_singleton()->get("application/config/name").operator String() + "\";"); } - for (int i = 0; i < translations.size(); i++) { - Ref tr = ResourceLoader::load(translations[i]); - if (tr.is_valid()) { - String fname = tmp_app_path_name + "/Contents/Resources/" + tr->get_locale() + ".lproj"; - tmp_app_dir->make_dir_recursive(fname); - FileAccessRef f = FileAccess::open(fname + "/InfoPlist.strings", FileAccess::WRITE); - String prop = "application/config/name_" + tr->get_locale(); - if (ProjectSettings::get_singleton()->has_setting(prop)) { - f->store_line("CFBundleDisplayName = \"" + ProjectSettings::get_singleton()->get(prop).operator String() + "\";"); - } + Set languages; + for (int j = 0; j < translations.size(); j++) { + Ref tr = ResourceLoader::load(translations[j]); + if (tr.is_valid() && tr->get_locale() != "en") { + languages.insert(tr->get_locale()); + } + } + for (const Set::Element *E = languages.front(); E; E = E->next()) { + String fname = tmp_app_path_name + "/Contents/Resources/" + E->get() + ".lproj"; + tmp_app_dir->make_dir_recursive(fname); + FileAccessRef f = FileAccess::open(fname + "/InfoPlist.strings", FileAccess::WRITE); + String prop = "application/config/name_" + E->get(); + if (ProjectSettings::get_singleton()->has_setting(prop)) { + f->store_line("CFBundleDisplayName = \"" + ProjectSettings::get_singleton()->get(prop).operator String() + "\";"); } } }