Make progress and errors translatable when exporting to Android
This commit is contained in:
parent
02967a9c5e
commit
55b52341d1
1 changed files with 29 additions and 30 deletions
|
@ -1876,12 +1876,12 @@ public:
|
||||||
|
|
||||||
device_lock.lock();
|
device_lock.lock();
|
||||||
|
|
||||||
EditorProgress ep("run", "Running on " + devices[p_device].name, 3);
|
EditorProgress ep("run", vformat(TTR("Running on %s"), devices[p_device].name), 3);
|
||||||
|
|
||||||
String adb = get_adb_path();
|
String adb = get_adb_path();
|
||||||
|
|
||||||
// Export_temp APK.
|
// Export_temp APK.
|
||||||
if (ep.step("Exporting APK...", 0)) {
|
if (ep.step(TTR("Exporting APK..."), 0)) {
|
||||||
device_lock.unlock();
|
device_lock.unlock();
|
||||||
return ERR_SKIP;
|
return ERR_SKIP;
|
||||||
}
|
}
|
||||||
|
@ -1918,7 +1918,7 @@ public:
|
||||||
String package_name = p_preset->get("package/unique_name");
|
String package_name = p_preset->get("package/unique_name");
|
||||||
|
|
||||||
if (remove_prev) {
|
if (remove_prev) {
|
||||||
if (ep.step("Uninstalling...", 1)) {
|
if (ep.step(TTR("Uninstalling..."), 1)) {
|
||||||
CLEANUP_AND_RETURN(ERR_SKIP);
|
CLEANUP_AND_RETURN(ERR_SKIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1935,7 +1935,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
print_line("Installing to device (please wait...): " + devices[p_device].name);
|
print_line("Installing to device (please wait...): " + devices[p_device].name);
|
||||||
if (ep.step("Installing to device, please wait...", 2)) {
|
if (ep.step(TTR("Installing to device, please wait..."), 2)) {
|
||||||
CLEANUP_AND_RETURN(ERR_SKIP);
|
CLEANUP_AND_RETURN(ERR_SKIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1950,7 +1950,7 @@ public:
|
||||||
err = OS::get_singleton()->execute(adb, args, true, nullptr, &output, &rv, true);
|
err = OS::get_singleton()->execute(adb, args, true, nullptr, &output, &rv, true);
|
||||||
print_verbose(output);
|
print_verbose(output);
|
||||||
if (err || rv != 0) {
|
if (err || rv != 0) {
|
||||||
EditorNode::add_io_error("Could not install to device: " + output);
|
EditorNode::add_io_error(vformat(TTR("Could not install to device: %s"), output));
|
||||||
CLEANUP_AND_RETURN(ERR_CANT_CREATE);
|
CLEANUP_AND_RETURN(ERR_CANT_CREATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2006,7 +2006,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ep.step("Running on device...", 3)) {
|
if (ep.step(TTR("Running on device..."), 3)) {
|
||||||
CLEANUP_AND_RETURN(ERR_SKIP);
|
CLEANUP_AND_RETURN(ERR_SKIP);
|
||||||
}
|
}
|
||||||
args.clear();
|
args.clear();
|
||||||
|
@ -2028,7 +2028,7 @@ public:
|
||||||
err = OS::get_singleton()->execute(adb, args, true, nullptr, &output, &rv, true);
|
err = OS::get_singleton()->execute(adb, args, true, nullptr, &output, &rv, true);
|
||||||
print_verbose(output);
|
print_verbose(output);
|
||||||
if (err || rv != 0) {
|
if (err || rv != 0) {
|
||||||
EditorNode::add_io_error("Could not execute on device.");
|
EditorNode::add_io_error(TTR("Could not execute on device."));
|
||||||
CLEANUP_AND_RETURN(ERR_CANT_CREATE);
|
CLEANUP_AND_RETURN(ERR_CANT_CREATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2690,7 +2690,7 @@ public:
|
||||||
String apksigner = get_apksigner_path();
|
String apksigner = get_apksigner_path();
|
||||||
print_verbose("Starting signing of the " + export_label + " binary using " + apksigner);
|
print_verbose("Starting signing of the " + export_label + " binary using " + apksigner);
|
||||||
if (!FileAccess::exists(apksigner)) {
|
if (!FileAccess::exists(apksigner)) {
|
||||||
EditorNode::add_io_error("'apksigner' could not be found.\nPlease check the command is available in the Android SDK build-tools directory.\nThe resulting " + export_label + " is unsigned.");
|
EditorNode::add_io_error(vformat(TTR("'apksigner' could not be found.\nPlease check the command is available in the Android SDK build-tools directory.\nThe resulting %s is unsigned."), export_label));
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2708,7 +2708,7 @@ public:
|
||||||
user = EditorSettings::get_singleton()->get("export/android/debug_keystore_user");
|
user = EditorSettings::get_singleton()->get("export/android/debug_keystore_user");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ep.step("Signing debug " + export_label + "...", 104)) {
|
if (ep.step(vformat(TTR("Signing debug %s..."), export_label), 104)) {
|
||||||
return ERR_SKIP;
|
return ERR_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2717,13 +2717,13 @@ public:
|
||||||
password = release_password;
|
password = release_password;
|
||||||
user = release_username;
|
user = release_username;
|
||||||
|
|
||||||
if (ep.step("Signing release " + export_label + "...", 104)) {
|
if (ep.step(vformat(TTR("Signing release %s..."), export_label), 104)) {
|
||||||
return ERR_SKIP;
|
return ERR_SKIP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FileAccess::exists(keystore)) {
|
if (!FileAccess::exists(keystore)) {
|
||||||
EditorNode::add_io_error("Could not find keystore, unable to export.");
|
EditorNode::add_io_error(TTR("Could not find keystore, unable to export."));
|
||||||
return ERR_FILE_CANT_OPEN;
|
return ERR_FILE_CANT_OPEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2747,11 +2747,11 @@ public:
|
||||||
OS::get_singleton()->execute(apksigner, args, true, nullptr, &output, &retval, true);
|
OS::get_singleton()->execute(apksigner, args, true, nullptr, &output, &retval, true);
|
||||||
print_verbose(output);
|
print_verbose(output);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
EditorNode::add_io_error("'apksigner' returned with error #" + itos(retval));
|
EditorNode::add_io_error(vformat(TTR("'apksigner' returned with error #%d"), retval));
|
||||||
return ERR_CANT_CREATE;
|
return ERR_CANT_CREATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ep.step("Verifying " + export_label + "...", 105)) {
|
if (ep.step(vformat(TTR("Verifying %s..."), export_label), 105)) {
|
||||||
return ERR_SKIP;
|
return ERR_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2767,7 +2767,7 @@ public:
|
||||||
OS::get_singleton()->execute(apksigner, args, true, nullptr, &output, &retval, true);
|
OS::get_singleton()->execute(apksigner, args, true, nullptr, &output, &retval, true);
|
||||||
print_verbose(output);
|
print_verbose(output);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
EditorNode::add_io_error("'apksigner' verification of " + export_label + " failed.");
|
EditorNode::add_io_error(vformat(TTR("'apksigner' verification of %s failed."), export_label));
|
||||||
return ERR_CANT_CREATE;
|
return ERR_CANT_CREATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2832,7 +2832,7 @@ public:
|
||||||
String src_apk;
|
String src_apk;
|
||||||
Error err;
|
Error err;
|
||||||
|
|
||||||
EditorProgress ep("export", "Exporting for Android", 105, true);
|
EditorProgress ep("export", TTR("Exporting for Android"), 105, true);
|
||||||
|
|
||||||
bool use_custom_build = bool(p_preset->get("custom_template/use_custom_build"));
|
bool use_custom_build = bool(p_preset->get("custom_template/use_custom_build"));
|
||||||
bool p_give_internet = p_flags & (DEBUG_FLAG_DUMB_CLIENT | DEBUG_FLAG_REMOTE_DEBUG);
|
bool p_give_internet = p_flags & (DEBUG_FLAG_DUMB_CLIENT | DEBUG_FLAG_REMOTE_DEBUG);
|
||||||
|
@ -2881,7 +2881,7 @@ public:
|
||||||
return ERR_UNCONFIGURED;
|
return ERR_UNCONFIGURED;
|
||||||
}
|
}
|
||||||
if (export_format > EXPORT_FORMAT_AAB || export_format < EXPORT_FORMAT_APK) {
|
if (export_format > EXPORT_FORMAT_AAB || export_format < EXPORT_FORMAT_APK) {
|
||||||
EditorNode::add_io_error("Unsupported export format!\n");
|
EditorNode::add_io_error(TTR("Unsupported export format!\n"));
|
||||||
return ERR_UNCONFIGURED; //TODO: is this the right error?
|
return ERR_UNCONFIGURED; //TODO: is this the right error?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2911,7 +2911,7 @@ public:
|
||||||
String project_name = get_project_name(p_preset->get("package/name"));
|
String project_name = get_project_name(p_preset->get("package/name"));
|
||||||
err = _create_project_name_strings_files(p_preset, project_name); //project name localization.
|
err = _create_project_name_strings_files(p_preset, project_name); //project name localization.
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
EditorNode::add_io_error("Unable to overwrite res://android/build/res/*.xml files with project name");
|
EditorNode::add_io_error(TTR("Unable to overwrite res://android/build/res/*.xml files with project name"));
|
||||||
}
|
}
|
||||||
// Copies the project icon files into the appropriate Gradle project directory.
|
// Copies the project icon files into the appropriate Gradle project directory.
|
||||||
_copy_icons_to_gradle_project(p_preset, processed_splash_config_xml, splash_image, splash_bg_color_image, main_image, foreground, background);
|
_copy_icons_to_gradle_project(p_preset, processed_splash_config_xml, splash_image, splash_bg_color_image, main_image, foreground, background);
|
||||||
|
@ -2927,7 +2927,7 @@ public:
|
||||||
user_data.debug = p_debug;
|
user_data.debug = p_debug;
|
||||||
err = export_project_files(p_preset, rename_and_store_file_in_gradle_project, &user_data, copy_gradle_so);
|
err = export_project_files(p_preset, rename_and_store_file_in_gradle_project, &user_data, copy_gradle_so);
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
EditorNode::add_io_error("Could not export project files to gradle project\n");
|
EditorNode::add_io_error(TTR("Could not export project files to gradle project\n"));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
if (user_data.libs.size() > 0) {
|
if (user_data.libs.size() > 0) {
|
||||||
|
@ -2939,7 +2939,7 @@ public:
|
||||||
print_verbose("Saving apk expansion file..");
|
print_verbose("Saving apk expansion file..");
|
||||||
err = save_apk_expansion_file(p_preset, p_path);
|
err = save_apk_expansion_file(p_preset, p_path);
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
EditorNode::add_io_error("Could not write expansion package file!");
|
EditorNode::add_io_error(TTR("Could not write expansion package file!"));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3026,7 +3026,7 @@ public:
|
||||||
String release_username = p_preset->get("keystore/release_user");
|
String release_username = p_preset->get("keystore/release_user");
|
||||||
String release_password = p_preset->get("keystore/release_password");
|
String release_password = p_preset->get("keystore/release_password");
|
||||||
if (!FileAccess::exists(release_keystore)) {
|
if (!FileAccess::exists(release_keystore)) {
|
||||||
EditorNode::add_io_error("Could not find keystore, unable to export.");
|
EditorNode::add_io_error(TTR("Could not find keystore, unable to export."));
|
||||||
return ERR_FILE_CANT_OPEN;
|
return ERR_FILE_CANT_OPEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3091,7 +3091,7 @@ public:
|
||||||
src_apk = find_export_template("android_release.apk");
|
src_apk = find_export_template("android_release.apk");
|
||||||
}
|
}
|
||||||
if (src_apk == "") {
|
if (src_apk == "") {
|
||||||
EditorNode::add_io_error("Package not found: " + src_apk);
|
EditorNode::add_io_error(vformat(TTR("Package not found: %s"), src_apk));
|
||||||
return ERR_FILE_NOT_FOUND;
|
return ERR_FILE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3103,13 +3103,13 @@ public:
|
||||||
FileAccess *src_f = nullptr;
|
FileAccess *src_f = nullptr;
|
||||||
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
|
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
|
||||||
|
|
||||||
if (ep.step("Creating APK...", 0)) {
|
if (ep.step(TTR("Creating APK..."), 0)) {
|
||||||
return ERR_SKIP;
|
return ERR_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
unzFile pkg = unzOpen2(src_apk.utf8().get_data(), &io);
|
unzFile pkg = unzOpen2(src_apk.utf8().get_data(), &io);
|
||||||
if (!pkg) {
|
if (!pkg) {
|
||||||
EditorNode::add_io_error("Could not find template APK to export:\n" + src_apk);
|
EditorNode::add_io_error(vformat(TTR("Could not find template APK to export:\n%s"), src_apk));
|
||||||
return ERR_FILE_NOT_FOUND;
|
return ERR_FILE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3237,12 +3237,11 @@ public:
|
||||||
|
|
||||||
if (!invalid_abis.empty()) {
|
if (!invalid_abis.empty()) {
|
||||||
String unsupported_arch = String(", ").join(invalid_abis);
|
String unsupported_arch = String(", ").join(invalid_abis);
|
||||||
EditorNode::add_io_error("Missing libraries in the export template for the selected architectures: " + unsupported_arch + ".\n" +
|
EditorNode::add_io_error(vformat(TTR("Missing libraries in the export template for the selected architectures: %s.\nPlease build a template with all required libraries, or uncheck the missing architectures in the export preset."), unsupported_arch));
|
||||||
"Please build a template with all required libraries, or uncheck the missing architectures in the export preset.");
|
|
||||||
CLEANUP_AND_RETURN(ERR_FILE_NOT_FOUND);
|
CLEANUP_AND_RETURN(ERR_FILE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ep.step("Adding files...", 1)) {
|
if (ep.step(TTR("Adding files..."), 1)) {
|
||||||
CLEANUP_AND_RETURN(ERR_SKIP);
|
CLEANUP_AND_RETURN(ERR_SKIP);
|
||||||
}
|
}
|
||||||
err = OK;
|
err = OK;
|
||||||
|
@ -3256,7 +3255,7 @@ public:
|
||||||
if (apk_expansion) {
|
if (apk_expansion) {
|
||||||
err = save_apk_expansion_file(p_preset, p_path);
|
err = save_apk_expansion_file(p_preset, p_path);
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
EditorNode::add_io_error("Could not write expansion package file!");
|
EditorNode::add_io_error(TTR("Could not write expansion package file!"));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3269,7 +3268,7 @@ public:
|
||||||
|
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
unzClose(pkg);
|
unzClose(pkg);
|
||||||
EditorNode::add_io_error("Could not export project files");
|
EditorNode::add_io_error(TTR("Could not export project files"));
|
||||||
CLEANUP_AND_RETURN(ERR_SKIP);
|
CLEANUP_AND_RETURN(ERR_SKIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3300,13 +3299,13 @@ public:
|
||||||
|
|
||||||
// If we're not signing the apk, then the next step should be the last.
|
// If we're not signing the apk, then the next step should be the last.
|
||||||
const int next_step = should_sign ? 103 : 105;
|
const int next_step = should_sign ? 103 : 105;
|
||||||
if (ep.step("Aligning APK...", next_step)) {
|
if (ep.step(TTR("Aligning APK..."), next_step)) {
|
||||||
CLEANUP_AND_RETURN(ERR_SKIP);
|
CLEANUP_AND_RETURN(ERR_SKIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
unzFile tmp_unaligned = unzOpen2(tmp_unaligned_path.utf8().get_data(), &io);
|
unzFile tmp_unaligned = unzOpen2(tmp_unaligned_path.utf8().get_data(), &io);
|
||||||
if (!tmp_unaligned) {
|
if (!tmp_unaligned) {
|
||||||
EditorNode::add_io_error("Could not unzip temporary unaligned APK.");
|
EditorNode::add_io_error(TTR("Could not unzip temporary unaligned APK."));
|
||||||
CLEANUP_AND_RETURN(ERR_FILE_NOT_FOUND);
|
CLEANUP_AND_RETURN(ERR_FILE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue