From 6bcb24f1b8c50c7be7cab2a4d18ea90cf56d4baf Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Thu, 3 Feb 2022 09:43:11 +0200 Subject: [PATCH] Add empty translation files to the exported app bundle, to allow translation detection by the OS. (cherry picked from commit 2eeff4caec00a9eec06919d35c3ea8d87322cd31) --- platform/osx/export/export.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 17dd60f490b..dd76ef72ffb 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -870,6 +870,24 @@ Error EditorExportPlatformOSX::export_project(const Ref &p_p err = tmp_app_dir->make_dir_recursive(tmp_app_path_name + "/Contents/Resources"); } + Vector translations = ProjectSettings::get_singleton()->get("locale/translations"); + if (translations.size() > 0) { + { + String fname = tmp_app_path_name + "/Contents/Resources/en.lproj"; + tmp_app_dir->make_dir_recursive(fname); + FileAccessRef f = FileAccess::open(fname + "/InfoPlist.strings", FileAccess::WRITE); + } + + 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); + } + } + } + // Now process our template. bool found_binary = false; Vector dylibs_found;