summaryrefslogtreecommitdiff
path: root/scene/gui/popup_menu.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-08-16 17:59:04 +0200
committerRémi Verschelde <rverschelde@gmail.com>2017-08-17 18:10:22 +0200
commitc72529baf09927b381e7850a0f132c1473b16ee2 (patch)
treeda64b9684d3db8cce6b50a20a50da2e1d99230bc /scene/gui/popup_menu.cpp
parent5485233549c97c7128fc2026bc2c01d3c1c5b48d (diff)
Rename `XL_MESSAGE` aka `tr` to `localize`
Also renames `set_message_translation` to `set_message_localization` for consistency.
Diffstat (limited to 'scene/gui/popup_menu.cpp')
-rw-r--r--scene/gui/popup_menu.cpp18
1 files changed, 9 insertions, 9 deletions
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();
}