summaryrefslogtreecommitdiffstats
path: root/editor/localization_editor.cpp
diff options
context:
space:
mode:
authorMichael Alexsander <michaelalexsander@protonmail.com>2023-12-15 20:56:06 -0300
committerMichael Alexsander <michaelalexsander@protonmail.com>2024-02-28 11:34:26 -0300
commitd70c45b5c85022fb02224235ff6df24ebf83dcf1 (patch)
treedc37699af2d104e811a67d220fa270abcd206b10 /editor/localization_editor.cpp
parentdf78c0636d79c9545a283e0e2a926d623998cc27 (diff)
downloadredot-engine-d70c45b5c85022fb02224235ff6df24ebf83dcf1.tar.gz
Add option to add built-in strings in the POT generation
Diffstat (limited to 'editor/localization_editor.cpp')
-rw-r--r--editor/localization_editor.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/editor/localization_editor.cpp b/editor/localization_editor.cpp
index 8bdd5a3102..eb7f508695 100644
--- a/editor/localization_editor.cpp
+++ b/editor/localization_editor.cpp
@@ -45,6 +45,7 @@ void LocalizationEditor::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
translation_list->connect("button_clicked", callable_mp(this, &LocalizationEditor::_translation_delete));
translation_pot_list->connect("button_clicked", callable_mp(this, &LocalizationEditor::_pot_delete));
+ translation_pot_add_builtin->set_pressed(GLOBAL_GET("internationalization/locale/translation_add_builtin_strings_to_pot"));
List<String> tfn;
ResourceLoader::get_recognized_extensions_for_type("Translation", &tfn);
@@ -377,6 +378,11 @@ void LocalizationEditor::_pot_generate_open() {
pot_generate_dialog->popup_file_dialog();
}
+void LocalizationEditor::_pot_add_builtin_toggled() {
+ ProjectSettings::get_singleton()->set_setting("internationalization/locale/translation_add_builtin_strings_to_pot", translation_pot_add_builtin->is_pressed());
+ ProjectSettings::get_singleton()->save();
+}
+
void LocalizationEditor::_pot_generate(const String &p_file) {
POTGenerator::get_singleton()->generate_pot(p_file);
}
@@ -730,13 +736,14 @@ LocalizationEditor::LocalizationEditor() {
pot_generate_button->connect("pressed", callable_mp(this, &LocalizationEditor::_pot_generate_open));
thb->add_child(pot_generate_button);
- VBoxContainer *tmc = memnew(VBoxContainer);
- tmc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- tvb->add_child(tmc);
-
translation_pot_list = memnew(Tree);
translation_pot_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- tmc->add_child(translation_pot_list);
+ tvb->add_child(translation_pot_list);
+
+ translation_pot_add_builtin = memnew(CheckBox(TTR("Add Built-in Strings to POT")));
+ translation_pot_add_builtin->set_tooltip_text(TTR("Add strings from built-in components such as certain Control nodes."));
+ translation_pot_add_builtin->connect("pressed", callable_mp(this, &LocalizationEditor::_pot_add_builtin_toggled));
+ tvb->add_child(translation_pot_add_builtin);
pot_generate_dialog = memnew(EditorFileDialog);
pot_generate_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);