13
0

Simple ambiguitity-resolution wrapper for gettext; use for

Manual (#4496).


git-svn-id: svn://localhost/ardour2/branches/3.0@10720 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-11-21 00:04:44 +00:00
parent 1ca3930e7a
commit 5c73926324
8 changed files with 34 additions and 8 deletions

View File

@ -246,7 +246,8 @@ ARDOUR_UI::install_actions ()
ActionManager::session_sensitive_actions.push_back (act); ActionManager::session_sensitive_actions.push_back (act);
ActionManager::register_action (common_actions, X_("About"), _("About"), sigc::mem_fun(*this, &ARDOUR_UI::show_about)); ActionManager::register_action (common_actions, X_("About"), _("About"), sigc::mem_fun(*this, &ARDOUR_UI::show_about));
ActionManager::register_action (common_actions, X_("Chat"), _("Chat"), sigc::mem_fun(*this, &ARDOUR_UI::launch_chat)); ActionManager::register_action (common_actions, X_("Chat"), _("Chat"), sigc::mem_fun(*this, &ARDOUR_UI::launch_chat));
ActionManager::register_action (common_actions, X_("Manual"), _("Manual"), mem_fun(*this, &ARDOUR_UI::launch_manual)); /** TRANSLATORS: This is `Manual' in the sense of an instruction book that tells a user how to use Ardour */
ActionManager::register_action (common_actions, X_("Manual"), S_("Help|Manual"), mem_fun(*this, &ARDOUR_UI::launch_manual));
ActionManager::register_action (common_actions, X_("Reference"), _("Reference"), mem_fun(*this, &ARDOUR_UI::launch_reference)); ActionManager::register_action (common_actions, X_("Reference"), _("Reference"), mem_fun(*this, &ARDOUR_UI::launch_reference));
ActionManager::register_toggle_action (common_actions, X_("ToggleThemeManager"), _("Theme Manager"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_theme_manager)); ActionManager::register_toggle_action (common_actions, X_("ToggleThemeManager"), _("Theme Manager"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_theme_manager));
ActionManager::register_toggle_action (common_actions, X_("ToggleKeyEditor"), _("Key Bindings"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_key_editor)); ActionManager::register_toggle_action (common_actions, X_("ToggleKeyEditor"), _("Key Bindings"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_key_editor));

View File

@ -249,7 +249,7 @@ AutomationTimeAxisView::auto_clicked ()
automation_menu->set_name ("ArdourContextMenu"); automation_menu->set_name ("ArdourContextMenu");
MenuList& items (automation_menu->items()); MenuList& items (automation_menu->items());
items.push_back (MenuElem (_("Manual"), sigc::bind (sigc::mem_fun(*this, items.push_back (MenuElem (S_("Automation|Manual"), sigc::bind (sigc::mem_fun(*this,
&AutomationTimeAxisView::set_automation_state), (AutoState) Off))); &AutomationTimeAxisView::set_automation_state), (AutoState) Off)));
items.push_back (MenuElem (_("Play"), sigc::bind (sigc::mem_fun(*this, items.push_back (MenuElem (_("Play"), sigc::bind (sigc::mem_fun(*this,
&AutomationTimeAxisView::set_automation_state), (AutoState) Play))); &AutomationTimeAxisView::set_automation_state), (AutoState) Play)));
@ -301,7 +301,7 @@ AutomationTimeAxisView::automation_state_changed ()
switch (state & (Off|Play|Touch|Write)) { switch (state & (Off|Play|Touch|Write)) {
case Off: case Off:
auto_button.set_label (_("Manual")); auto_button.set_label (S_("Automation|Manual"));
if (auto_off_item) { if (auto_off_item) {
ignore_state_request = true; ignore_state_request = true;
auto_off_item->set_active (true); auto_off_item->set_active (true);
@ -501,7 +501,7 @@ AutomationTimeAxisView::build_display_menu ()
auto_state_menu->set_name ("ArdourContextMenu"); auto_state_menu->set_name ("ArdourContextMenu");
MenuList& as_items = auto_state_menu->items(); MenuList& as_items = auto_state_menu->items();
as_items.push_back (CheckMenuElem (_("Manual"), sigc::bind ( as_items.push_back (CheckMenuElem (S_("Automation|Manual"), sigc::bind (
sigc::mem_fun(*this, &AutomationTimeAxisView::set_automation_state), sigc::mem_fun(*this, &AutomationTimeAxisView::set_automation_state),
(AutoState) Off))); (AutoState) Off)));
auto_off_item = dynamic_cast<CheckMenuItem*>(&as_items.back()); auto_off_item = dynamic_cast<CheckMenuItem*>(&as_items.back());

View File

@ -204,7 +204,7 @@ GainMeterBase::set_controls (boost::shared_ptr<Route> r,
gain_astate_menu.items().clear (); gain_astate_menu.items().clear ();
gain_astate_menu.items().push_back (MenuElem (_("Manual"), gain_astate_menu.items().push_back (MenuElem (S_("Automation|Manual"),
sigc::bind (sigc::mem_fun (*(amp.get()), &Automatable::set_parameter_automation_state), sigc::bind (sigc::mem_fun (*(amp.get()), &Automatable::set_parameter_automation_state),
Evoral::Parameter(GainAutomation), (AutoState) Off))); Evoral::Parameter(GainAutomation), (AutoState) Off)));
gain_astate_menu.items().push_back (MenuElem (_("Play"), gain_astate_menu.items().push_back (MenuElem (_("Play"),

View File

@ -445,7 +445,7 @@ GenericPluginUI::automation_state_changed (ControlUI* cui)
switch (insert->get_parameter_automation_state (cui->parameter()) switch (insert->get_parameter_automation_state (cui->parameter())
& (Off|Play|Touch|Write)) { & (Off|Play|Touch|Write)) {
case Off: case Off:
cui->automate_button.set_label (_("Manual")); cui->automate_button.set_label (S_("Automation|Manual"));
break; break;
case Play: case Play:
cui->automate_button.set_label (_("Play")); cui->automate_button.set_label (_("Play"));
@ -696,7 +696,7 @@ GenericPluginUI::astate_clicked (ControlUI* cui, uint32_t /*port*/)
MenuList& items (automation_menu->items()); MenuList& items (automation_menu->items());
items.clear (); items.clear ();
items.push_back (MenuElem (_("Manual"), items.push_back (MenuElem (S_("Automation|Manual"),
sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Off, cui))); sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Off, cui)));
items.push_back (MenuElem (_("Play"), items.push_back (MenuElem (_("Play"),
sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Play, cui))); sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Play, cui)));

View File

@ -31,5 +31,9 @@
#define N_(Text) gettext_noop (Text) #define N_(Text) gettext_noop (Text)
#define X_(Text) Text #define X_(Text) Text
#define I18N(Array) PBD::internationalize (PACKAGE, Array) #define I18N(Array) PBD::internationalize (PACKAGE, Array)
/** Use this to translate strings that have different meanings in different places.
* Text should be of the form Context|Message.
*/
#define S_(Text) sgettext (PACKAGE, Text)
#endif // __i18n_h__ #endif // __i18n_h__

View File

@ -144,7 +144,10 @@ PannerUI::build_astate_menu ()
pan_astate_menu->items().clear (); pan_astate_menu->items().clear ();
} }
pan_astate_menu->items().push_back (MenuElem (_("Manual"), sigc::bind ( /** TRANSLATORS: this is `Manual' in the sense of automation not being played,
so that changes to pan must be done by hand.
*/
pan_astate_menu->items().push_back (MenuElem (S_("Automation|Manual"), sigc::bind (
sigc::mem_fun (_panner.get(), &Panner::set_automation_state), sigc::mem_fun (_panner.get(), &Panner::set_automation_state),
(AutoState) Off))); (AutoState) Off)));
pan_astate_menu->items().push_back (MenuElem (_("Play"), sigc::bind ( pan_astate_menu->items().push_back (MenuElem (_("Play"), sigc::bind (

View File

@ -22,6 +22,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <cstdio> #include <cstdio>
#include <ctype.h> #include <ctype.h>
#include <cstring>
#ifndef __STDC_FORMAT_MACROS #ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS
#endif #endif
@ -325,5 +326,19 @@ strings_equal_ignore_case (const string& a, const string& b)
return false; return false;
} }
/** A wrapper for dgettext that takes a msgid of the form Context|Text.
* If Context|Text is translated, the translation is returned, otherwise
* just Text is returned. Useful for getting translations of words or phrases
* that have different meanings in different contexts.
*/
const char *
sgettext (const char* domain_name, const char* msgid)
{
const char * msgval = dgettext (domain_name, msgid);
if (msgval == msgid) {
msgval = strrchr (msgid, '|') + 1;
}
return msgval;
}
} // namespace PBD } // namespace PBD

View File

@ -54,6 +54,9 @@ to_string (T t, std::ios_base & (*f)(std::ios_base&))
return oss.str(); return oss.str();
} }
const char *
sgettext (const char *, const char *);
} //namespace PBD } //namespace PBD
#endif /* __pbd_convert_h__ */ #endif /* __pbd_convert_h__ */