mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-15 02:44:45 +00:00
mac os x main menu localization added, text input context menu localization added
This commit is contained in:
parent
2603fb7cb6
commit
5897b2311c
@ -462,8 +462,13 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
"lng_mac_this_app_can_open" = "This application can open \"{file}\".";
|
||||
"lng_mac_not_known_app" = "It's not known if this application can open \"{file}\".";
|
||||
|
||||
"lng_mac_menu_about" = "About Telegram";
|
||||
"lng_mac_menu_services" = "Services";
|
||||
"lng_mac_menu_hide_telegram" = "Hide {telegram}";
|
||||
"lng_mac_menu_hide_others" = "Hide Others";
|
||||
"lng_mac_menu_show_all" = "Show All";
|
||||
"lng_mac_menu_preferences" = "Preferences...";
|
||||
"lng_mac_menu_quit_telegram" = "Quit {telegram}";
|
||||
"lng_mac_menu_about_telegram" = "About {telegram}";
|
||||
"lng_mac_menu_file" = "File";
|
||||
"lng_mac_menu_logout" = "Log Out";
|
||||
"lng_mac_menu_edit" = "Edit";
|
||||
|
@ -505,7 +505,20 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\
|
||||
|
||||
tcpp << "\tconst char *_langKeyNames[lngkeys_cnt] = {\n";
|
||||
for (int i = 0, l = keysOrder.size(); i < l; ++i) {
|
||||
tcpp << "\t\t\"" << keysOrder[i] << "\",\n";
|
||||
if (keysTags[keysOrder[i]].isEmpty()) {
|
||||
tcpp << "\t\t\"" << keysOrder[i] << "\",\n";
|
||||
} else {
|
||||
tcpp << "\t\t\"" << keysOrder[i] << "__tagged\",\n";
|
||||
QMap<QByteArray, QVector<QString> > &countedTags(keysCounted[keysOrder[i]]);
|
||||
if (!countedTags.isEmpty()) {
|
||||
for (QMap<QByteArray, QVector<QString> >::const_iterator j = countedTags.cbegin(), e = countedTags.cend(); j != e; ++j) {
|
||||
const QVector<QString> &counted(*j);
|
||||
for (int k = 0, s = counted.size(); k < s; ++k) {
|
||||
tcpp << "\t\t\"" << keysOrder[i] << "__" + j.key() + QString::number(k).toUtf8() << "\",\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tcpp << "\t};\n\n";
|
||||
|
||||
|
@ -87,7 +87,7 @@ namespace {
|
||||
|
||||
Application::Application(int &argc, char **argv) : PsApplication(argc, argv),
|
||||
serverName(psServerPrefix() + cGUIDStr()), closing(false),
|
||||
updateRequestId(0), updateReply(0), updateThread(0), updateDownloader(0) {
|
||||
updateRequestId(0), updateReply(0), updateThread(0), updateDownloader(0), _translator(0) {
|
||||
|
||||
DEBUG_LOG(("Application Info: creation.."));
|
||||
|
||||
@ -153,6 +153,8 @@ Application::Application(int &argc, char **argv) : PsApplication(argc, argv),
|
||||
}
|
||||
}
|
||||
|
||||
installTranslator(_translator = new Translator());
|
||||
|
||||
Local::start();
|
||||
style::startManager();
|
||||
anim::startManager();
|
||||
@ -832,6 +834,8 @@ Application::~Application() {
|
||||
|
||||
style::stopManager();
|
||||
Local::stop();
|
||||
|
||||
delete _translator;
|
||||
}
|
||||
|
||||
Application *Application::app() {
|
||||
|
@ -26,6 +26,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
|
||||
class MainWidget;
|
||||
class FileUploader;
|
||||
class Translator;
|
||||
|
||||
class Application : public PsApplication, public RPCSender {
|
||||
Q_OBJECT
|
||||
@ -143,4 +144,6 @@ private:
|
||||
|
||||
QTimer writeUserConfigTimer;
|
||||
|
||||
Translator *_translator;
|
||||
|
||||
};
|
||||
|
@ -67,3 +67,27 @@ const QString &LangLoader::warnings() const {
|
||||
}
|
||||
return _warnings;
|
||||
}
|
||||
|
||||
QString Translator::translate(const char *context, const char *sourceText, const char *disambiguation, int n) const {
|
||||
if (QLatin1String("QMenuBar") == context) {
|
||||
if (QLatin1String("Services") == sourceText) return lang(lng_mac_menu_services);
|
||||
if (QLatin1String("Hide %1") == sourceText) return lng_mac_menu_hide_telegram(lt_telegram, qsl("%1"));
|
||||
if (QLatin1String("Hide Others") == sourceText) return lang(lng_mac_menu_hide_others);
|
||||
if (QLatin1String("Show All") == sourceText) return lang(lng_mac_menu_show_all);
|
||||
if (QLatin1String("Preferences...") == sourceText) return lang(lng_mac_menu_preferences);
|
||||
if (QLatin1String("Quit %1") == sourceText) return lng_mac_menu_quit_telegram(lt_telegram, qsl("%1"));
|
||||
if (QLatin1String("About %1") == sourceText) return lng_mac_menu_about_telegram(lt_telegram, qsl("%1"));
|
||||
return QString();
|
||||
}
|
||||
if (QLatin1String("QWidgetTextControl") == context || QLatin1String("QLineEdit") == context) {
|
||||
if (QLatin1String("&Undo") == sourceText) return lang(lng_mac_menu_undo);
|
||||
if (QLatin1String("&Redo") == sourceText) return lang(lng_mac_menu_redo);
|
||||
if (QLatin1String("Cu&t") == sourceText) return lang(lng_mac_menu_cut);
|
||||
if (QLatin1String("&Copy") == sourceText) return lang(lng_mac_menu_copy);
|
||||
if (QLatin1String("&Paste") == sourceText) return lang(lng_mac_menu_paste);
|
||||
if (QLatin1String("Delete") == sourceText) return lang(lng_mac_menu_delete);
|
||||
if (QLatin1String("Select All") == sourceText) return lang(lng_mac_menu_select_all);
|
||||
return QString();
|
||||
}
|
||||
return QString();//QString::fromUtf8(sourceText);
|
||||
}
|
||||
|
@ -126,3 +126,10 @@ private:
|
||||
LangLoader(const LangLoader &);
|
||||
LangLoader &operator=(const LangLoader &);
|
||||
};
|
||||
|
||||
class Translator : public QTranslator {
|
||||
public:
|
||||
|
||||
QString translate(const char *context, const char *sourceText, const char *disambiguation = 0, int n = -1) const;
|
||||
|
||||
};
|
||||
|
@ -349,9 +349,9 @@ void PsMainWindow::psFirstShow() {
|
||||
|
||||
// init global menu
|
||||
QMenu *main = psMainMenu.addMenu(qsl("Telegram"));
|
||||
main->addAction(lang(lng_mac_menu_about), App::wnd()->getTitle(), SLOT(onAbout()))->setMenuRole(QAction::AboutQtRole);
|
||||
main->addAction(lng_mac_menu_about_telegram(lt_telegram, qsl("Telegram")), App::wnd()->getTitle(), SLOT(onAbout()))->setMenuRole(QAction::AboutQtRole);
|
||||
main->addSeparator();
|
||||
QAction *prefs = main->addAction(lang(lng_mac_menu_preferences), App::wnd(), SLOT(showSettings()));
|
||||
QAction *prefs = main->addAction(lang(lng_mac_menu_preferences), App::wnd(), SLOT(showSettings()), QKeySequence(Qt::ControlModifier | Qt::Key_Comma));
|
||||
prefs->setMenuRole(QAction::PreferencesRole);
|
||||
|
||||
QMenu *file = psMainMenu.addMenu(lang(lng_mac_menu_file));
|
||||
|
@ -57,6 +57,7 @@
|
||||
07C4753F1967E37300CAAFE9 /* moc_switcher.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07C4753E1967E37300CAAFE9 /* moc_switcher.cpp */; };
|
||||
07D7034B19B8755A00C4EED2 /* audio.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07D7034919B8755A00C4EED2 /* audio.cpp */; };
|
||||
07D703BB19B88FB900C4EED2 /* moc_audio.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07D703BA19B88FB900C4EED2 /* moc_audio.cpp */; };
|
||||
07D7EABA1A597DD000838BA2 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 07D7EABC1A597DD000838BA2 /* Localizable.strings */; };
|
||||
07D8509419F5C97E00623D75 /* mtpCoreTypes.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07D8509219F5C97E00623D75 /* mtpCoreTypes.cpp */; };
|
||||
07D8509519F5C97E00623D75 /* mtpScheme.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07D8509319F5C97E00623D75 /* mtpScheme.cpp */; };
|
||||
07D8509919F8320900623D75 /* usernamebox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07D8509719F8320900623D75 /* usernamebox.cpp */; };
|
||||
@ -291,6 +292,12 @@
|
||||
07D7034919B8755A00C4EED2 /* audio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = audio.cpp; path = SourceFiles/audio.cpp; sourceTree = SOURCE_ROOT; };
|
||||
07D7034A19B8755A00C4EED2 /* audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = audio.h; path = SourceFiles/audio.h; sourceTree = SOURCE_ROOT; };
|
||||
07D703BA19B88FB900C4EED2 /* moc_audio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_audio.cpp; path = GeneratedFiles/Debug/moc_audio.cpp; sourceTree = SOURCE_ROOT; };
|
||||
07D7EABB1A597DD000838BA2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
07D7EABD1A597DD200838BA2 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
07D7EABE1A597DD300838BA2 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
07D7EABF1A597DD400838BA2 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
07D7EAC01A597DD500838BA2 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
07D7EAC11A597DD600838BA2 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/Localizable.strings"; sourceTree = "<group>"; };
|
||||
07D8509219F5C97E00623D75 /* mtpCoreTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mtpCoreTypes.cpp; path = SourceFiles/mtproto/mtpCoreTypes.cpp; sourceTree = SOURCE_ROOT; };
|
||||
07D8509319F5C97E00623D75 /* mtpScheme.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mtpScheme.cpp; path = SourceFiles/mtproto/mtpScheme.cpp; sourceTree = SOURCE_ROOT; };
|
||||
07D8509719F8320900623D75 /* usernamebox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = usernamebox.cpp; path = SourceFiles/boxes/usernamebox.cpp; sourceTree = SOURCE_ROOT; };
|
||||
@ -1226,6 +1233,7 @@
|
||||
E8C543AB96796ECAA2E65C57 /* Telegram */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
07D7EABC1A597DD000838BA2 /* Localizable.strings */,
|
||||
07084684195445A600B5AE3A /* Updater.xcodeproj */,
|
||||
2EB56BE3C2D93CDAB0C52E67 /* Sources */,
|
||||
25B08E2869634E9BCBA333A2 /* Generated Sources */,
|
||||
@ -1294,6 +1302,11 @@
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
en,
|
||||
es,
|
||||
de,
|
||||
nl,
|
||||
it,
|
||||
"pt-BR",
|
||||
);
|
||||
mainGroup = E8C543AB96796ECAA2E65C57 /* Telegram */;
|
||||
productRefGroup = FE0A091FDBFB3E9C31B7A1BD /* Products */;
|
||||
@ -1329,6 +1342,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
0749CE69194D723400345D61 /* Images.xcassets in Resources */,
|
||||
07D7EABA1A597DD000838BA2 /* Localizable.strings in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -1589,6 +1603,22 @@
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
07D7EABC1A597DD000838BA2 /* Localizable.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
07D7EABB1A597DD000838BA2 /* en */,
|
||||
07D7EABD1A597DD200838BA2 /* es */,
|
||||
07D7EABE1A597DD300838BA2 /* de */,
|
||||
07D7EABF1A597DD400838BA2 /* nl */,
|
||||
07D7EAC01A597DD500838BA2 /* it */,
|
||||
07D7EAC11A597DD600838BA2 /* pt-BR */,
|
||||
);
|
||||
name = Localizable.strings;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
07C3AF3E194CCC310016CFF1 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
|
Loading…
Reference in New Issue
Block a user