More i18n improvements

* Make placeholder in editor layout dialog translatable.
* Make messages in scene import settings dialog translatable.
* Mark theme override property categories for translation.
This commit is contained in:
Haoyu Qiu 2023-03-27 18:06:07 +08:00
parent 7d8398996c
commit 5a5fd33e42
4 changed files with 29 additions and 29 deletions

View File

@ -140,7 +140,7 @@ EditorLayoutsDialog::EditorLayoutsDialog() {
name = memnew(LineEdit); name = memnew(LineEdit);
makevb->add_child(name); makevb->add_child(name);
name->set_placeholder("Or enter new layout name"); name->set_placeholder(TTR("Or enter new layout name"));
name->set_offset(SIDE_TOP, 5); name->set_offset(SIDE_TOP, 5);
name->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 5); name->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 5);
name->set_anchor_and_offset(SIDE_RIGHT, Control::ANCHOR_END, -5); name->set_anchor_and_offset(SIDE_RIGHT, Control::ANCHOR_END, -5);

View File

@ -329,7 +329,7 @@ void SceneImportSettings::_fill_scene(Node *p_node, TreeItem *p_parent_item) {
if (p_node == scene) { if (p_node == scene) {
icon = get_theme_icon(SNAME("PackedScene"), SNAME("EditorIcons")); icon = get_theme_icon(SNAME("PackedScene"), SNAME("EditorIcons"));
item->set_text(0, "Scene"); item->set_text(0, TTR("Scene"));
} }
item->set_icon(0, icon); item->set_icon(0, icon);
@ -1032,12 +1032,12 @@ void SceneImportSettings::_save_path_changed(const String &p_path) {
save_path_item->set_text(1, p_path); save_path_item->set_text(1, p_path);
if (FileAccess::exists(p_path)) { if (FileAccess::exists(p_path)) {
save_path_item->set_text(2, "Warning: File exists"); save_path_item->set_text(2, TTR("Warning: File exists"));
save_path_item->set_tooltip_text(2, TTR("Existing file with the same name will be replaced.")); save_path_item->set_tooltip_text(2, TTR("Existing file with the same name will be replaced."));
save_path_item->set_icon(2, get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons"))); save_path_item->set_icon(2, get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")));
} else { } else {
save_path_item->set_text(2, "Will create new File"); save_path_item->set_text(2, TTR("Will create new file"));
save_path_item->set_icon(2, get_theme_icon(SNAME("StatusSuccess"), SNAME("EditorIcons"))); save_path_item->set_icon(2, get_theme_icon(SNAME("StatusSuccess"), SNAME("EditorIcons")));
} }
} }
@ -1077,7 +1077,7 @@ void SceneImportSettings::_save_dir_callback(const String &p_path) {
if (md.has_import_id) { if (md.has_import_id) {
if (md.settings.has("use_external/enabled") && bool(md.settings["use_external/enabled"])) { if (md.settings.has("use_external/enabled") && bool(md.settings["use_external/enabled"])) {
item->set_text(2, "Already External"); item->set_text(2, TTR("Already External"));
item->set_tooltip_text(2, TTR("This material already references an external file, no action will be taken.\nDisable the external property for it to be extracted again.")); item->set_tooltip_text(2, TTR("This material already references an external file, no action will be taken.\nDisable the external property for it to be extracted again."));
} else { } else {
item->set_metadata(0, E.key); item->set_metadata(0, E.key);
@ -1092,12 +1092,12 @@ void SceneImportSettings::_save_dir_callback(const String &p_path) {
item->set_text(1, path); item->set_text(1, path);
if (FileAccess::exists(path)) { if (FileAccess::exists(path)) {
item->set_text(2, "Warning: File exists"); item->set_text(2, TTR("Warning: File exists"));
item->set_tooltip_text(2, TTR("Existing file with the same name will be replaced.")); item->set_tooltip_text(2, TTR("Existing file with the same name will be replaced."));
item->set_icon(2, get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons"))); item->set_icon(2, get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")));
} else { } else {
item->set_text(2, "Will create new File"); item->set_text(2, TTR("Will create new file"));
item->set_icon(2, get_theme_icon(SNAME("StatusSuccess"), SNAME("EditorIcons"))); item->set_icon(2, get_theme_icon(SNAME("StatusSuccess"), SNAME("EditorIcons")));
} }
@ -1105,7 +1105,7 @@ void SceneImportSettings::_save_dir_callback(const String &p_path) {
} }
} else { } else {
item->set_text(2, "No import ID"); item->set_text(2, TTR("No import ID"));
item->set_tooltip_text(2, TTR("Material has no name nor any other way to identify on re-import.\nPlease name it or ensure it is exported with an unique ID.")); item->set_tooltip_text(2, TTR("Material has no name nor any other way to identify on re-import.\nPlease name it or ensure it is exported with an unique ID."));
item->set_icon(2, get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons"))); item->set_icon(2, get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons")));
} }
@ -1130,7 +1130,7 @@ void SceneImportSettings::_save_dir_callback(const String &p_path) {
if (md.has_import_id) { if (md.has_import_id) {
if (md.settings.has("save_to_file/enabled") && bool(md.settings["save_to_file/enabled"])) { if (md.settings.has("save_to_file/enabled") && bool(md.settings["save_to_file/enabled"])) {
item->set_text(2, "Already Saving"); item->set_text(2, TTR("Already Saving"));
item->set_tooltip_text(2, TTR("This mesh already saves to an external resource, no action will be taken.")); item->set_tooltip_text(2, TTR("This mesh already saves to an external resource, no action will be taken."));
} else { } else {
item->set_metadata(0, E.key); item->set_metadata(0, E.key);
@ -1145,12 +1145,12 @@ void SceneImportSettings::_save_dir_callback(const String &p_path) {
item->set_text(1, path); item->set_text(1, path);
if (FileAccess::exists(path)) { if (FileAccess::exists(path)) {
item->set_text(2, "Warning: File exists"); item->set_text(2, TTR("Warning: File exists"));
item->set_tooltip_text(2, TTR("Existing file with the same name will be replaced on import.")); item->set_tooltip_text(2, TTR("Existing file with the same name will be replaced on import."));
item->set_icon(2, get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons"))); item->set_icon(2, get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")));
} else { } else {
item->set_text(2, "Will save to new File"); item->set_text(2, TTR("Will save to new file"));
item->set_icon(2, get_theme_icon(SNAME("StatusSuccess"), SNAME("EditorIcons"))); item->set_icon(2, get_theme_icon(SNAME("StatusSuccess"), SNAME("EditorIcons")));
} }
@ -1158,7 +1158,7 @@ void SceneImportSettings::_save_dir_callback(const String &p_path) {
} }
} else { } else {
item->set_text(2, "No import ID"); item->set_text(2, TTR("No import ID"));
item->set_tooltip_text(2, TTR("Mesh has no name nor any other way to identify on re-import.\nPlease name it or ensure it is exported with an unique ID.")); item->set_tooltip_text(2, TTR("Mesh has no name nor any other way to identify on re-import.\nPlease name it or ensure it is exported with an unique ID."));
item->set_icon(2, get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons"))); item->set_icon(2, get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons")));
} }
@ -1182,7 +1182,7 @@ void SceneImportSettings::_save_dir_callback(const String &p_path) {
item->set_text(0, name); item->set_text(0, name);
if (ad.settings.has("save_to_file/enabled") && bool(ad.settings["save_to_file/enabled"])) { if (ad.settings.has("save_to_file/enabled") && bool(ad.settings["save_to_file/enabled"])) {
item->set_text(2, "Already Saving"); item->set_text(2, TTR("Already Saving"));
item->set_tooltip_text(2, TTR("This animation already saves to an external resource, no action will be taken.")); item->set_tooltip_text(2, TTR("This animation already saves to an external resource, no action will be taken."));
} else { } else {
item->set_metadata(0, E.key); item->set_metadata(0, E.key);
@ -1197,12 +1197,12 @@ void SceneImportSettings::_save_dir_callback(const String &p_path) {
item->set_text(1, path); item->set_text(1, path);
if (FileAccess::exists(path)) { if (FileAccess::exists(path)) {
item->set_text(2, "Warning: File exists"); item->set_text(2, TTR("Warning: File exists"));
item->set_tooltip_text(2, TTR("Existing file with the same name will be replaced on import.")); item->set_tooltip_text(2, TTR("Existing file with the same name will be replaced on import."));
item->set_icon(2, get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons"))); item->set_icon(2, get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")));
} else { } else {
item->set_text(2, "Will save to new File"); item->set_text(2, TTR("Will save to new file"));
item->set_icon(2, get_theme_icon(SNAME("StatusSuccess"), SNAME("EditorIcons"))); item->set_icon(2, get_theme_icon(SNAME("StatusSuccess"), SNAME("EditorIcons")));
} }

View File

@ -360,7 +360,7 @@ bool Control::_get(const StringName &p_name, Variant &r_ret) const {
void Control::_get_property_list(List<PropertyInfo> *p_list) const { void Control::_get_property_list(List<PropertyInfo> *p_list) const {
Ref<Theme> default_theme = ThemeDB::get_singleton()->get_default_theme(); Ref<Theme> default_theme = ThemeDB::get_singleton()->get_default_theme();
p_list->push_back(PropertyInfo(Variant::NIL, TTRC("Theme Overrides"), PROPERTY_HINT_NONE, "theme_override_", PROPERTY_USAGE_GROUP)); p_list->push_back(PropertyInfo(Variant::NIL, GNAME("Theme Overrides", "theme_override_"), PROPERTY_HINT_NONE, "theme_override_", PROPERTY_USAGE_GROUP));
{ {
List<StringName> names; List<StringName> names;
@ -371,7 +371,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
} }
p_list->push_back(PropertyInfo(Variant::COLOR, "theme_override_colors/" + E, PROPERTY_HINT_NONE, "", usage)); p_list->push_back(PropertyInfo(Variant::COLOR, PNAME("theme_override_colors") + String("/") + E, PROPERTY_HINT_NONE, "", usage));
} }
} }
{ {
@ -383,7 +383,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
} }
p_list->push_back(PropertyInfo(Variant::INT, "theme_override_constants/" + E, PROPERTY_HINT_RANGE, "-16384,16384", usage)); p_list->push_back(PropertyInfo(Variant::INT, PNAME("theme_override_constants") + String("/") + E, PROPERTY_HINT_RANGE, "-16384,16384", usage));
} }
} }
{ {
@ -395,7 +395,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
} }
p_list->push_back(PropertyInfo(Variant::OBJECT, "theme_override_fonts/" + E, PROPERTY_HINT_RESOURCE_TYPE, "Font", usage)); p_list->push_back(PropertyInfo(Variant::OBJECT, PNAME("theme_override_fonts") + String("/") + E, PROPERTY_HINT_RESOURCE_TYPE, "Font", usage));
} }
} }
{ {
@ -407,7 +407,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
} }
p_list->push_back(PropertyInfo(Variant::INT, "theme_override_font_sizes/" + E, PROPERTY_HINT_RANGE, "1,256,1,or_greater,suffix:px", usage)); p_list->push_back(PropertyInfo(Variant::INT, PNAME("theme_override_font_sizes") + String("/") + E, PROPERTY_HINT_RANGE, "1,256,1,or_greater,suffix:px", usage));
} }
} }
{ {
@ -419,7 +419,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
} }
p_list->push_back(PropertyInfo(Variant::OBJECT, "theme_override_icons/" + E, PROPERTY_HINT_RESOURCE_TYPE, "Texture2D", usage)); p_list->push_back(PropertyInfo(Variant::OBJECT, PNAME("theme_override_icons") + String("/") + E, PROPERTY_HINT_RESOURCE_TYPE, "Texture2D", usage));
} }
} }
{ {
@ -431,7 +431,7 @@ void Control::_get_property_list(List<PropertyInfo> *p_list) const {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
} }
p_list->push_back(PropertyInfo(Variant::OBJECT, "theme_override_styles/" + E, PROPERTY_HINT_RESOURCE_TYPE, "StyleBox", usage)); p_list->push_back(PropertyInfo(Variant::OBJECT, PNAME("theme_override_styles") + String("/") + E, PROPERTY_HINT_RESOURCE_TYPE, "StyleBox", usage));
} }
} }
} }

View File

@ -146,7 +146,7 @@ bool Window::_get(const StringName &p_name, Variant &r_ret) const {
void Window::_get_property_list(List<PropertyInfo> *p_list) const { void Window::_get_property_list(List<PropertyInfo> *p_list) const {
Ref<Theme> default_theme = ThemeDB::get_singleton()->get_default_theme(); Ref<Theme> default_theme = ThemeDB::get_singleton()->get_default_theme();
p_list->push_back(PropertyInfo(Variant::NIL, TTRC("Theme Overrides"), PROPERTY_HINT_NONE, "theme_override_", PROPERTY_USAGE_GROUP)); p_list->push_back(PropertyInfo(Variant::NIL, GNAME("Theme Overrides", "theme_override_"), PROPERTY_HINT_NONE, "theme_override_", PROPERTY_USAGE_GROUP));
{ {
List<StringName> names; List<StringName> names;
@ -157,7 +157,7 @@ void Window::_get_property_list(List<PropertyInfo> *p_list) const {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
} }
p_list->push_back(PropertyInfo(Variant::COLOR, "theme_override_colors/" + E, PROPERTY_HINT_NONE, "", usage)); p_list->push_back(PropertyInfo(Variant::COLOR, PNAME("theme_override_colors") + String("/") + E, PROPERTY_HINT_NONE, "", usage));
} }
} }
{ {
@ -169,7 +169,7 @@ void Window::_get_property_list(List<PropertyInfo> *p_list) const {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
} }
p_list->push_back(PropertyInfo(Variant::INT, "theme_override_constants/" + E, PROPERTY_HINT_RANGE, "-16384,16384", usage)); p_list->push_back(PropertyInfo(Variant::INT, PNAME("theme_override_constants") + String("/") + E, PROPERTY_HINT_RANGE, "-16384,16384", usage));
} }
} }
{ {
@ -181,7 +181,7 @@ void Window::_get_property_list(List<PropertyInfo> *p_list) const {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
} }
p_list->push_back(PropertyInfo(Variant::OBJECT, "theme_override_fonts/" + E, PROPERTY_HINT_RESOURCE_TYPE, "Font", usage)); p_list->push_back(PropertyInfo(Variant::OBJECT, PNAME("theme_override_fonts") + String("/") + E, PROPERTY_HINT_RESOURCE_TYPE, "Font", usage));
} }
} }
{ {
@ -193,7 +193,7 @@ void Window::_get_property_list(List<PropertyInfo> *p_list) const {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
} }
p_list->push_back(PropertyInfo(Variant::INT, "theme_override_font_sizes/" + E, PROPERTY_HINT_RANGE, "1,256,1,or_greater,suffix:px", usage)); p_list->push_back(PropertyInfo(Variant::INT, PNAME("theme_override_font_sizes") + String("/") + E, PROPERTY_HINT_RANGE, "1,256,1,or_greater,suffix:px", usage));
} }
} }
{ {
@ -205,7 +205,7 @@ void Window::_get_property_list(List<PropertyInfo> *p_list) const {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
} }
p_list->push_back(PropertyInfo(Variant::OBJECT, "theme_override_icons/" + E, PROPERTY_HINT_RESOURCE_TYPE, "Texture2D", usage)); p_list->push_back(PropertyInfo(Variant::OBJECT, PNAME("theme_override_icons") + String("/") + E, PROPERTY_HINT_RESOURCE_TYPE, "Texture2D", usage));
} }
} }
{ {
@ -217,7 +217,7 @@ void Window::_get_property_list(List<PropertyInfo> *p_list) const {
usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED; usage |= PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_CHECKED;
} }
p_list->push_back(PropertyInfo(Variant::OBJECT, "theme_override_styles/" + E, PROPERTY_HINT_RESOURCE_TYPE, "StyleBox", usage)); p_list->push_back(PropertyInfo(Variant::OBJECT, PNAME("theme_override_styles") + String("/") + E, PROPERTY_HINT_RESOURCE_TYPE, "StyleBox", usage));
} }
} }
} }