You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
[macOS / iOS Export] Fix generation of duplicate locale property list files.
This commit is contained in:
@@ -387,13 +387,17 @@ void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_
|
|||||||
String locale_files;
|
String locale_files;
|
||||||
Vector<String> translations = ProjectSettings::get_singleton()->get("internationalization/locale/translations");
|
Vector<String> translations = ProjectSettings::get_singleton()->get("internationalization/locale/translations");
|
||||||
if (translations.size() > 0) {
|
if (translations.size() > 0) {
|
||||||
int index = 0;
|
HashSet<String> languages;
|
||||||
for (const String &E : translations) {
|
for (const String &E : translations) {
|
||||||
Ref<Translation> tr = ResourceLoader::load(E);
|
Ref<Translation> tr = ResourceLoader::load(E);
|
||||||
if (tr.is_valid()) {
|
if (tr.is_valid() && tr->get_locale() != "en") {
|
||||||
String lang = tr->get_locale();
|
languages.insert(tr->get_locale());
|
||||||
locale_files += "D0BCFE4518AEBDA2004A" + itos(index).pad_zeros(4) + " /* " + lang + " */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = " + lang + "; path = " + lang + ".lproj/InfoPlist.strings; sourceTree = \"<group>\"; };";
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
for (const String &lang : languages) {
|
||||||
|
locale_files += "D0BCFE4518AEBDA2004A" + itos(index).pad_zeros(4) + " /* " + lang + " */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = " + lang + "; path = " + lang + ".lproj/InfoPlist.strings; sourceTree = \"<group>\"; };\n";
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -402,13 +406,17 @@ void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_
|
|||||||
String locale_files;
|
String locale_files;
|
||||||
Vector<String> translations = ProjectSettings::get_singleton()->get("internationalization/locale/translations");
|
Vector<String> translations = ProjectSettings::get_singleton()->get("internationalization/locale/translations");
|
||||||
if (translations.size() > 0) {
|
if (translations.size() > 0) {
|
||||||
int index = 0;
|
HashSet<String> languages;
|
||||||
for (const String &E : translations) {
|
for (const String &E : translations) {
|
||||||
Ref<Translation> tr = ResourceLoader::load(E);
|
Ref<Translation> tr = ResourceLoader::load(E);
|
||||||
if (tr.is_valid()) {
|
if (tr.is_valid() && tr->get_locale() != "en") {
|
||||||
String lang = tr->get_locale();
|
languages.insert(tr->get_locale());
|
||||||
locale_files += "D0BCFE4518AEBDA2004A" + itos(index).pad_zeros(4) + " /* " + lang + " */,";
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
for (const String &lang : languages) {
|
||||||
|
locale_files += "D0BCFE4518AEBDA2004A" + itos(index).pad_zeros(4) + " /* " + lang + " */,\n";
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1651,10 +1659,15 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
|
|||||||
f->store_line("NSPhotoLibraryUsageDescription = \"" + p_preset->get("privacy/photolibrary_usage_description").operator String() + "\";");
|
f->store_line("NSPhotoLibraryUsageDescription = \"" + p_preset->get("privacy/photolibrary_usage_description").operator String() + "\";");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HashSet<String> languages;
|
||||||
for (const String &E : translations) {
|
for (const String &E : translations) {
|
||||||
Ref<Translation> tr = ResourceLoader::load(E);
|
Ref<Translation> tr = ResourceLoader::load(E);
|
||||||
if (tr.is_valid()) {
|
if (tr.is_valid() && tr->get_locale() != "en") {
|
||||||
String lang = tr->get_locale();
|
languages.insert(tr->get_locale());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const String &lang : languages) {
|
||||||
String fname = dest_dir + binary_name + "/" + lang + ".lproj";
|
String fname = dest_dir + binary_name + "/" + lang + ".lproj";
|
||||||
tmp_app_path->make_dir_recursive(fname);
|
tmp_app_path->make_dir_recursive(fname);
|
||||||
Ref<FileAccess> f = FileAccess::open(fname + "/InfoPlist.strings", FileAccess::WRITE);
|
Ref<FileAccess> f = FileAccess::open(fname + "/InfoPlist.strings", FileAccess::WRITE);
|
||||||
@@ -1674,7 +1687,6 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Copy project static libs to the project
|
// Copy project static libs to the project
|
||||||
Vector<Ref<EditorExportPlugin>> export_plugins = EditorExport::get_singleton()->get_export_plugins();
|
Vector<Ref<EditorExportPlugin>> export_plugins = EditorExport::get_singleton()->get_export_plugins();
|
||||||
|
|||||||
@@ -919,10 +919,15 @@ Error EditorExportPlatformMacOS::export_project(const Ref<EditorExportPreset> &p
|
|||||||
f->store_line("NSHumanReadableCopyright = \"" + p_preset->get("application/copyright").operator String() + "\";");
|
f->store_line("NSHumanReadableCopyright = \"" + p_preset->get("application/copyright").operator String() + "\";");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HashSet<String> languages;
|
||||||
for (const String &E : translations) {
|
for (const String &E : translations) {
|
||||||
Ref<Translation> tr = ResourceLoader::load(E);
|
Ref<Translation> tr = ResourceLoader::load(E);
|
||||||
if (tr.is_valid()) {
|
if (tr.is_valid() && tr->get_locale() != "en") {
|
||||||
String lang = tr->get_locale();
|
languages.insert(tr->get_locale());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const String &lang : languages) {
|
||||||
String fname = tmp_app_path_name + "/Contents/Resources/" + lang + ".lproj";
|
String fname = tmp_app_path_name + "/Contents/Resources/" + lang + ".lproj";
|
||||||
tmp_app_dir->make_dir_recursive(fname);
|
tmp_app_dir->make_dir_recursive(fname);
|
||||||
Ref<FileAccess> f = FileAccess::open(fname + "/InfoPlist.strings", FileAccess::WRITE);
|
Ref<FileAccess> f = FileAccess::open(fname + "/InfoPlist.strings", FileAccess::WRITE);
|
||||||
@@ -969,7 +974,6 @@ Error EditorExportPlatformMacOS::export_project(const Ref<EditorExportPreset> &p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Now process our template.
|
// Now process our template.
|
||||||
bool found_binary = false;
|
bool found_binary = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user