summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-08-17 22:41:55 +0200
committerGitHub <noreply@github.com>2017-08-17 22:41:55 +0200
commitee59e627ded8c9d0a3d2d33b2d6cc6734a62b04d (patch)
tree7c70f0dad8e79e273d9bcaadd0ff07a0c189b299 /scene/gui
parent33c1d25517050470689924c60414feaf295ce05f (diff)
parentc72529baf09927b381e7850a0f132c1473b16ee2 (diff)
Merge pull request #10380 from akien-mga/XL_MESSAGE
Rename `XL_MESSAGE`/`tr` to `localize`
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/button.cpp4
-rw-r--r--scene/gui/dialogs.cpp2
-rw-r--r--scene/gui/file_dialog.cpp2
-rw-r--r--scene/gui/label.cpp4
-rw-r--r--scene/gui/line_edit.cpp2
-rw-r--r--scene/gui/popup_menu.cpp18
-rw-r--r--scene/gui/tab_container.cpp4
7 files changed, 18 insertions, 18 deletions
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index 9a0b3b3c89..e2c9f5ecb4 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -59,7 +59,7 @@ void Button::_notification(int p_what) {
if (p_what == NOTIFICATION_TRANSLATION_CHANGED) {
- xl_text = XL_MESSAGE(text);
+ xl_text = localize(text);
minimum_size_changed();
update();
}
@@ -172,7 +172,7 @@ void Button::set_text(const String &p_text) {
if (text == p_text)
return;
text = p_text;
- xl_text = XL_MESSAGE(p_text);
+ xl_text = localize(p_text);
update();
_change_notify("text");
minimum_size_changed();
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index 8232a7a466..d5872d92ec 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -271,7 +271,7 @@ int WindowDialog::_drag_hit_test(const Point2 &pos) const {
void WindowDialog::set_title(const String &p_title) {
- title = XL_MESSAGE(p_title);
+ title = localize(p_title);
update();
}
String WindowDialog::get_title() const {
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 74255b38bf..197683b825 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -464,7 +464,7 @@ void FileDialog::update_filters() {
String flt = filters[i].get_slice(";", 0).strip_edges();
String desc = filters[i].get_slice(";", 1).strip_edges();
if (desc.length())
- filter->add_item(String(XL_MESSAGE(desc)) + " ( " + flt + " )");
+ filter->add_item(String(localize(desc)) + " ( " + flt + " )");
else
filter->add_item("( " + flt + " )");
}
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index 874156821e..758aafd115 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -63,7 +63,7 @@ void Label::_notification(int p_what) {
if (p_what == NOTIFICATION_TRANSLATION_CHANGED) {
- String new_text = XL_MESSAGE(text);
+ String new_text = localize(text);
if (new_text == xl_text)
return; //nothing new
xl_text = new_text;
@@ -526,7 +526,7 @@ void Label::set_text(const String &p_string) {
if (text == p_string)
return;
text = p_string;
- xl_text = XL_MESSAGE(p_string);
+ xl_text = localize(p_string);
word_cache_dirty = true;
if (percent_visible < 1)
visible_chars = get_total_character_count() * percent_visible;
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index c1784fb7ba..2dc60b3dcb 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -991,7 +991,7 @@ String LineEdit::get_text() const {
void LineEdit::set_placeholder(String p_text) {
- placeholder = XL_MESSAGE(p_text);
+ placeholder = localize(p_text);
update();
}
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 46aa0e5054..a3c06a7b17 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -96,7 +96,7 @@ Size2 PopupMenu::get_minimum_size() const {
size.width += check_w + hseparation;
}
- String text = items[i].shortcut.is_valid() ? String(tr(items[i].shortcut->get_name())) : items[i].xl_text;
+ String text = items[i].shortcut.is_valid() ? String(localize(items[i].shortcut->get_name())) : items[i].xl_text;
size.width += font->get_string_size(text).width;
if (i > 0)
size.height += vseparation;
@@ -395,7 +395,7 @@ void PopupMenu::_notification(int p_what) {
case NOTIFICATION_TRANSLATION_CHANGED: {
for (int i = 0; i < items.size(); i++) {
- items[i].xl_text = XL_MESSAGE(items[i].text);
+ items[i].xl_text = localize(items[i].text);
}
minimum_size_changed();
@@ -475,7 +475,7 @@ void PopupMenu::_notification(int p_what) {
}
item_ofs.y += font->get_ascent();
- String text = items[i].shortcut.is_valid() ? String(tr(items[i].shortcut->get_name())) : items[i].xl_text;
+ String text = items[i].shortcut.is_valid() ? String(localize(items[i].shortcut->get_name())) : items[i].xl_text;
if (!items[i].separator) {
font->draw(ci, item_ofs + Point2(0, Math::floor((h - font_h) / 2.0)), text, items[i].disabled ? font_color_disabled : (i == mouse_over ? font_color_hover : font_color));
@@ -513,7 +513,7 @@ void PopupMenu::add_icon_item(const Ref<Texture> &p_icon, const String &p_label,
Item item;
item.icon = p_icon;
item.text = p_label;
- item.xl_text = XL_MESSAGE(p_label);
+ item.xl_text = localize(p_label);
item.accel = p_accel;
item.ID = p_ID;
items.push_back(item);
@@ -523,7 +523,7 @@ void PopupMenu::add_item(const String &p_label, int p_ID, uint32_t p_accel) {
Item item;
item.text = p_label;
- item.xl_text = XL_MESSAGE(p_label);
+ item.xl_text = localize(p_label);
item.accel = p_accel;
item.ID = p_ID;
items.push_back(item);
@@ -534,7 +534,7 @@ void PopupMenu::add_submenu_item(const String &p_label, const String &p_submenu,
Item item;
item.text = p_label;
- item.xl_text = XL_MESSAGE(p_label);
+ item.xl_text = localize(p_label);
item.ID = p_ID;
item.submenu = p_submenu;
items.push_back(item);
@@ -546,7 +546,7 @@ void PopupMenu::add_icon_check_item(const Ref<Texture> &p_icon, const String &p_
Item item;
item.icon = p_icon;
item.text = p_label;
- item.xl_text = XL_MESSAGE(p_label);
+ item.xl_text = localize(p_label);
item.accel = p_accel;
item.ID = p_ID;
item.checkable = true;
@@ -557,7 +557,7 @@ void PopupMenu::add_check_item(const String &p_label, int p_ID, uint32_t p_accel
Item item;
item.text = p_label;
- item.xl_text = XL_MESSAGE(p_label);
+ item.xl_text = localize(p_label);
item.accel = p_accel;
item.ID = p_ID;
item.checkable = true;
@@ -628,7 +628,7 @@ void PopupMenu::set_item_text(int p_idx, const String &p_text) {
ERR_FAIL_INDEX(p_idx, items.size());
items[p_idx].text = p_text;
- items[p_idx].xl_text = XL_MESSAGE(p_text);
+ items[p_idx].xl_text = localize(p_text);
update();
}
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 1352569f33..520de951d5 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -231,7 +231,7 @@ void TabContainer::_notification(int p_what) {
// Draw the tab contents.
Control *control = tabs[i + first_tab_cache]->cast_to<Control>();
- String text = control->has_meta("_tab_name") ? String(XL_MESSAGE(String(control->get_meta("_tab_name")))) : String(control->get_name());
+ String text = control->has_meta("_tab_name") ? String(localize(String(control->get_meta("_tab_name")))) : String(control->get_name());
int x_content = tab_rect.position.x + tab_style->get_margin(MARGIN_LEFT);
int top_margin = tab_style->get_margin(MARGIN_TOP);
@@ -299,7 +299,7 @@ int TabContainer::_get_tab_width(int p_index) const {
// Get the width of the text displayed on the tab.
Ref<Font> font = get_font("font");
- String text = control->has_meta("_tab_name") ? String(XL_MESSAGE(String(control->get_meta("_tab_name")))) : String(control->get_name());
+ String text = control->has_meta("_tab_name") ? String(localize(String(control->get_meta("_tab_name")))) : String(control->get_name());
int width = font->get_string_size(text).width;
// Add space for a tab icon.