Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/editor/translations/localization_editor.h
9896 views
1
/**************************************************************************/
2
/* localization_editor.h */
3
/**************************************************************************/
4
/* This file is part of: */
5
/* GODOT ENGINE */
6
/* https://godotengine.org */
7
/**************************************************************************/
8
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10
/* */
11
/* Permission is hereby granted, free of charge, to any person obtaining */
12
/* a copy of this software and associated documentation files (the */
13
/* "Software"), to deal in the Software without restriction, including */
14
/* without limitation the rights to use, copy, modify, merge, publish, */
15
/* distribute, sublicense, and/or sell copies of the Software, and to */
16
/* permit persons to whom the Software is furnished to do so, subject to */
17
/* the following conditions: */
18
/* */
19
/* The above copyright notice and this permission notice shall be */
20
/* included in all copies or substantial portions of the Software. */
21
/* */
22
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29
/**************************************************************************/
30
31
#pragma once
32
33
#include "editor/translations/editor_locale_dialog.h"
34
#include "scene/gui/check_box.h"
35
#include "scene/gui/tree.h"
36
37
class EditorFileDialog;
38
class FileSystemDock;
39
40
class LocalizationEditor : public VBoxContainer {
41
GDCLASS(LocalizationEditor, VBoxContainer);
42
43
Tree *translation_list = nullptr;
44
45
EditorLocaleDialog *locale_select = nullptr;
46
EditorFileDialog *translation_file_open = nullptr;
47
48
Button *translation_res_option_add_button = nullptr;
49
EditorFileDialog *translation_res_file_open_dialog = nullptr;
50
EditorFileDialog *translation_res_option_file_open_dialog = nullptr;
51
Tree *translation_remap = nullptr;
52
Tree *translation_remap_options = nullptr;
53
54
Tree *translation_pot_list = nullptr;
55
CheckBox *translation_pot_add_builtin = nullptr;
56
EditorFileDialog *pot_file_open_dialog = nullptr;
57
EditorFileDialog *pot_generate_dialog = nullptr;
58
Button *pot_generate_button = nullptr;
59
60
bool updating_translations = false;
61
String localization_changed;
62
63
void _translation_file_open();
64
void _translation_add(const PackedStringArray &p_paths);
65
void _translation_delete(Object *p_item, int p_column, int p_button, MouseButton p_mouse_button);
66
67
void _translation_res_file_open();
68
void _translation_res_add(const PackedStringArray &p_paths);
69
void _translation_res_delete(Object *p_item, int p_column, int p_button, MouseButton p_mouse_button);
70
void _translation_res_select();
71
void _translation_res_option_file_open();
72
void _translation_res_option_add(const PackedStringArray &p_paths);
73
void _translation_res_option_changed();
74
void _translation_res_option_delete(Object *p_item, int p_column, int p_button, MouseButton p_mouse_button);
75
void _translation_res_option_popup(bool p_arrow_clicked);
76
void _translation_res_option_selected(const String &p_locale);
77
78
void _pot_add(const PackedStringArray &p_paths);
79
void _pot_delete(Object *p_item, int p_column, int p_button, MouseButton p_mouse_button);
80
void _pot_file_open();
81
void _pot_generate_open();
82
void _pot_add_builtin_toggled();
83
void _pot_generate(const String &p_file);
84
void _update_pot_file_extensions();
85
86
void _filesystem_files_moved(const String &p_old_file, const String &p_new_file);
87
void _filesystem_file_removed(const String &p_file);
88
89
protected:
90
void _notification(int p_what);
91
static void _bind_methods();
92
93
public:
94
void add_translation(const String &p_translation);
95
void update_translations();
96
void connect_filesystem_dock_signals(FileSystemDock *p_fs_dock);
97
98
LocalizationEditor();
99
};
100
101