[nautilus-actions] Initialize translation domain for GOptionContext



commit e29ac4df2c965dd3ea82f596ac084921cac8e4e7
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sat Jan 8 18:11:05 2011 +0100

    Initialize translation domain for GOptionContext

 ChangeLog                            |    5 +++++
 TODO                                 |    3 ---
 src/utils/nautilus-actions-new.c     |   15 +++++++++++----
 src/utils/nautilus-actions-run.c     |    3 +++
 src/utils/nautilus-actions-schemas.c |    9 ++++++---
 5 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 39104da..04e92f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-01-08 Pierre Wieser <pwieser trychlos org>
 
+	* src/utils/nautilus-actions-new.c (init_options):
+	* src/utils/nautilus-actions-run.c (init_options):
+	* src/utils/nautilus-actions-schemas.c (init_options):
+	Initialize translation domain for GOptionContext.
+
 	* src/core/na-data-boxed.c
 	(string_spec, slist_spec, bool_spec, pointer_spec, uint_spec):
 	* src/core/na-export-format.c
diff --git a/TODO b/TODO
index 7ad126f..7e79957 100644
--- a/TODO
+++ b/TODO
@@ -1,8 +1,5 @@
 N-A BUGS
 ========
-- (Grumz, 2007 or before) i18n doen't works in the command line tool and for some part
-  of NACT like the scheme list, it seems..?
-
 - when error on writing, should let the item modified
 
 TODO
diff --git a/src/utils/nautilus-actions-new.c b/src/utils/nautilus-actions-new.c
index 0f78043..2bb9b35 100644
--- a/src/utils/nautilus-actions-new.c
+++ b/src/utils/nautilus-actions-new.c
@@ -163,6 +163,7 @@ main( int argc, char** argv )
 	gint errors;
 
 	g_type_init();
+	setlocale( LC_ALL, "" );
 	console_init_log_handler();
 
 	context = init_options();
@@ -313,10 +314,14 @@ init_options( void )
 	GOptionGroup *misc_group;
 	GOptionEntry *entries;
 
-	context = g_option_context_new( _( "Define a new action.\n\n"
-			"  The created action defaults to be written to stdout.\n"
-			"  It can also be written to an output folder, in a file later suitable for an import in NACT.\n"
-			"  Or you may choose to directly write the action into your GConf configuration." ));
+	context = g_option_context_new( _( "Define a new action." ));
+
+	g_option_context_set_summary( context, _(
+			"The created action defaults to be written to stdout.\n"
+			"It can also be written to an output folder, in a file later suitable for an import in NACT.\n"
+			"Or you may choose to directly write the action into your GConf configuration." ));
+
+	g_option_context_set_translation_domain( context, GETTEXT_PACKAGE );
 
 	entries = build_option_entries( st_arg_from_data_def, G_N_ELEMENTS( st_arg_from_data_def ), st_added_entries, G_N_ELEMENTS( st_added_entries ) );
 
@@ -340,11 +345,13 @@ init_options( void )
 	output_group = g_option_group_new(
 			"output", _( "Output of the program" ), _( "Choose where the program creates the action" ), NULL, NULL );
 	g_option_group_add_entries( output_group, output_entries );
+	g_option_group_set_translation_domain( output_group, GETTEXT_PACKAGE );
 	g_option_context_add_group( context, output_group );
 
 	misc_group = g_option_group_new(
 			"misc", _( "Miscellaneous options" ), _( "Miscellaneous options" ), NULL, NULL );
 	g_option_group_add_entries( misc_group, misc_entries );
+	g_option_group_set_translation_domain( misc_group, GETTEXT_PACKAGE );
 	g_option_context_add_group( context, misc_group );
 
 	return( context );
diff --git a/src/utils/nautilus-actions-run.c b/src/utils/nautilus-actions-run.c
index 14d6ed1..5278acf 100644
--- a/src/utils/nautilus-actions-run.c
+++ b/src/utils/nautilus-actions-run.c
@@ -92,6 +92,7 @@ main( int argc, char** argv )
 	GList *targets;
 
 	g_type_init();
+	setlocale( LC_ALL, "" );
 	console_init_log_handler();
 
 	context = init_options();
@@ -178,6 +179,7 @@ init_options( void )
 	GOptionGroup *misc_group;
 
 	context = g_option_context_new( _( "Execute an action on the specified target." ));
+	g_option_context_set_translation_domain( context, GETTEXT_PACKAGE );
 
 #ifdef ENABLE_NLS
 	bindtextdomain( GETTEXT_PACKAGE, GNOMELOCALEDIR );
@@ -197,6 +199,7 @@ init_options( void )
 	misc_group = g_option_group_new(
 			"misc", _( "Miscellaneous options" ), _( "Miscellaneous options" ), NULL, NULL );
 	g_option_group_add_entries( misc_group, misc_entries );
+	g_option_group_set_translation_domain( misc_group, GETTEXT_PACKAGE );
 	g_option_context_add_group( context, misc_group );
 
 	return( context );
diff --git a/src/utils/nautilus-actions-schemas.c b/src/utils/nautilus-actions-schemas.c
index 389cd2e..aed0576 100644
--- a/src/utils/nautilus-actions-schemas.c
+++ b/src/utils/nautilus-actions-schemas.c
@@ -109,6 +109,7 @@ main( int argc, char** argv )
 	GSList *im;
 
 	g_type_init();
+	setlocale( LC_ALL, "" );
 	console_init_log_handler();
 
 	context = init_options();
@@ -159,7 +160,8 @@ init_options( void )
 	gchar *description;
 	GOptionGroup *misc_group;
 
-	context = g_option_context_new( _( "Output the Nautilus-Actions GConf schema on stdout." ));
+	context = g_option_context_new( _( "Output the Nautilus-Actions GConf schemas on stdout." ));
+	g_option_context_set_translation_domain( context, GETTEXT_PACKAGE );
 
 #ifdef ENABLE_NLS
 	bindtextdomain( GETTEXT_PACKAGE, GNOMELOCALEDIR );
@@ -179,6 +181,7 @@ init_options( void )
 	misc_group = g_option_group_new(
 			"misc", _( "Miscellaneous options" ), _( "Miscellaneous options" ), NULL, NULL );
 	g_option_group_add_entries( misc_group, misc_entries );
+	g_option_group_set_translation_domain( misc_group, GETTEXT_PACKAGE );
 	g_option_context_add_group( context, misc_group );
 
 	return( context );
@@ -345,9 +348,9 @@ attach_schema_node( xmlDocPtr doc, xmlNodePtr list_node, const NADataDef *def )
 	locale_node = xmlNewChild( schema_node, NULL, BAD_CAST( NAXML_KEY_SCHEMA_NODE_LOCALE ), NULL );
 	xmlNewProp( locale_node, BAD_CAST( "name" ), BAD_CAST( "C" ));
 
-	xmlNewChild( locale_node, NULL, BAD_CAST( NAXML_KEY_SCHEMA_NODE_LOCALE_SHORT ), BAD_CAST( def->short_label ));
+	xmlNewChild( locale_node, NULL, BAD_CAST( NAXML_KEY_SCHEMA_NODE_LOCALE_SHORT ), BAD_CAST( gettext( def->short_label )));
 
-	xmlNewChild( locale_node, NULL, BAD_CAST( NAXML_KEY_SCHEMA_NODE_LOCALE_LONG ), BAD_CAST( def->long_label ));
+	xmlNewChild( locale_node, NULL, BAD_CAST( NAXML_KEY_SCHEMA_NODE_LOCALE_LONG ), BAD_CAST( gettext( def->long_label )));
 
 	parent_value_node = def->localizable ? locale_node : schema_node;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]