Make progress and errors translatable when exporting to Android
This commit is contained in:
parent
e5411a815c
commit
1d5332069b
|
@ -1817,12 +1817,12 @@ public:
|
|||
|
||||
MutexLock lock(device_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();
|
||||
|
||||
// Export_temp APK.
|
||||
if (ep.step("Exporting APK...", 0)) {
|
||||
if (ep.step(TTR("Exporting APK..."), 0)) {
|
||||
return ERR_SKIP;
|
||||
}
|
||||
|
||||
|
@ -1857,7 +1857,7 @@ public:
|
|||
String package_name = p_preset->get("package/unique_name");
|
||||
|
||||
if (remove_prev) {
|
||||
if (ep.step("Uninstalling...", 1)) {
|
||||
if (ep.step(TTR("Uninstalling..."), 1)) {
|
||||
CLEANUP_AND_RETURN(ERR_SKIP);
|
||||
}
|
||||
|
||||
|
@ -1874,7 +1874,7 @@ public:
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1889,7 +1889,7 @@ public:
|
|||
err = OS::get_singleton()->execute(adb, args, &output, &rv, true);
|
||||
print_verbose(output);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1945,7 +1945,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if (ep.step("Running on device...", 3)) {
|
||||
if (ep.step(TTR("Running on device..."), 3)) {
|
||||
CLEANUP_AND_RETURN(ERR_SKIP);
|
||||
}
|
||||
args.clear();
|
||||
|
@ -1967,7 +1967,7 @@ public:
|
|||
err = OS::get_singleton()->execute(adb, args, &output, &rv, true);
|
||||
print_verbose(output);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -2326,7 +2326,7 @@ public:
|
|||
String apksigner = get_apksigner_path();
|
||||
print_verbose("Starting signing of the " + export_label + " binary using " + 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;
|
||||
}
|
||||
|
||||
|
@ -2344,7 +2344,7 @@ public:
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -2353,13 +2353,13 @@ public:
|
|||
password = release_password;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -2383,11 +2383,11 @@ public:
|
|||
OS::get_singleton()->execute(apksigner, args, &output, &retval, true);
|
||||
print_verbose(output);
|
||||
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;
|
||||
}
|
||||
|
||||
if (ep.step("Verifying " + export_label + "...", 105)) {
|
||||
if (ep.step(vformat(TTR("Verifying %s..."), export_label), 105)) {
|
||||
return ERR_SKIP;
|
||||
}
|
||||
|
||||
|
@ -2403,7 +2403,7 @@ public:
|
|||
OS::get_singleton()->execute(apksigner, args, &output, &retval, true);
|
||||
print_verbose(output);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -2466,7 +2466,7 @@ public:
|
|||
String src_apk;
|
||||
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 p_give_internet = p_flags & (DEBUG_FLAG_DUMB_CLIENT | DEBUG_FLAG_REMOTE_DEBUG);
|
||||
|
@ -2515,7 +2515,7 @@ public:
|
|||
return ERR_UNCONFIGURED;
|
||||
}
|
||||
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?
|
||||
}
|
||||
|
||||
|
@ -2545,7 +2545,7 @@ public:
|
|||
String project_name = get_project_name(p_preset->get("package/name"));
|
||||
err = _create_project_name_strings_files(p_preset, project_name); //project name localization.
|
||||
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.
|
||||
_copy_icons_to_gradle_project(p_preset, processed_splash_config_xml, splash_image, splash_bg_color_image, main_image, foreground, background);
|
||||
|
@ -2561,7 +2561,7 @@ public:
|
|||
user_data.debug = p_debug;
|
||||
err = export_project_files(p_preset, rename_and_store_file_in_gradle_project, &user_data, copy_gradle_so);
|
||||
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;
|
||||
}
|
||||
if (user_data.libs.size() > 0) {
|
||||
|
@ -2574,7 +2574,7 @@ public:
|
|||
print_verbose("Saving apk expansion file..");
|
||||
err = save_apk_expansion_file(p_preset, p_path);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -2661,7 +2661,7 @@ public:
|
|||
String release_username = p_preset->get("keystore/release_user");
|
||||
String release_password = p_preset->get("keystore/release_password");
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -2725,7 +2725,7 @@ public:
|
|||
src_apk = find_export_template("android_release.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;
|
||||
}
|
||||
}
|
||||
|
@ -2737,13 +2737,13 @@ public:
|
|||
FileAccess *src_f = nullptr;
|
||||
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;
|
||||
}
|
||||
|
||||
unzFile pkg = unzOpen2(src_apk.utf8().get_data(), &io);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -2871,12 +2871,11 @@ public:
|
|||
|
||||
if (!invalid_abis.is_empty()) {
|
||||
String unsupported_arch = String(", ").join(invalid_abis);
|
||||
EditorNode::add_io_error("Missing libraries in the export template for the selected architectures: " + unsupported_arch + ".\n" +
|
||||
"Please build a template with all required libraries, or uncheck the missing architectures in the export preset.");
|
||||
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));
|
||||
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);
|
||||
}
|
||||
err = OK;
|
||||
|
@ -2890,7 +2889,7 @@ public:
|
|||
if (apk_expansion) {
|
||||
err = save_apk_expansion_file(p_preset, p_path);
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
|
@ -2903,7 +2902,7 @@ public:
|
|||
|
||||
if (err != OK) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -2933,13 +2932,13 @@ public:
|
|||
|
||||
// If we're not signing the apk, then the next step should be the last.
|
||||
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);
|
||||
}
|
||||
|
||||
unzFile tmp_unaligned = unzOpen2(tmp_unaligned_path.utf8().get_data(), &io);
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue