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

Improve Project Manager auto-translation

This commit is contained in:
kobewi
2025-03-31 16:47:09 +02:00
parent 297650a912
commit e6edf3b3b3
6 changed files with 205 additions and 189 deletions

View File

@@ -83,7 +83,7 @@ void ProjectDialog::_validate_path() {
_set_message("", MESSAGE_SUCCESS, INSTALL_PATH);
if (project_name->get_text().strip_edges().is_empty()) {
_set_message(TTR("It would be a good idea to name your project."), MESSAGE_ERROR);
_set_message(TTRC("It would be a good idea to name your project."), MESSAGE_ERROR);
return;
}
@@ -119,7 +119,7 @@ void ProjectDialog::_validate_path() {
unzFile pkg = unzOpen2(zip_path.utf8().get_data(), &io);
if (!pkg) {
_set_message(TTR("Invalid \".zip\" project file; it is not in ZIP format."), MESSAGE_ERROR);
_set_message(TTRC("Invalid \".zip\" project file; it is not in ZIP format."), MESSAGE_ERROR);
unzClose(pkg);
return;
}
@@ -147,7 +147,7 @@ void ProjectDialog::_validate_path() {
}
if (ret == UNZ_END_OF_LIST_OF_FILE) {
_set_message(TTR("Invalid \".zip\" project file; it doesn't contain a \"project.godot\" file."), MESSAGE_ERROR);
_set_message(TTRC("Invalid \".zip\" project file; it doesn't contain a \"project.godot\" file."), MESSAGE_ERROR);
unzClose(pkg);
return;
}
@@ -159,30 +159,30 @@ void ProjectDialog::_validate_path() {
create_dir->hide();
install_path_container->hide();
_set_message(TTR("Valid project found at path."), MESSAGE_SUCCESS);
_set_message(TTRC("Valid project found at path."), MESSAGE_SUCCESS);
} else {
create_dir->hide();
install_path_container->hide();
_set_message(TTR("Please choose a \"project.godot\", a directory with one, or a \".zip\" file."), MESSAGE_ERROR);
_set_message(TTRC("Please choose a \"project.godot\", a directory with one, or a \".zip\" file."), MESSAGE_ERROR);
return;
}
}
if (target_path.is_relative_path()) {
_set_message(TTR("The path specified is invalid."), MESSAGE_ERROR, target_path_input_type);
_set_message(TTRC("The path specified is invalid."), MESSAGE_ERROR, target_path_input_type);
return;
}
if (target_path.get_file() != OS::get_singleton()->get_safe_dir_name(target_path.get_file())) {
_set_message(TTR("The directory name specified contains invalid characters or trailing whitespace."), MESSAGE_ERROR, target_path_input_type);
_set_message(TTRC("The directory name specified contains invalid characters or trailing whitespace."), MESSAGE_ERROR, target_path_input_type);
return;
}
String working_dir = d->get_current_dir();
String executable_dir = OS::get_singleton()->get_executable_path().get_base_dir();
if (target_path == working_dir || target_path == executable_dir) {
_set_message(TTR("Creating a project at the engine's working directory or executable directory is not allowed, as it would prevent the project manager from starting."), MESSAGE_ERROR, target_path_input_type);
_set_message(TTRC("Creating a project at the engine's working directory or executable directory is not allowed, as it would prevent the project manager from starting."), MESSAGE_ERROR, target_path_input_type);
return;
}
@@ -194,7 +194,7 @@ void ProjectDialog::_validate_path() {
#endif
String documents_dir = OS::get_singleton()->get_system_dir(OS::SYSTEM_DIR_DOCUMENTS);
if (target_path == home_dir || target_path == documents_dir) {
_set_message(TTR("You cannot save a project at the selected path. Please create a subfolder or choose a new path."), MESSAGE_ERROR, target_path_input_type);
_set_message(TTRC("You cannot save a project at the selected path. Please create a subfolder or choose a new path."), MESSAGE_ERROR, target_path_input_type);
return;
}
@@ -202,24 +202,24 @@ void ProjectDialog::_validate_path() {
if (mode == MODE_NEW || mode == MODE_INSTALL || (mode == MODE_IMPORT && target_path_input_type == InputType::INSTALL_PATH)) {
if (create_dir->is_pressed()) {
if (!d->dir_exists(target_path.get_base_dir())) {
_set_message(TTR("The parent directory of the path specified doesn't exist."), MESSAGE_ERROR, target_path_input_type);
_set_message(TTRC("The parent directory of the path specified doesn't exist."), MESSAGE_ERROR, target_path_input_type);
return;
}
if (d->dir_exists(target_path)) {
// The path is not necessarily empty here, but we will update the message later if it isn't.
_set_message(TTR("The project folder already exists and is empty."), MESSAGE_SUCCESS, target_path_input_type);
_set_message(TTRC("The project folder already exists and is empty."), MESSAGE_SUCCESS, target_path_input_type);
} else {
_set_message(TTR("The project folder will be automatically created."), MESSAGE_SUCCESS, target_path_input_type);
_set_message(TTRC("The project folder will be automatically created."), MESSAGE_SUCCESS, target_path_input_type);
}
} else {
if (!d->dir_exists(target_path)) {
_set_message(TTR("The path specified doesn't exist."), MESSAGE_ERROR, target_path_input_type);
_set_message(TTRC("The path specified doesn't exist."), MESSAGE_ERROR, target_path_input_type);
return;
}
// The path is not necessarily empty here, but we will update the message later if it isn't.
_set_message(TTR("The project folder exists and is empty."), MESSAGE_SUCCESS, target_path_input_type);
_set_message(TTRC("The project folder exists and is empty."), MESSAGE_SUCCESS, target_path_input_type);
}
// Check if the directory is empty. Not an error, but we want to warn the user.
@@ -240,7 +240,7 @@ void ProjectDialog::_validate_path() {
d->list_dir_end();
if (!is_folder_empty) {
_set_message(TTR("The selected path is not empty. Choosing an empty folder is highly recommended."), MESSAGE_WARNING, target_path_input_type);
_set_message(TTRC("The selected path is not empty. Choosing an empty folder is highly recommended."), MESSAGE_WARNING, target_path_input_type);
}
}
}
@@ -497,8 +497,8 @@ void ProjectDialog::ok_pressed() {
if (!is_folder_empty) {
if (!nonempty_confirmation) {
nonempty_confirmation = memnew(ConfirmationDialog);
nonempty_confirmation->set_title(TTR("Warning: This folder is not empty"));
nonempty_confirmation->set_text(TTR("You are about to create a Godot project in a non-empty folder.\nThe entire contents of this folder will be imported as project resources!\n\nAre you sure you wish to continue?"));
nonempty_confirmation->set_title(TTRC("Warning: This folder is not empty"));
nonempty_confirmation->set_text(TTRC("You are about to create a Godot project in a non-empty folder.\nThe entire contents of this folder will be imported as project resources!\n\nAre you sure you wish to continue?"));
nonempty_confirmation->get_ok_button()->connect(SceneStringName(pressed), callable_mp(this, &ProjectDialog::_nonempty_confirmation_ok_pressed));
add_child(nonempty_confirmation);
}
@@ -512,7 +512,7 @@ void ProjectDialog::ok_pressed() {
if (create_dir->is_pressed()) {
Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
if (!d->dir_exists(path) && d->make_dir(path) != OK) {
_set_message(TTR("Couldn't create project directory, check permissions."), MESSAGE_ERROR);
_set_message(TTRC("Couldn't create project directory, check permissions."), MESSAGE_ERROR);
return;
}
}
@@ -548,14 +548,14 @@ void ProjectDialog::ok_pressed() {
Error err = ProjectSettings::get_singleton()->save_custom(path.path_join("project.godot"), initial_settings, Vector<String>(), false);
if (err != OK) {
_set_message(TTR("Couldn't create project.godot in project path."), MESSAGE_ERROR);
_set_message(TTRC("Couldn't create project.godot in project path."), MESSAGE_ERROR);
return;
}
// Store default project icon in SVG format.
Ref<FileAccess> fa_icon = FileAccess::open(path.path_join("icon.svg"), FileAccess::WRITE, &err);
if (err != OK) {
_set_message(TTR("Couldn't create icon.svg in project path."), MESSAGE_ERROR);
_set_message(TTRC("Couldn't create icon.svg in project path."), MESSAGE_ERROR);
return;
}
fa_icon->store_string(get_default_project_icon());
@@ -596,7 +596,7 @@ void ProjectDialog::ok_pressed() {
unzFile pkg = unzOpen2(zip_path.utf8().get_data(), &io);
if (!pkg) {
dialog_error->set_text(TTR("Error opening package file, not in ZIP format."));
dialog_error->set_text(TTRC("Error opening package file, not in ZIP format."));
dialog_error->popup_centered();
return;
}
@@ -627,7 +627,7 @@ void ProjectDialog::ok_pressed() {
}
if (ret == UNZ_END_OF_LIST_OF_FILE) {
_set_message(TTR("Invalid \".zip\" project file; it doesn't contain a \"project.godot\" file."), MESSAGE_ERROR);
_set_message(TTRC("Invalid \".zip\" project file; it doesn't contain a \"project.godot\" file."), MESSAGE_ERROR);
unzClose(pkg);
return;
}
@@ -635,7 +635,7 @@ void ProjectDialog::ok_pressed() {
if (create_dir->is_pressed()) {
Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
if (!d->dir_exists(path) && d->make_dir(path) != OK) {
_set_message(TTR("Couldn't create project directory, check permissions."), MESSAGE_ERROR);
_set_message(TTRC("Couldn't create project directory, check permissions."), MESSAGE_ERROR);
return;
}
}
@@ -772,8 +772,8 @@ void ProjectDialog::show_dialog(bool p_reset_name) {
// Name and path are set in `ProjectManager::_rename_project`.
project_path->set_editable(false);
set_title(TTR("Rename Project"));
set_ok_button_text(TTR("Rename"));
set_title(TTRC("Rename Project"));
set_ok_button_text(TTRC("Rename"));
create_dir->hide();
project_status_rect->hide();
@@ -812,8 +812,8 @@ void ProjectDialog::show_dialog(bool p_reset_name) {
edit_check_box->show();
if (mode == MODE_IMPORT) {
set_title(TTR("Import Existing Project"));
set_ok_button_text(TTR("Import"));
set_title(TTRC("Import Existing Project"));
set_ok_button_text(TTRC("Import"));
name_container->hide();
install_path_container->hide();
@@ -822,8 +822,8 @@ void ProjectDialog::show_dialog(bool p_reset_name) {
// Project path dialog is also opened; no need to change focus.
} else if (mode == MODE_NEW) {
set_title(TTR("Create New Project"));
set_ok_button_text(TTR("Create"));
set_title(TTRC("Create New Project"));
set_ok_button_text(TTRC("Create"));
name_container->show();
install_path_container->hide();
@@ -834,7 +834,7 @@ void ProjectDialog::show_dialog(bool p_reset_name) {
callable_mp(project_name, &LineEdit::select_all).call_deferred();
} else if (mode == MODE_INSTALL) {
set_title(TTR("Install Project:") + " " + zip_title);
set_ok_button_text(TTR("Install"));
set_ok_button_text(TTRC("Install"));
project_name->set_text(zip_title);
@@ -862,6 +862,10 @@ void ProjectDialog::show_dialog(bool p_reset_name) {
void ProjectDialog::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_TRANSLATION_CHANGED: {
_renderer_selected();
} break;
case NOTIFICATION_THEME_CHANGED: {
create_dir->set_button_icon(get_editor_theme_icon(SNAME("FolderCreate")));
project_browse->set_button_icon(get_editor_theme_icon(SNAME("FolderBrowse")));
@@ -892,7 +896,7 @@ ProjectDialog::ProjectDialog() {
vb->add_child(name_container);
Label *l = memnew(Label);
l->set_text(TTR("Project Name:"));
l->set_text(TTRC("Project Name:"));
name_container->add_child(l);
project_name = memnew(LineEdit);
@@ -906,12 +910,12 @@ ProjectDialog::ProjectDialog() {
project_path_container->add_child(pphb_label);
l = memnew(Label);
l->set_text(TTR("Project Path:"));
l->set_text(TTRC("Project Path:"));
l->set_h_size_flags(Control::SIZE_EXPAND_FILL);
pphb_label->add_child(l);
create_dir = memnew(CheckButton);
create_dir->set_text(TTR("Create Folder"));
create_dir->set_text(TTRC("Create Folder"));
create_dir->set_pressed(true);
pphb_label->add_child(create_dir);
create_dir->connect(SceneStringName(toggled), callable_mp(this, &ProjectDialog::_create_dir_toggled));
@@ -929,7 +933,7 @@ ProjectDialog::ProjectDialog() {
vb->add_child(install_path_container);
l = memnew(Label);
l->set_text(TTR("Project Installation Path:"));
l->set_text(TTRC("Project Installation Path:"));
install_path_container->add_child(l);
HBoxContainer *iphb = memnew(HBoxContainer);
@@ -947,7 +951,7 @@ ProjectDialog::ProjectDialog() {
pphb->add_child(project_status_rect);
project_browse = memnew(Button);
project_browse->set_text(TTR("Browse"));
project_browse->set_text(TTRC("Browse"));
project_browse->connect(SceneStringName(pressed), callable_mp(this, &ProjectDialog::_browse_project_path));
pphb->add_child(project_browse);
@@ -957,7 +961,7 @@ ProjectDialog::ProjectDialog() {
iphb->add_child(install_status_rect);
install_browse = memnew(Button);
install_browse->set_text(TTR("Browse"));
install_browse->set_text(TTRC("Browse"));
install_browse->connect(SceneStringName(pressed), callable_mp(this, &ProjectDialog::_browse_install_path));
iphb->add_child(install_browse);
@@ -971,7 +975,7 @@ ProjectDialog::ProjectDialog() {
renderer_container = memnew(VBoxContainer);
vb->add_child(renderer_container);
l = memnew(Label);
l->set_text(TTR("Renderer:"));
l->set_text(TTRC("Renderer:"));
renderer_container->add_child(l);
HBoxContainer *rshc = memnew(HBoxContainer);
renderer_container->add_child(rshc);
@@ -994,7 +998,7 @@ ProjectDialog::ProjectDialog() {
Button *rs_button = memnew(CheckBox);
rs_button->set_button_group(renderer_button_group);
rs_button->set_text(TTR("Forward+"));
rs_button->set_text(TTRC("Forward+"));
#ifndef RD_ENABLED
rs_button->set_disabled(true);
#endif
@@ -1006,7 +1010,7 @@ ProjectDialog::ProjectDialog() {
}
rs_button = memnew(CheckBox);
rs_button->set_button_group(renderer_button_group);
rs_button->set_text(TTR("Mobile"));
rs_button->set_text(TTRC("Mobile"));
#ifndef RD_ENABLED
rs_button->set_disabled(true);
#endif
@@ -1018,7 +1022,7 @@ ProjectDialog::ProjectDialog() {
}
rs_button = memnew(CheckBox);
rs_button->set_button_group(renderer_button_group);
rs_button->set_text(TTR("Compatibility"));
rs_button->set_text(TTRC("Compatibility"));
#if !defined(GLES3_ENABLED)
rs_button->set_disabled(true);
#endif
@@ -1041,7 +1045,7 @@ ProjectDialog::ProjectDialog() {
rvb->add_child(renderer_info);
rd_not_supported = memnew(Label);
rd_not_supported->set_text(vformat(TTR("RenderingDevice-based methods not available on this GPU:\n%s\nPlease use the Compatibility renderer."), RenderingServer::get_singleton()->get_video_adapter_name()));
rd_not_supported->set_text(vformat(TTRC("RenderingDevice-based methods not available on this GPU:\n%s\nPlease use the Compatibility renderer."), RenderingServer::get_singleton()->get_video_adapter_name()));
rd_not_supported->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
rd_not_supported->set_custom_minimum_size(Size2(200, 0) * EDSCALE);
rd_not_supported->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART);
@@ -1051,7 +1055,7 @@ ProjectDialog::ProjectDialog() {
_renderer_selected();
l = memnew(Label);
l->set_text(TTR("The renderer can be changed later, but scenes may need to be adjusted."));
l->set_text(TTRC("The renderer can be changed later, but scenes may need to be adjusted."));
// Add some extra spacing to separate it from the list above and the buttons below.
l->set_custom_minimum_size(Size2(0, 40) * EDSCALE);
l->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
@@ -1062,12 +1066,12 @@ ProjectDialog::ProjectDialog() {
default_files_container = memnew(HBoxContainer);
vb->add_child(default_files_container);
l = memnew(Label);
l->set_text(TTR("Version Control Metadata:"));
l->set_text(TTRC("Version Control Metadata:"));
default_files_container->add_child(l);
vcs_metadata_selection = memnew(OptionButton);
vcs_metadata_selection->set_custom_minimum_size(Size2(100, 20));
vcs_metadata_selection->add_item(TTR("None"), (int)EditorVCSInterface::VCSMetadata::NONE);
vcs_metadata_selection->add_item(TTR("Git"), (int)EditorVCSInterface::VCSMetadata::GIT);
vcs_metadata_selection->add_item(TTRC("None"), (int)EditorVCSInterface::VCSMetadata::NONE);
vcs_metadata_selection->add_item(TTRC("Git"), (int)EditorVCSInterface::VCSMetadata::GIT);
vcs_metadata_selection->select((int)EditorVCSInterface::VCSMetadata::GIT);
default_files_container->add_child(vcs_metadata_selection);
Control *spacer = memnew(Control);
@@ -1083,7 +1087,7 @@ ProjectDialog::ProjectDialog() {
vb->add_child(spacer2);
edit_check_box = memnew(CheckBox);
edit_check_box->set_text(TTR("Edit Now"));
edit_check_box->set_text(TTRC("Edit Now"));
edit_check_box->set_h_size_flags(Control::SIZE_SHRINK_CENTER);
edit_check_box->set_pressed(true);
vb->add_child(edit_check_box);