1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Improve AssetLib auto-translation

This commit is contained in:
kobewi
2025-04-18 11:36:36 +02:00
parent 8f78e7510d
commit 22198497fe
2 changed files with 66 additions and 60 deletions

View File

@@ -161,7 +161,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem(bool p_clickable) {
vb->add_child(author_price_hbox);
author = memnew(LinkButton);
author->set_tooltip_text(TTR("Author"));
author->set_tooltip_text(TTRC("Author"));
author->set_accessibility_name(TTRC("Author"));
author_price_hbox->add_child(author);
@@ -188,7 +188,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem(bool p_clickable) {
price = memnew(Label);
price->set_focus_mode(FOCUS_ACCESSIBILITY);
price->add_theme_style_override(CoreStringName(normal), label_margin);
price->set_tooltip_text(TTR("License"));
price->set_tooltip_text(TTRC("License"));
price->set_accessibility_name(TTRC("License"));
price->set_mouse_filter(MOUSE_FILTER_PASS);
@@ -365,8 +365,8 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() {
preview_hb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
previews->add_child(preview_hb);
set_ok_button_text(TTR("Download"));
set_cancel_button_text(TTR("Close"));
set_ok_button_text(TTRC("Download"));
set_cancel_button_text(TTRC("Close"));
}
///////////////////////////////////////////////////////////////////////////////////
@@ -379,37 +379,37 @@ void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int
case HTTPRequest::RESULT_CONNECTION_ERROR:
case HTTPRequest::RESULT_BODY_SIZE_LIMIT_EXCEEDED: {
error_text = TTR("Connection error, please try again.");
status->set_text(TTR("Can't connect."));
status->set_text(TTRC("Can't connect."));
} break;
case HTTPRequest::RESULT_CANT_CONNECT:
case HTTPRequest::RESULT_TLS_HANDSHAKE_ERROR: {
error_text = TTR("Can't connect to host:") + " " + host;
status->set_text(TTR("Can't connect."));
status->set_text(TTRC("Can't connect."));
} break;
case HTTPRequest::RESULT_NO_RESPONSE: {
error_text = TTR("No response from host:") + " " + host;
status->set_text(TTR("No response."));
status->set_text(TTRC("No response."));
} break;
case HTTPRequest::RESULT_CANT_RESOLVE: {
error_text = TTR("Can't resolve hostname:") + " " + host;
status->set_text(TTR("Can't resolve."));
status->set_text(TTRC("Can't resolve."));
} break;
case HTTPRequest::RESULT_REQUEST_FAILED: {
error_text = TTR("Request failed, return code:") + " " + itos(p_code);
status->set_text(TTR("Request failed."));
status->set_text(TTRC("Request failed."));
} break;
case HTTPRequest::RESULT_DOWNLOAD_FILE_CANT_OPEN:
case HTTPRequest::RESULT_DOWNLOAD_FILE_WRITE_ERROR: {
error_text = TTR("Cannot save response to:") + " " + download->get_download_file();
status->set_text(TTR("Write error."));
status->set_text(TTRC("Write error."));
} break;
case HTTPRequest::RESULT_REDIRECT_LIMIT_REACHED: {
error_text = TTR("Request failed, too many redirects");
status->set_text(TTR("Redirect loop."));
status->set_text(TTRC("Redirect loop."));
} break;
case HTTPRequest::RESULT_TIMEOUT: {
error_text = TTR("Request failed, timeout");
status->set_text(TTR("Timeout."));
status->set_text(TTRC("Timeout."));
} break;
default: {
if (p_code != 200) {
@@ -420,7 +420,7 @@ void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int
if (sha256 != download_sha256) {
error_text = TTR("Bad download hash, assuming file has been tampered with.") + "\n";
error_text += TTR("Expected:") + " " + sha256 + "\n" + TTR("Got:") + " " + download_sha256;
status->set_text(TTR("Failed SHA-256 hash check"));
status->set_text(TTRC("Failed SHA-256 hash check"));
}
}
} break;
@@ -439,7 +439,7 @@ void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int
}
install_button->set_disabled(false);
status->set_text(TTR("Ready to install!"));
status->set_text(TTRC("Ready to install!"));
set_process(false);
@@ -496,17 +496,17 @@ void EditorAssetLibraryItemDownload::_notification(int p_what) {
if (cstatus != prev_status) {
switch (cstatus) {
case HTTPClient::STATUS_RESOLVING: {
status->set_text(TTR("Resolving..."));
status->set_text(TTRC("Resolving..."));
progress->set_max(1);
progress->set_value(0);
} break;
case HTTPClient::STATUS_CONNECTING: {
status->set_text(TTR("Connecting..."));
status->set_text(TTRC("Connecting..."));
progress->set_max(1);
progress->set_value(0);
} break;
case HTTPClient::STATUS_REQUESTING: {
status->set_text(TTR("Requesting..."));
status->set_text(TTRC("Requesting..."));
progress->set_max(1);
progress->set_value(0);
} break;
@@ -550,7 +550,7 @@ void EditorAssetLibraryItemDownload::_make_request() {
Error err = download->request(host);
if (err != OK) {
status->set_text(TTR("Error making request"));
status->set_text(TTRC("Error making request"));
} else {
progress->set_indeterminate(true);
set_process(true);
@@ -592,7 +592,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
vb->add_spacer();
status = memnew(Label(TTR("Idle")));
status = memnew(Label(TTRC("Idle")));
vb->add_child(status);
progress = memnew(ProgressBar);
progress->set_editor_preview_indeterminate(true);
@@ -603,12 +603,12 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
hb2->add_spacer();
install_button = memnew(Button);
install_button->set_text(TTR("Install..."));
install_button->set_text(TTRC("Install..."));
install_button->set_disabled(true);
install_button->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibraryItemDownload::install));
retry_button = memnew(Button);
retry_button->set_text(TTR("Retry"));
retry_button->set_text(TTRC("Retry"));
retry_button->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibraryItemDownload::_make_request));
// Only show the Retry button in case of a failure.
retry_button->hide();
@@ -624,7 +624,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
download_error = memnew(AcceptDialog);
panel->add_child(download_error);
download_error->set_title(TTR("Download Error"));
download_error->set_title(TTRC("Download Error"));
asset_installer = memnew(EditorAssetInstaller);
panel->add_child(asset_installer);
@@ -643,6 +643,12 @@ void EditorAssetLibrary::_notification(int p_what) {
error_label->move_to_front();
} break;
case NOTIFICATION_TRANSLATION_CHANGED: {
if (!initial_loading) {
_rerun_search(-1);
}
} break;
case NOTIFICATION_THEME_CHANGED: {
error_tr->set_texture(get_editor_theme_icon(SNAME("Error")));
filter->set_right_icon(get_editor_theme_icon(SNAME("Search")));
@@ -1036,7 +1042,7 @@ void EditorAssetLibrary::_request_image(ObjectID p_for, int p_asset_id, String p
}
void EditorAssetLibrary::_repository_changed(int p_repository_id) {
_set_library_message(TTR("Loading..."));
_set_library_message(TTRC("Loading..."));
asset_top_page->hide();
asset_bottom_page->hide();
@@ -1211,7 +1217,7 @@ void EditorAssetLibrary::_api_request(const String &p_request, RequestType p_req
error_hb->hide();
if (loading_blocked) {
_set_library_message_with_action(TTR("The Asset Library requires an online connection and involves sending data over the internet."), TTR("Go Online"), callable_mp(this, &EditorAssetLibrary::_force_online_mode));
_set_library_message_with_action(TTRC("The Asset Library requires an online connection and involves sending data over the internet."), TTRC("Go Online"), callable_mp(this, &EditorAssetLibrary::_force_online_mode));
return;
}
@@ -1243,7 +1249,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
error_label->set_text(TTR("Request failed, return code:") + " " + itos(p_code));
} break;
case HTTPRequest::RESULT_REDIRECT_LIMIT_REACHED: {
error_label->set_text(TTR("Request failed, too many redirects"));
error_label->set_text(TTRC("Request failed, too many redirects"));
} break;
default: {
@@ -1257,7 +1263,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
if (error_abort) {
if (requesting == REQUESTING_CONFIG) {
_set_library_message_with_action(TTR("Failed to get repository configuration."), TTR("Retry"), callable_mp(this, &EditorAssetLibrary::_request_current_config));
_set_library_message_with_action(TTRC("Failed to get repository configuration."), TTRC("Retry"), callable_mp(this, &EditorAssetLibrary::_request_current_config));
}
error_hb->show();
return;
@@ -1276,7 +1282,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
switch (requested) {
case REQUESTING_CONFIG: {
categories->clear();
categories->add_item(TTR("All"));
categories->add_item(TTRC("All"));
categories->set_item_metadata(0, 0);
if (d.has("categories")) {
Array clist = d["categories"];
@@ -1436,14 +1442,14 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
EditorAssetLibraryItemDownload *download_item = _get_asset_in_progress(description->get_asset_id());
if (download_item) {
if (download_item->can_install()) {
description->set_ok_button_text(TTR("Install"));
description->set_ok_button_text(TTRC("Install"));
description->get_ok_button()->set_disabled(false);
} else {
description->set_ok_button_text(TTR("Downloading..."));
description->set_ok_button_text(TTRC("Downloading..."));
description->get_ok_button()->set_disabled(true);
}
} else {
description->set_ok_button_text(TTR("Download"));
description->set_ok_button_text(TTRC("Download"));
description->get_ok_button()->set_disabled(false);
}
@@ -1596,9 +1602,9 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
filter = memnew(LineEdit);
if (templates_only) {
filter->set_placeholder(TTR("Search Templates, Projects, and Demos"));
filter->set_placeholder(TTRC("Search Templates, Projects, and Demos"));
} else {
filter->set_placeholder(TTR("Search Assets (Excluding Templates, Projects, and Demos)"));
filter->set_placeholder(TTRC("Search Assets (Excluding Templates, Projects, and Demos)"));
}
filter->set_clear_button_enabled(true);
search_hb->add_child(filter);
@@ -1618,12 +1624,12 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
}
Button *open_asset = memnew(Button);
open_asset->set_text(TTR("Import..."));
open_asset->set_text(TTRC("Import..."));
search_hb->add_child(open_asset);
open_asset->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibrary::_asset_open));
Button *plugins = memnew(Button);
plugins->set_text(TTR("Plugins..."));
plugins->set_text(TTRC("Plugins..."));
search_hb->add_child(plugins);
plugins->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibrary::_manage_plugins));
@@ -1635,10 +1641,10 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
HBoxContainer *search_hb2 = memnew(HBoxContainer);
library_main->add_child(search_hb2);
search_hb2->add_child(memnew(Label(TTR("Sort:") + " ")));
search_hb2->add_child(memnew(Label(TTRC("Sort:"))));
sort = memnew(OptionButton);
for (int i = 0; i < SORT_MAX; i++) {
sort->add_item(TTRGET(sort_text[i]));
sort->add_item(sort_text[i]);
}
search_hb2->add_child(sort);
@@ -1649,9 +1655,9 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
search_hb2->add_child(memnew(VSeparator));
search_hb2->add_child(memnew(Label(TTR("Category:") + " ")));
search_hb2->add_child(memnew(Label(TTRC("Category:"))));
categories = memnew(OptionButton);
categories->add_item(TTR("All"));
categories->add_item(TTRC("All"));
search_hb2->add_child(categories);
categories->set_h_size_flags(Control::SIZE_EXPAND_FILL);
categories->set_clip_text(true);
@@ -1659,7 +1665,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
search_hb2->add_child(memnew(VSeparator));
search_hb2->add_child(memnew(Label(TTR("Site:") + " ")));
search_hb2->add_child(memnew(Label(TTRC("Site:"))));
repository = memnew(OptionButton);
_update_repository_options();
@@ -1674,11 +1680,11 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
support = memnew(MenuButton);
search_hb2->add_child(support);
support->set_text(TTR("Support"));
support->set_text(TTRC("Support"));
support->get_popup()->set_hide_on_checkable_item_selection(false);
support->get_popup()->add_check_item(TTRGET(support_text[SUPPORT_FEATURED]), SUPPORT_FEATURED);
support->get_popup()->add_check_item(TTRGET(support_text[SUPPORT_COMMUNITY]), SUPPORT_COMMUNITY);
support->get_popup()->add_check_item(TTRGET(support_text[SUPPORT_TESTING]), SUPPORT_TESTING);
support->get_popup()->add_check_item(support_text[SUPPORT_FEATURED], SUPPORT_FEATURED);
support->get_popup()->add_check_item(support_text[SUPPORT_COMMUNITY], SUPPORT_COMMUNITY);
support->get_popup()->add_check_item(support_text[SUPPORT_TESTING], SUPPORT_TESTING);
support->get_popup()->set_item_checked(SUPPORT_FEATURED, true);
support->get_popup()->set_item_checked(SUPPORT_COMMUNITY, true);
support->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &EditorAssetLibrary::_support_toggled));
@@ -1767,7 +1773,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
asset_open = memnew(EditorFileDialog);
asset_open->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
asset_open->add_filter("*.zip", TTR("Assets ZIP File"));
asset_open->add_filter("*.zip", TTRC("Assets ZIP File"));
asset_open->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
add_child(asset_open);
asset_open->connect("file_selected", callable_mp(this, &EditorAssetLibrary::_asset_file_selected));