From a5b3caa295edb4064e3a560bced06ec27770c498 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Tue, 12 Feb 2013 20:14:30 +0100 Subject: [PATCH] %T placeholder (localized Terminal name) for title mask * %T placeholder added into the set, available for customizing main Terminal window title. It should be typically replaced by the application name localized for the currect system locale. * Use B_TRANSLATE instead of B_TRANSLATE_SYSTEM_NAME for the first menu entry in the main TermWindow menu. The meaning of "Terminal" term in this menu is the "Terminal session" but not the "Terminal Application" so using separate catkeys entry for this menu item avoids this inconsistency in Terminal UI localization; * Fixes #7586 --- src/apps/terminal/PrefHandler.cpp | 2 +- src/apps/terminal/TermConst.cpp | 1 + src/apps/terminal/TermWindow.cpp | 2 +- src/apps/terminal/TitlePlaceholderMapper.cpp | 7 +++++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/apps/terminal/PrefHandler.cpp b/src/apps/terminal/PrefHandler.cpp index 7c120f7db4..cf4f469b26 100644 --- a/src/apps/terminal/PrefHandler.cpp +++ b/src/apps/terminal/PrefHandler.cpp @@ -62,7 +62,7 @@ static const pref_defaults kTermDefaults[] = { { PREF_IM_AWARE, "0"}, { PREF_TAB_TITLE, "%1d: %p" }, - { PREF_WINDOW_TITLE, "Terminal %i: %t" }, + { PREF_WINDOW_TITLE, "%T %i: %t" }, { PREF_BLINK_CURSOR, PREF_TRUE }, { PREF_WARN_ON_EXIT, PREF_TRUE }, diff --git a/src/apps/terminal/TermConst.cpp b/src/apps/terminal/TermConst.cpp index f04adb6d63..e3d5efa1c6 100644 --- a/src/apps/terminal/TermConst.cpp +++ b/src/apps/terminal/TermConst.cpp @@ -25,6 +25,7 @@ const char* const kTooTipSetWindowTitlePlaceholders = B_TRANSLATE( "\t%d\t-\tThe current working directory of the active process in the\n" "\t\t\tcurrent tab. Optionally the maximum number of path components\n" "\t\t\tcan be specified. E.g. '%2d' for at most two components.\n" + "\t%T\t-\tThe Terminal application name for the current locale.\n" "\t%i\t-\tThe index of the window.\n" "\t%p\t-\tThe name of the active process in the current tab.\n" "\t%t\t-\tThe title of the current tab.\n" diff --git a/src/apps/terminal/TermWindow.cpp b/src/apps/terminal/TermWindow.cpp index cd2701fdf6..239201d47e 100644 --- a/src/apps/terminal/TermWindow.cpp +++ b/src/apps/terminal/TermWindow.cpp @@ -465,7 +465,7 @@ TermWindow::_SetupMenu() BLayoutBuilder::Menu<>(fMenuBar = new BMenuBar(Bounds(), "mbar")) // Terminal - .AddMenu(B_TRANSLATE_SYSTEM_NAME("Terminal")) + .AddMenu(B_TRANSLATE("Terminal")) .AddItem(B_TRANSLATE("Switch Terminals"), MENU_SWITCH_TERM, B_TAB) .GetItem(fSwitchTerminalsMenuItem) .AddItem(B_TRANSLATE("New Terminal"), MENU_NEW_TERM, 'N') diff --git a/src/apps/terminal/TitlePlaceholderMapper.cpp b/src/apps/terminal/TitlePlaceholderMapper.cpp index 304270ba76..b5ec9b4138 100644 --- a/src/apps/terminal/TitlePlaceholderMapper.cpp +++ b/src/apps/terminal/TitlePlaceholderMapper.cpp @@ -4,6 +4,8 @@ */ +#include + #include "TitlePlaceholderMapper.h" @@ -80,6 +82,11 @@ WindowTitlePlaceholderMapper::MapPlaceholder(char placeholder, int64 number, bool numberGiven, BString& _string) { switch (placeholder) { + case 'T': + // The Terminal application name for the current locale + _string = B_TRANSLATE_SYSTEM_NAME("Terminal"); + return true; + case 'i': // window index _string.Truncate(0);