summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qapplication.cpp
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-03-02 15:38:42 (GMT)
committerPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-03-03 10:09:18 (GMT)
commit97b8727635a73197fac4f5edb8a1122733933db4 (patch)
treec26ff6e831dfb5b9e9ff05015be1d4d14e702572 /src/gui/kernel/qapplication.cpp
parent94da62be34187a41be87339463ad09bf65e34ea1 (diff)
downloadQt-97b8727635a73197fac4f5edb8a1122733933db4.zip
Qt-97b8727635a73197fac4f5edb8a1122733933db4.tar.gz
Qt-97b8727635a73197fac4f5edb8a1122733933db4.tar.bz2
Application menu is not translated in Mac OS X Cocoa
The application menu is loaded from the qt_menu.nib which only has English strings. These will now be translated using Qt's own translation mechanism. Every time a new translator is installed, the menu will now try to get the new string. Modification of qt_xx.ts files are done in a different patch. Task-number: QTBUG-4463 Reviewed-by: MortenS
Diffstat (limited to 'src/gui/kernel/qapplication.cpp')
-rw-r--r--src/gui/kernel/qapplication.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 203f637..fea8c37 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -2309,6 +2309,19 @@ static bool qt_detectRTLLanguage()
" languages or to 'RTL' in right-to-left languages (such as Hebrew"
" and Arabic) to get proper widget layout.") == QLatin1String("RTL"));
}
+#if defined(QT_MAC_USE_COCOA)
+static const char *application_menu_strings[] = {
+ QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Services"),
+ QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Hide %1"),
+ QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Hide Others"),
+ QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Show All")
+ };
+QString qt_mac_applicationmenu_string(int type)
+{
+ return qApp->translate("MAC_APPLICATION_MENU",
+ application_menu_strings[type]);
+}
+#endif
#endif
/*!\reimp
@@ -2337,6 +2350,9 @@ bool QApplication::event(QEvent *e)
#ifndef QT_NO_TRANSLATION
setLayoutDirection(qt_detectRTLLanguage()?Qt::RightToLeft:Qt::LeftToRight);
#endif
+#if defined(QT_MAC_USE_COCOA)
+ qt_mac_post_retranslateAppMenu();
+#endif
QWidgetList list = topLevelWidgets();
for (int i = 0; i < list.size(); ++i) {
QWidget *w = list.at(i);