lang_translator.cpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #include "lang/lang_translator.h"
  8. #include "lang/lang_keys.h"
  9. #include "base/platform/base_platform_info.h"
  10. namespace Lang {
  11. QString Translator::translate(const char *context, const char *sourceText, const char *disambiguation, int n) const {
  12. if (u"QMenuBar"_q == context) {
  13. if (u"Services"_q == sourceText) return tr::lng_mac_menu_services(tr::now);
  14. if (u"Hide %1"_q == sourceText) return tr::lng_mac_menu_hide_telegram(tr::now, lt_telegram, u"%1"_q);
  15. if (u"Hide Others"_q == sourceText) return tr::lng_mac_menu_hide_others(tr::now);
  16. if (u"Show All"_q == sourceText) return tr::lng_mac_menu_show_all(tr::now);
  17. if (u"Preferences..."_q == sourceText) return tr::lng_mac_menu_preferences(tr::now);
  18. if (u"Quit %1"_q == sourceText) return tr::lng_mac_menu_quit_telegram(tr::now, lt_telegram, u"%1"_q);
  19. if (u"About %1"_q == sourceText) return tr::lng_mac_menu_about_telegram(tr::now, lt_telegram, u"%1"_q);
  20. return QString();
  21. }
  22. if (u"QWidgetTextControl"_q == context || u"QLineEdit"_q == context) {
  23. if (u"&Undo"_q == sourceText) return Platform::IsWindows() ? tr::lng_wnd_menu_undo(tr::now) : Platform::IsMac() ? tr::lng_mac_menu_undo(tr::now) : tr::lng_linux_menu_undo(tr::now);
  24. if (u"&Redo"_q == sourceText) return Platform::IsWindows() ? tr::lng_wnd_menu_redo(tr::now) : Platform::IsMac() ? tr::lng_mac_menu_redo(tr::now) : tr::lng_linux_menu_redo(tr::now);
  25. if (u"Cu&t"_q == sourceText) return tr::lng_mac_menu_cut(tr::now);
  26. if (u"&Copy"_q == sourceText) return tr::lng_mac_menu_copy(tr::now);
  27. if (u"&Paste"_q == sourceText) return tr::lng_mac_menu_paste(tr::now);
  28. if (u"Delete"_q == sourceText) return tr::lng_mac_menu_delete(tr::now);
  29. if (u"Select All"_q == sourceText) return tr::lng_mac_menu_select_all(tr::now);
  30. return QString();
  31. }
  32. if (u"QUnicodeControlCharacterMenu"_q == context) {
  33. if (u"Insert Unicode control character"_q == sourceText) return tr::lng_menu_insert_unicode(tr::now);
  34. return QString();
  35. }
  36. return QString();
  37. }
  38. } // namespace Lang