[nautilus-actions] Use gettext() to display localized static strings
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Use gettext() to display localized static strings
- Date: Sat, 8 Jan 2011 17:35:12 +0000 (UTC)
commit 70b3efd45528e11e53e526692c154c941f320eee
Author: Pierre Wieser <pwieser trychlos org>
Date: Sat Jan 8 18:08:40 2011 +0100
Use gettext() to display localized static strings
ChangeLog | 18 ++++++++++++++++++
src/core/na-data-boxed.c | 21 +++++++++++----------
src/core/na-export-format.c | 6 ++++--
src/core/na-iabout.c | 16 ++++++++++++----
src/core/na-object-action.c | 5 +++--
src/core/na-object-menu.c | 2 +-
src/io-xml/naxml-writer.c | 5 +++--
src/nact/nact-add-capability-dialog.c | 3 ++-
src/nact/nact-ienvironment-tab.c | 5 +++--
src/nact/nact-iproperties-tab.c | 3 ++-
src/nact/nact-main-menubar-file.c | 11 ++++++-----
src/nact/nact-match-list.c | 5 +++--
src/nact/nact-tree-model-dnd.c | 15 ++++++++-------
13 files changed, 76 insertions(+), 39 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 381c3ab..39104da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
2011-01-08 Pierre Wieser <pwieser trychlos org>
+ * src/core/na-data-boxed.c
+ (string_spec, slist_spec, bool_spec, pointer_spec, uint_spec):
+ * src/core/na-export-format.c
+ (na_export_format_get_label, na_export_format_get_description):
+ * src/core/na-iabout.c (na_iabout_display):
+ * src/core/na-object-action.c (na_object_action_new_with_defaults):
+ * src/core/na-object-menu.c (na_object_menu_new_with_defaults):
+ * src/io-xml/naxml-writer.c (write_data_schema_v1_element):
+ * src/nact/nact-add-capability-dialog.c (on_base_runtime_init_dialog):
+ * src/nact/nact-ienvironment-tab.c (nact_ienvironment_tab_runtime_init_toplevel):
+ * src/nact/nact-iproperties-tab.c (on_tab_updatable_selection_changed):
+ * src/nact/nact-main-menubar-file.c (nact_main_menubar_file_save_items):
+ * src/nact/nact-match-list.c (get_must_match_header, insert_new_row):
+ * src/nact/nact-tree-model-dnd.c
+ (is_drop_possible, is_drop_possible_before_iter,
+ is_drop_possible_into_dest, is_parent_accept_new_childs):
+ Use gettext() to display localized static strings.
+
* src/api/na-data-def.h: Complete the description of the fields.
* src/core/na-io-provider.c:
diff --git a/src/core/na-data-boxed.c b/src/core/na-data-boxed.c
index 54f604d..7ad40d8 100644
--- a/src/core/na-data-boxed.c
+++ b/src/core/na-data-boxed.c
@@ -32,6 +32,7 @@
#include <config.h>
#endif
+#include <libintl.h>
#include <stdlib.h>
#include <string.h>
@@ -852,8 +853,8 @@ string_spec( const NADataDef *def )
{
return( g_param_spec_string(
def->name,
- def->short_label,
- def->long_label,
+ gettext( def->short_label ),
+ gettext( def->long_label ),
def->default_value,
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
}
@@ -1041,8 +1042,8 @@ slist_spec( const NADataDef *def )
{
return( g_param_spec_pointer(
def->name,
- def->short_label,
- def->long_label,
+ gettext( def->short_label ),
+ gettext( def->long_label ),
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
}
@@ -1185,8 +1186,8 @@ bool_spec( const NADataDef *def )
{
return( g_param_spec_boolean(
def->name,
- def->short_label,
- def->long_label,
+ gettext( def->short_label ),
+ gettext( def->long_label ),
na_core_utils_boolean_from_string( def->default_value ),
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
}
@@ -1277,8 +1278,8 @@ pointer_spec( const NADataDef *def )
{
return( g_param_spec_pointer(
def->name,
- def->short_label,
- def->long_label,
+ gettext( def->short_label ),
+ gettext( def->long_label ),
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
}
@@ -1373,8 +1374,8 @@ uint_spec( const NADataDef *def )
{
return( g_param_spec_uint(
def->name,
- def->short_label,
- def->long_label,
+ gettext( def->short_label ),
+ gettext( def->long_label ),
0,
UINT_MAX,
atoi( def->default_value ),
diff --git a/src/core/na-export-format.c b/src/core/na-export-format.c
index 4313f6b..c3b59dc 100644
--- a/src/core/na-export-format.c
+++ b/src/core/na-export-format.c
@@ -32,6 +32,8 @@
#include <config.h>
#endif
+#include <libintl.h>
+
#include "na-export-format.h"
/* private class data
@@ -256,7 +258,7 @@ na_export_format_get_label( const NAExportFormat *format )
if( !format->private->dispose_has_run ){
- label = g_strdup( format->private->str->label );
+ label = g_strdup( gettext( format->private->str->label ));
}
return( label );
@@ -280,7 +282,7 @@ na_export_format_get_description( const NAExportFormat *format )
if( !format->private->dispose_has_run ){
- description = g_strdup( format->private->str->description );
+ description = g_strdup( gettext( format->private->str->description ));
}
return( description );
diff --git a/src/core/na-iabout.c b/src/core/na-iabout.c
index 947575f..1579ade 100644
--- a/src/core/na-iabout.c
+++ b/src/core/na-iabout.c
@@ -33,6 +33,7 @@
#endif
#include <glib/gi18n.h>
+#include <libintl.h>
#include "na-iabout.h"
@@ -152,8 +153,10 @@ na_iabout_display( NAIAbout *instance )
{
static const gchar *thisfn = "na_iabout_display";
gchar *application_name;
- gchar *icon_name, *license_i18n, *copyright;
+ gchar *icon_name, *copyright;
+ int i;
GtkWindow *toplevel;
+ GString *license_i18n;
static const gchar *artists[] = {
"Ulisse Perusin <uli peru gmail com>",
@@ -198,7 +201,12 @@ na_iabout_display( NAIAbout *instance )
icon_name = na_iabout_get_icon_name();
copyright = na_iabout_get_copyright( FALSE );
- license_i18n = g_strjoinv( "\n\n", license );
+ i = 0;
+ license_i18n = g_string_new( "" );
+ while( license[i] ){
+ g_string_append_printf( license_i18n, "%s\n\n", gettext( license[i] ));
+ i += 1;
+ }
gtk_show_about_dialog( toplevel,
"artists", artists,
@@ -208,7 +216,7 @@ na_iabout_display( NAIAbout *instance )
"comments", _( "A graphical interface to create and edit your Nautilus actions." ),
"copyright", copyright,
"documenters", documenters,
- "license", license_i18n,
+ "license", license_i18n->str,
"logo-icon-name", icon_name,
"program-name", application_name,
"translator-credits", _( "The GNOME Translation Project <gnome-i18n gnome org>" ),
@@ -218,7 +226,7 @@ na_iabout_display( NAIAbout *instance )
NULL );
g_free( application_name );
- g_free( license_i18n );
+ g_string_free( license_i18n, TRUE );
g_free( copyright );
g_free( icon_name );
}
diff --git a/src/core/na-object-action.c b/src/core/na-object-action.c
index fa3f295..d303f10 100644
--- a/src/core/na-object-action.c
+++ b/src/core/na-object-action.c
@@ -33,6 +33,7 @@
#endif
#include <glib/gi18n.h>
+#include <libintl.h>
#include <string.h>
#include <stdlib.h>
@@ -653,8 +654,8 @@ na_object_action_new_with_defaults( void )
action = na_object_action_new();
na_object_set_new_id( action, NULL );
- na_object_set_label( action, NEW_NAUTILUS_ACTION );
- na_object_set_toolbar_label( action, NEW_NAUTILUS_ACTION );
+ na_object_set_label( action, gettext( NEW_NAUTILUS_ACTION ));
+ na_object_set_toolbar_label( action, gettext( NEW_NAUTILUS_ACTION ));
na_factory_object_set_defaults( NA_IFACTORY_OBJECT( action ));
profile = na_object_profile_new_with_defaults();
diff --git a/src/core/na-object-menu.c b/src/core/na-object-menu.c
index ac6d30c..cd72384 100644
--- a/src/core/na-object-menu.c
+++ b/src/core/na-object-menu.c
@@ -446,7 +446,7 @@ na_object_menu_new_with_defaults( void )
{
NAObjectMenu *menu = na_object_menu_new();
na_object_set_new_id( menu, NULL );
- na_object_set_label( menu, NEW_NAUTILUS_MENU );
+ na_object_set_label( menu, gettext( NEW_NAUTILUS_MENU ));
na_factory_object_set_defaults( NA_IFACTORY_OBJECT( menu ));
return( menu );
diff --git a/src/io-xml/naxml-writer.c b/src/io-xml/naxml-writer.c
index 08a131d..0c2daea 100644
--- a/src/io-xml/naxml-writer.c
+++ b/src/io-xml/naxml-writer.c
@@ -33,6 +33,7 @@
#endif
#include <gio/gio.h>
+#include <libintl.h>
#include <libxml/tree.h>
#include <string.h>
@@ -493,8 +494,8 @@ write_data_schema_v1_element( NAXMLWriter *writer, const NADataDef *def )
}
xmlNewChild( writer->private->schema_node, NULL, BAD_CAST( NAXML_KEY_SCHEMA_NODE_OWNER ), BAD_CAST( PACKAGE_TARNAME ));
- xmlNewChild( writer->private->locale_node, NULL, BAD_CAST( NAXML_KEY_SCHEMA_NODE_LOCALE_SHORT ), BAD_CAST( def->short_label ));
- xmlNewChild( writer->private->locale_node, NULL, BAD_CAST( NAXML_KEY_SCHEMA_NODE_LOCALE_LONG ), BAD_CAST( def->long_label ));
+ xmlNewChild( writer->private->locale_node, NULL, BAD_CAST( NAXML_KEY_SCHEMA_NODE_LOCALE_SHORT ), BAD_CAST( gettext( def->short_label )));
+ xmlNewChild( writer->private->locale_node, NULL, BAD_CAST( NAXML_KEY_SCHEMA_NODE_LOCALE_LONG ), BAD_CAST( gettext( def->long_label )));
}
static void
diff --git a/src/nact/nact-add-capability-dialog.c b/src/nact/nact-add-capability-dialog.c
index 7ed327b..e4c3d03 100644
--- a/src/nact/nact-add-capability-dialog.c
+++ b/src/nact/nact-add-capability-dialog.c
@@ -34,6 +34,7 @@
#include <gdk/gdkkeysyms.h>
#include <glib/gi18n.h>
+#include <libintl.h>
#include <api/na-core-utils.h>
@@ -386,7 +387,7 @@ on_base_runtime_init_dialog( NactAddCapabilityDialog *dialog, gpointer user_data
gtk_list_store_append( model, &row );
gtk_list_store_set( model, &row,
CAPABILITY_KEYWORD_COLUMN, st_caps[i].keyword,
- CAPABILITY_DESC_COLUMN, st_caps[i].desc,
+ CAPABILITY_DESC_COLUMN, gettext( st_caps[i].desc ),
CAPABILITY_ALREADY_USED_COLUMN, FALSE,
-1 );
}
diff --git a/src/nact/nact-ienvironment-tab.c b/src/nact/nact-ienvironment-tab.c
index 8a620ac..e907cab 100644
--- a/src/nact/nact-ienvironment-tab.c
+++ b/src/nact/nact-ienvironment-tab.c
@@ -33,6 +33,7 @@
#endif
#include <glib/gi18n.h>
+#include <libintl.h>
#include <stdlib.h>
#include <string.h>
@@ -296,7 +297,7 @@ nact_ienvironment_tab_runtime_init_toplevel( NactIEnvironmentTab *instance )
GTK_LIST_STORE( model ),
&iter,
ENV_BOOL_COLUMN, FALSE,
- ENV_LABEL_COLUMN, st_envs[i].label,
+ ENV_LABEL_COLUMN, gettext( st_envs[i].label ),
ENV_KEYWORD_COLUMN, st_envs[i].keyword,
-1 );
}
@@ -824,7 +825,7 @@ init_selection_count_combobox( NactIEnvironmentTab *instance )
while( st_counts[i].sign ){
gtk_list_store_append( GTK_LIST_STORE( model ), &row );
gtk_list_store_set( GTK_LIST_STORE( model ), &row, COUNT_SIGN_COLUMN, st_counts[i].sign, -1 );
- gtk_list_store_set( GTK_LIST_STORE( model ), &row, COUNT_LABEL_COLUMN, st_counts[i].label, -1 );
+ gtk_list_store_set( GTK_LIST_STORE( model ), &row, COUNT_LABEL_COLUMN, gettext( st_counts[i].label ), -1 );
i += 1;
}
diff --git a/src/nact/nact-iproperties-tab.c b/src/nact/nact-iproperties-tab.c
index ac9da7d..8161f64 100644
--- a/src/nact/nact-iproperties-tab.c
+++ b/src/nact/nact-iproperties-tab.c
@@ -33,6 +33,7 @@
#endif
#include <glib/gi18n.h>
+#include <libintl.h>
#include <string.h>
#include <api/na-object-api.h>
@@ -299,7 +300,7 @@ on_tab_updatable_selection_changed( NactIPropertiesTab *instance, gint count_sel
shortcut = item ? na_object_get_shortcut( item ) : g_strdup( "" );
if( !shortcut || !strlen( shortcut )){
g_free( shortcut );
- shortcut = g_strdup( NO_SHORTCUT );
+ shortcut = g_strdup( gettext( NO_SHORTCUT ));
}
gtk_button_set_label( GTK_BUTTON( shortcut_button ), shortcut );
g_free( shortcut );
diff --git a/src/nact/nact-main-menubar-file.c b/src/nact/nact-main-menubar-file.c
index 4dea860..9ae8d75 100644
--- a/src/nact/nact-main-menubar-file.c
+++ b/src/nact/nact-main-menubar-file.c
@@ -33,6 +33,7 @@
#endif
#include <glib/gi18n.h>
+#include <libintl.h>
#include <api/na-core-utils.h>
@@ -313,9 +314,9 @@ nact_main_menubar_file_save_items( NactMainWindow *window )
if( g_slist_length( messages )){
msg = na_core_utils_slist_join_at_end( messages, "\n" );
} else {
- msg = g_strdup( st_level_zero_write );
+ msg = g_strdup( gettext( st_level_zero_write ));
}
- base_window_error_dlg( BASE_WINDOW( window ), GTK_MESSAGE_ERROR, st_save_error, msg );
+ base_window_error_dlg( BASE_WINDOW( window ), GTK_MESSAGE_ERROR, gettext( st_save_error ), msg );
g_free( msg );
na_core_utils_slist_free( messages );
return;
@@ -331,9 +332,9 @@ nact_main_menubar_file_save_items( NactMainWindow *window )
if( g_slist_length( messages )){
msg = na_core_utils_slist_join_at_end( messages, "\n" );
} else {
- msg = g_strdup( st_delete_error );
+ msg = g_strdup( gettext( st_delete_error ));
}
- base_window_error_dlg( BASE_WINDOW( window ), GTK_MESSAGE_ERROR, st_save_error, msg );
+ base_window_error_dlg( BASE_WINDOW( window ), GTK_MESSAGE_ERROR, gettext( st_save_error ), msg );
g_free( msg );
na_core_utils_slist_free( messages );
return;
@@ -366,7 +367,7 @@ nact_main_menubar_file_save_items( NactMainWindow *window )
if( g_slist_length( messages )){
msg = na_core_utils_slist_join_at_end( messages, "\n" );
- base_window_error_dlg( BASE_WINDOW( window ), GTK_MESSAGE_WARNING, st_save_warning, msg );
+ base_window_error_dlg( BASE_WINDOW( window ), GTK_MESSAGE_WARNING, gettext( st_save_warning ), msg );
g_free( msg );
na_core_utils_slist_free( messages );
}
diff --git a/src/nact/nact-match-list.c b/src/nact/nact-match-list.c
index 36ee5bb..237c376 100644
--- a/src/nact/nact-match-list.c
+++ b/src/nact/nact-match-list.c
@@ -33,6 +33,7 @@
#endif
#include <glib/gi18n.h>
+#include <libintl.h>
#include <api/na-object-api.h>
#include <api/na-core-utils.h>
@@ -846,7 +847,7 @@ get_must_match_header( guint id )
for( i = 0 ; st_match_headers[i].header_id ; ++i ){
if( st_match_headers[i].header_id == id ){
- return( st_match_headers[i].header_label );
+ return( gettext( st_match_headers[i].header_label ));
}
}
@@ -871,7 +872,7 @@ insert_new_row( MatchListStr *data )
static const gchar *filter_label = N_( "new-filter" );
gchar *label;
- label = search_for_unique_label( filter_label, data );
+ label = search_for_unique_label( gettext( filter_label ), data );
insert_new_row_data( data, label, FALSE, FALSE );
g_free( label );
}
diff --git a/src/nact/nact-tree-model-dnd.c b/src/nact/nact-tree-model-dnd.c
index 92da51f..d1f2ff4 100644
--- a/src/nact/nact-tree-model-dnd.c
+++ b/src/nact/nact-tree-model-dnd.c
@@ -34,6 +34,7 @@
#include <gconf/gconf-client.h>
#include <glib/gi18n.h>
+#include <libintl.h>
#include <string.h>
#include <api/na-core-utils.h>
@@ -693,7 +694,7 @@ is_drop_possible( NactTreeModel *model, GtkTreePath *dest, NAObjectItem **parent
if( model->private->drag_has_profiles ){
nact_main_statusbar_display_with_timeout(
- main_window, TREE_MODEL_STATUSBAR_CONTEXT, st_refuse_drop_profile );
+ main_window, TREE_MODEL_STATUSBAR_CONTEXT, gettext( st_refuse_drop_profile ));
} else {
drop_ok = TRUE;
@@ -741,7 +742,7 @@ is_drop_possible_before_iter( NactTreeModel *model, GtkTreeIter *iter, NactMainW
} else {
/* unable to drop a profile here */
nact_main_statusbar_display_with_timeout(
- window, TREE_MODEL_STATUSBAR_CONTEXT, st_refuse_drop_profile );
+ window, TREE_MODEL_STATUSBAR_CONTEXT, gettext( st_refuse_drop_profile ));
}
} else if( NA_IS_OBJECT_ITEM( object )){
@@ -751,7 +752,7 @@ is_drop_possible_before_iter( NactTreeModel *model, GtkTreeIter *iter, NactMainW
} else {
/* unable to drop an action or a menu here */
nact_main_statusbar_display_with_timeout(
- window, TREE_MODEL_STATUSBAR_CONTEXT, st_refuse_drop_item );
+ window, TREE_MODEL_STATUSBAR_CONTEXT, gettext( st_refuse_drop_item ));
}
return( drop_ok );
@@ -785,7 +786,7 @@ is_drop_possible_into_dest( NactTreeModel *model, GtkTreePath *dest, NactMainWin
} else {
nact_main_statusbar_display_with_timeout(
- window, TREE_MODEL_STATUSBAR_CONTEXT, st_refuse_drop_profile );
+ window, TREE_MODEL_STATUSBAR_CONTEXT, gettext( st_refuse_drop_profile ));
}
} else if( NA_IS_OBJECT_MENU( object )){
@@ -794,7 +795,7 @@ is_drop_possible_into_dest( NactTreeModel *model, GtkTreePath *dest, NactMainWin
} else {
nact_main_statusbar_display_with_timeout(
- window, TREE_MODEL_STATUSBAR_CONTEXT, st_refuse_drop_item );
+ window, TREE_MODEL_STATUSBAR_CONTEXT, gettext( st_refuse_drop_item ));
}
}
}
@@ -1145,7 +1146,7 @@ is_parent_accept_new_childs( NactApplication *application, NactMainWindow *windo
} else {
nact_main_statusbar_display_with_timeout(
- window, TREE_MODEL_STATUSBAR_CONTEXT, st_level_zero_not_writable );
+ window, TREE_MODEL_STATUSBAR_CONTEXT, gettext( st_level_zero_not_writable ));
}
/* see if the parent is writable
@@ -1155,7 +1156,7 @@ is_parent_accept_new_childs( NactApplication *application, NactMainWindow *windo
} else {
nact_main_statusbar_display_with_timeout(
- window, TREE_MODEL_STATUSBAR_CONTEXT, st_parent_not_writable );
+ window, TREE_MODEL_STATUSBAR_CONTEXT, gettext( st_parent_not_writable ));
}
return( accept_ok );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]