diff options
27 files changed, 86 insertions, 48 deletions
diff --git a/Makefile.am b/Makefile.am index 5ea9edad..0baa6929 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,11 @@ include $(top_srcdir)/Makefile.shared +if USE_NLS +PO_SUBDIR = po +endif + SUBDIRS = \ - po \ + $(PO_SUBDIR) \ eel \ libcaja-extension \ mate-submodules \ diff --git a/configure.ac b/configure.ac index e6059872..9a4e037b 100644 --- a/configure.ac +++ b/configure.ac @@ -116,8 +116,9 @@ AC_DEFINE([HAVE_GTK_MULTIHEAD], [], [needed for egg-screen-exec functions]) AH_TEMPLATE([HAVE_STARTUP_NOTIFICATION]) AH_TEMPLATE([HAVE_EXIF]) -AM_GNU_GETTEXT_VERSION([0.19.8]) AM_GNU_GETTEXT([external]) +AM_GNU_GETTEXT_VERSION([0.19.8]) +AM_CONDITIONAL([USE_NLS], [test "x${USE_NLS}" = "xyes"]) dnl ========================================================================== @@ -313,6 +314,7 @@ Configure summary: warning flags: ${WARN_CFLAGS} xmp support: $msg_xmp PackageKit support: $msg_packagekit + Native Language support: $USE_NLS Self check: $msg_self_check caja-extension documentation: ${enable_gtk_doc} diff --git a/data/Makefile.am b/data/Makefile.am index f6e3d14f..bf98a1e6 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,11 +1,5 @@ NULL = -xml_in_files = caja.xml.in -xml_files = $(xml_in_files:.xml.in=.xml) - -%.xml: %.xml.in - $(AM_V_GEN) GETTEXTDATADIR=$(top_srcdir) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@ - desktopdir = $(datadir)/applications desktop_DATA = \ caja.desktop \ @@ -18,26 +12,38 @@ desktop_DATA = \ mate-network-scheme.desktop desktop_in_files = $(desktop_DATA:.desktop=.desktop.in) desktop_in_in_files = $(desktop_DATA:.desktop=.desktop.in.in) + %.desktop.in: %.desktop.in.in $(AM_V_GEN) sed -e 's|@bindir[@]|$(bindir)|g' $< > $@ + %.desktop: %.desktop.in +if USE_NLS $(AM_V_GEN) GETTEXTDATADIR=$(top_srcdir) $(MSGFMT) --desktop \ --keyword= --keyword=Name --keyword=GenericName --keyword=Comment --keyword=Keywords \ --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif mimedir = $(datadir)/mime/packages -mime_DATA = $(xml_files) +mime_DATA = caja.xml +mime_in_files = $(mime_DATA:.xml=.xml.in) + +$(mime_DATA): $(mime_in_files) +if USE_NLS + $(AM_V_GEN) GETTEXTDATADIR=$(top_srcdir) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif servicedir = $(datadir)/dbus-1/services +service_in_files = org.mate.freedesktop.FileManager1.service.in service_DATA = $(service_in_files:.service.in=.service) -service_in_files = \ - org.mate.freedesktop.FileManager1.service.in org.mate.freedesktop.FileManager1.service: org.mate.freedesktop.FileManager1.service.in Makefile $(AM_V_GEN) sed -e "s|\@bindir\@|$(bindir)|" $< > $@ cajadatadir = $(datadir)/caja -cajadata_in_files = browser.xml.in cajadata_DATA = \ browser.xml \ caja-extras.placeholder \ @@ -56,16 +62,20 @@ appdatadir = $(datadir)/metainfo appdata_in_in_files = caja.appdata.xml.in.in appdata_in_files = $(appdata_in_in_files:.appdata.xml.in.in=.appdata.xml.in) appdata_DATA = $(appdata_in_files:.xml.in=.xml) + $(appdata_DATA): $(appdata_in_files) +if USE_NLS $(AM_V_GEN) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif EXTRA_DIST = \ $(appdata_in_in_files) \ $(cajadata_DATA) \ - $(cajadata_in_files) \ $(desktop_in_in_files) \ + $(mime_in_files) \ $(service_in_files) \ - $(xml_in_files) \ freedesktop-dbus-interfaces.xml \ $(NULL) @@ -77,8 +87,8 @@ DISTCLEANFILES = \ CLEANFILES = \ $(appdata_DATA) \ $(desktop_DATA) \ + $(mime_DATA) \ $(service_DATA) \ - $(xml_files) \ $(NULL) SUBDIRS = \ diff --git a/data/browser.xml.in b/data/browser.xml index 25282dc5..25282dc5 100644 --- a/data/browser.xml.in +++ b/data/browser.xml diff --git a/docs/reference/libcaja-extension/Makefile.am b/docs/reference/libcaja-extension/Makefile.am index aa5047d2..46ec0a7d 100644 --- a/docs/reference/libcaja-extension/Makefile.am +++ b/docs/reference/libcaja-extension/Makefile.am @@ -37,7 +37,6 @@ CFILE_GLOB=$(top_srcdir)/libcaja-extension/*.c # Header files to ignore when scanning. IGNORE_HFILES = \ config.h \ - caja-extension-i18n.h \ $(NULL) # Images to copy into HTML directory diff --git a/libcaja-extension/Makefile.am b/libcaja-extension/Makefile.am index a33bebb9..a35b8882 100644 --- a/libcaja-extension/Makefile.am +++ b/libcaja-extension/Makefile.am @@ -42,7 +42,6 @@ libcaja_extension_la_SOURCES = \ caja-column-provider.c \ caja-column.c \ caja-widget-view-provider.c \ - caja-extension-i18n.h \ caja-extension-types.c \ caja-extension-private.h \ caja-file-info.c \ diff --git a/libcaja-extension/caja-column.c b/libcaja-extension/caja-column.c index bd3a23f3..db4b6440 100644 --- a/libcaja-extension/caja-column.c +++ b/libcaja-extension/caja-column.c @@ -22,9 +22,13 @@ * */ +#ifdef HAVE_CONFIG_H #include <config.h> +#endif + +#include <glib/gi18n-lib.h> + #include "caja-column.h" -#include "caja-extension-i18n.h" enum { PROP_0, diff --git a/libcaja-extension/caja-extension-i18n.h b/libcaja-extension/caja-extension-i18n.h deleted file mode 100644 index 34e1b3e6..00000000 --- a/libcaja-extension/caja-extension-i18n.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef CAJA_EXTENSION_I18N_H -#define CAJA_EXTENSION_I18N_H - -#include "config.h" - -#ifdef ENABLE_NLS -#include<libintl.h> -#define _(String) dgettext(GETTEXT_PACKAGE,String) -#ifdef gettext_noop -#define N_(String) gettext_noop(String) -#else -#define N_(String) (String) -#endif -#else /* NLS is disabled */ -#define _(String) (String) -#define N_(String) (String) -#define textdomain(String) (String) -#define gettext(String) (String) -#define dgettext(Domain,String) (String) -#define dcgettext(Domain,String,Type) (String) -#define bindtextdomain(Domain,Directory) (Domain) -#endif - -#endif diff --git a/libcaja-extension/caja-menu-item.c b/libcaja-extension/caja-menu-item.c index 054dd767..bc952218 100644 --- a/libcaja-extension/caja-menu-item.c +++ b/libcaja-extension/caja-menu-item.c @@ -22,9 +22,13 @@ * */ +#ifdef HAVE_CONFIG_H #include <config.h> +#endif + +#include <glib/gi18n-lib.h> + #include "caja-menu.h" -#include "caja-extension-i18n.h" enum { ACTIVATE, diff --git a/libcaja-extension/caja-menu.c b/libcaja-extension/caja-menu.c index 5ed0fd21..87e2f1a5 100644 --- a/libcaja-extension/caja-menu.c +++ b/libcaja-extension/caja-menu.c @@ -21,12 +21,15 @@ * */ +#ifdef HAVE_CONFIG_H #include <config.h> -#include "caja-menu.h" -#include "caja-extension-i18n.h" +#endif +#include <glib/gi18n-lib.h> #include <glib.h> +#include "caja-menu.h" + /** * SECTION:caja-menu * @title: CajaMenu diff --git a/libcaja-extension/caja-property-page.c b/libcaja-extension/caja-property-page.c index 461e19ea..cb5e1c74 100644 --- a/libcaja-extension/caja-property-page.c +++ b/libcaja-extension/caja-property-page.c @@ -22,10 +22,13 @@ * */ +#ifdef HAVE_CONFIG_H #include <config.h> -#include "caja-property-page.h" +#endif + +#include <glib/gi18n-lib.h> -#include "caja-extension-i18n.h" +#include "caja-property-page.h" enum { PROP_0, diff --git a/libcaja-private/caja-clipboard.c b/libcaja-private/caja-clipboard.c index 874909b4..1821d6ad 100644 --- a/libcaja-private/caja-clipboard.c +++ b/libcaja-private/caja-clipboard.c @@ -495,7 +495,9 @@ initialize_clipboard_component_with_callback_data (GtkEditable *target, G_GNUC_BEGIN_IGNORE_DEPRECATIONS; action_group = gtk_action_group_new ("ClipboardActions"); +#ifdef ENABLE_NLS gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ gtk_action_group_add_actions (action_group, clipboard_entries, G_N_ELEMENTS (clipboard_entries), target); diff --git a/libcaja-private/caja-ui-utilities.c b/libcaja-private/caja-ui-utilities.c index 1b621777..9b184164 100644 --- a/libcaja-private/caja-ui-utilities.c +++ b/libcaja-private/caja-ui-utilities.c @@ -63,7 +63,9 @@ caja_ui_prepare_merge_ui (GtkUIManager *ui_manager, *merge_id = gtk_ui_manager_new_merge_id (ui_manager); G_GNUC_BEGIN_IGNORE_DEPRECATIONS; *action_group = gtk_action_group_new (name); +#ifdef ENABLE_NLS gtk_action_group_set_translation_domain (*action_group, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ G_GNUC_END_IGNORE_DEPRECATIONS; gtk_ui_manager_insert_action_group (ui_manager, *action_group, 0); g_object_unref (*action_group); /* owned by ui manager */ diff --git a/po/POTFILES.in b/po/POTFILES.in index 4403a4ed..515c3bf7 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,6 +1,6 @@ # List of source files containing translatable strings. # Please keep this file sorted alphabetically. -data/browser.xml.in +data/browser.xml data/caja.appdata.xml.in.in data/caja-autorun-software.desktop.in.in data/caja-browser.desktop.in.in diff --git a/src/caja-autorun-software.c b/src/caja-autorun-software.c index c389144e..fef3c483 100644 --- a/src/caja-autorun-software.c +++ b/src/caja-autorun-software.c @@ -273,9 +273,11 @@ main (int argc, char *argv[]) GFile *file; GMount *mount; +#ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ gtk_init (&argc, &argv); diff --git a/src/caja-connect-server-dialog-main.c b/src/caja-connect-server-dialog-main.c index 9a9b3cf7..a31e3bd3 100644 --- a/src/caja-connect-server-dialog-main.c +++ b/src/caja-connect-server-dialog-main.c @@ -109,15 +109,19 @@ main (int argc, char *argv[]) GOptionContext *context; GError *error; +#ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ error = NULL; /* Translators: This is the --help description for the connect to server app, the initial newlines are between the command line arg and the description */ context = g_option_context_new (N_("\n\nAdd connect to server mount")); +#ifdef ENABLE_NLS g_option_context_set_translation_domain (context, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ g_option_context_add_group (context, gtk_get_option_group (TRUE)); if (!g_option_context_parse (context, &argc, &argv, &error)) diff --git a/src/caja-file-management-properties-main.c b/src/caja-file-management-properties-main.c index b2b79552..355a0bd4 100644 --- a/src/caja-file-management-properties-main.c +++ b/src/caja-file-management-properties-main.c @@ -45,9 +45,11 @@ caja_file_management_properties_main_close_callback (GtkDialog *dialog, int main (int argc, char *argv[]) { +#ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ gtk_init (&argc, &argv); diff --git a/src/caja-main.c b/src/caja-main.c index 1fb7e360..76fc2752 100644 --- a/src/caja-main.c +++ b/src/caja-main.c @@ -243,10 +243,12 @@ main (int argc, char *argv[]) eel_make_warnings_and_criticals_stop_in_debugger (); } +#ifdef ENABLE_NLS /* Initialize gettext support */ bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ g_set_prgname ("caja"); diff --git a/src/caja-navigation-window-menus.c b/src/caja-navigation-window-menus.c index 08b47212..93867743 100644 --- a/src/caja-navigation-window-menus.c +++ b/src/caja-navigation-window-menus.c @@ -946,7 +946,9 @@ caja_navigation_window_initialize_actions (CajaNavigationWindow *window) G_GNUC_BEGIN_IGNORE_DEPRECATIONS; action_group = gtk_action_group_new ("NavigationActions"); +#ifdef ENABLE_NLS gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ window->details->navigation_action_group = action_group; gtk_action_group_add_actions (action_group, navigation_entries, G_N_ELEMENTS (navigation_entries), diff --git a/src/caja-spatial-window.c b/src/caja-spatial-window.c index 50e00a2d..5fcb39fb 100644 --- a/src/caja-spatial-window.c +++ b/src/caja-spatial-window.c @@ -1045,7 +1045,9 @@ caja_spatial_window_init (CajaSpatialWindow *window) G_GNUC_BEGIN_IGNORE_DEPRECATIONS; action_group = gtk_action_group_new ("SpatialActions"); +#ifdef ENABLE_NLS gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ window->details->spatial_action_group = action_group; gtk_action_group_add_actions (action_group, spatial_entries, G_N_ELEMENTS (spatial_entries), diff --git a/src/caja-window-menus.c b/src/caja-window-menus.c index 953f4fb5..2e2b7b8b 100644 --- a/src/caja-window-menus.c +++ b/src/caja-window-menus.c @@ -990,7 +990,9 @@ caja_window_initialize_menus (CajaWindow *window) G_GNUC_BEGIN_IGNORE_DEPRECATIONS; action_group = gtk_action_group_new ("ShellActions"); +#ifdef ENABLE_NLS gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ window->details->main_action_group = action_group; gtk_action_group_add_actions (action_group, main_entries, G_N_ELEMENTS (main_entries), @@ -1190,7 +1192,9 @@ caja_window_load_extension_menus (CajaWindow *window) G_GNUC_BEGIN_IGNORE_DEPRECATIONS; action_group = gtk_action_group_new ("ExtensionsMenuGroup"); window->details->extensions_menu_action_group = action_group; +#ifdef ENABLE_NLS gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ G_GNUC_END_IGNORE_DEPRECATIONS; gtk_ui_manager_insert_action_group (window->details->ui_manager, action_group, 0); g_object_unref (action_group); /* owned by ui manager */ diff --git a/src/caja-window-toolbars.c b/src/caja-window-toolbars.c index 76426319..87fa627f 100644 --- a/src/caja-window-toolbars.c +++ b/src/caja-window-toolbars.c @@ -176,7 +176,9 @@ caja_navigation_window_load_extension_toolbar_items (CajaNavigationWindow *windo G_GNUC_BEGIN_IGNORE_DEPRECATIONS; action_group = gtk_action_group_new ("ExtensionsToolbarGroup"); window->details->extensions_toolbar_action_group = action_group; +#ifdef ENABLE_NLS gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ G_GNUC_END_IGNORE_DEPRECATIONS; gtk_ui_manager_insert_action_group (ui_manager, action_group, -1); g_object_unref (action_group); /* owned by ui manager */ diff --git a/src/caja-window.c b/src/caja-window.c index 640932c2..37dbb4ee 100644 --- a/src/caja-window.c +++ b/src/caja-window.c @@ -1423,7 +1423,9 @@ load_view_as_menu (CajaWindow *window) window->details->short_list_merge_id = merge_id; G_GNUC_BEGIN_IGNORE_DEPRECATIONS; window->details->view_as_action_group = gtk_action_group_new ("ViewAsGroup"); +#ifdef ENABLE_NLS gtk_action_group_set_translation_domain (window->details->view_as_action_group, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ G_GNUC_END_IGNORE_DEPRECATIONS; window->details->view_as_radio_action = NULL; diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c index aa40b2db..9d096fd2 100644 --- a/src/file-manager/fm-desktop-icon-view.c +++ b/src/file-manager/fm-desktop-icon-view.c @@ -803,7 +803,9 @@ real_merge_menus (FMDirectoryView *view) G_GNUC_BEGIN_IGNORE_DEPRECATIONS; action_group = gtk_action_group_new ("DesktopViewActions"); +#ifdef ENABLE_NLS gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ desktop_view->priv->desktop_action_group = action_group; gtk_action_group_add_actions (action_group, desktop_view_entries, G_N_ELEMENTS (desktop_view_entries), diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index ad10b01a..9425887b 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -7775,7 +7775,9 @@ real_merge_menus (FMDirectoryView *view) G_GNUC_BEGIN_IGNORE_DEPRECATIONS; action_group = gtk_action_group_new ("DirViewActions"); +#ifdef ENABLE_NLS gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ view->details->dir_action_group = action_group; gtk_action_group_add_actions (action_group, directory_view_entries, G_N_ELEMENTS (directory_view_entries), diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c index e8e33a49..828ac59f 100644 --- a/src/file-manager/fm-icon-view.c +++ b/src/file-manager/fm-icon-view.c @@ -1822,7 +1822,9 @@ fm_icon_view_merge_menus (FMDirectoryView *view) G_GNUC_BEGIN_IGNORE_DEPRECATIONS; action_group = gtk_action_group_new ("IconViewActions"); +#ifdef ENABLE_NLS gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ icon_view->details->icon_action_group = action_group; gtk_action_group_add_actions (action_group, icon_view_entries, G_N_ELEMENTS (icon_view_entries), diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c index e544cdd8..39e4bcdb 100644 --- a/src/file-manager/fm-list-view.c +++ b/src/file-manager/fm-list-view.c @@ -2648,7 +2648,9 @@ fm_list_view_merge_menus (FMDirectoryView *view) G_GNUC_BEGIN_IGNORE_DEPRECATIONS; action_group = gtk_action_group_new ("ListViewActions"); +#ifdef ENABLE_NLS gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ list_view->details->list_action_group = action_group; gtk_action_group_add_actions (action_group, list_view_entries, G_N_ELEMENTS (list_view_entries), |