I have a problem with a menu where I would like to use context-based translations -
I have the menu defined as an array of GtkActionEntries in the style of:
Code:
static GtkActionEntry sMenuActions[] =
{
{ "FileMenuAction", NULL, N_("_File") },
{ "EditMenuAction", NULL, N_("_Edit") },
{ "ViewMenuAction", NULL, N_("_View") },
{ "HelpMenuAction", NULL, N_("_Help") },
{ "OpenProjectAction", GTK_STOCK_OPEN, NC_("File|","_Open project"), "<control>O", N_("Open Project"), G_CALLBACK(openproject_menu_cb) },
{ "SaveProjectAction", GTK_STOCK_SAVE, NC_("File|","_Save project"), "<control>S", N_("Save Project"), G_CALLBACK(saveproject_menu_cb) },
{
and add the menu to the window using code like this:
Code:
gtk_action_group_set_translation_domain(sActionGroup,PACKAGE);
gtk_action_group_add_actions(sActionGroup, sMenuActions, sNumMenuActions, NULL);
gtk_ui_manager_insert_action_group(sGtkUIManager, sActionGroup, 0);
if (gtk_ui_manager_add_ui_from_string(sGtkUIManager, sMenuDefXML, strlen(sMenuDefXML), &tempErr) == 0) {
But I don't get the context-based strings working - Is it even possible?
The non-context based strings (using N_) work just fine, but it seems like the NC_-ones doesn't.
I have noted that gtk_action_group_set_translation_domain () mentions that it uses g_dgettext() for translating, which only handles non-context-based strings - Is it possible to use both styles of translatable strings in a menu?