From 259e70cab9bbcaec93b106df587f33681238ba50 Mon Sep 17 00:00:00 2001 From: rbuj Date: Mon, 8 Feb 2021 12:21:57 +0100 Subject: i18n: use g_dngettext instead of ngettext --- src/dlg-update.c | 22 +++++++++++++--------- src/fr-window.c | 28 +++++++++++++--------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/dlg-update.c b/src/dlg-update.c index 177dfdb..2ceb675 100644 --- a/src/dlg-update.c +++ b/src/dlg-update.c @@ -21,6 +21,8 @@ */ #include +#include + #include #include #include "dlg-update.h" @@ -119,7 +121,7 @@ update_cb (GtkWidget *widget, static void update_file_list (DialogData *data) { - gboolean n_files; + guint n_files; GList *scan; GtkTreeIter iter; @@ -172,10 +174,11 @@ update_file_list (DialogData *data) /* secondary text */ - label = g_strdup_printf (ngettext ("The file has been modified with an external application. If you don't update the file in the archive, all of your changes will be lost.", - "%d files have been modified with an external application. If you don't update the files in the archive, all of your changes will be lost.", - n_files), - n_files); + label = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, + "The file has been modified with an external application. If you don't update the file in the archive, all of your changes will be lost.", + "%u files have been modified with an external application. If you don't update the files in the archive, all of your changes will be lost.", + (gulong) n_files), + n_files); gtk_label_set_text (GTK_LABEL (data->update_file_secondary_text_label), label); g_free (label); } @@ -200,10 +203,11 @@ update_file_list (DialogData *data) /* secondary text */ - label = g_strdup_printf (ngettext ("The file has been modified with an external application. If you don't update the file in the archive, all of your changes will be lost.", - "%d files have been modified with an external application. If you don't update the files in the archive, all of your changes will be lost.", - n_files), - n_files); + label = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, + "The file has been modified with an external application. If you don't update the file in the archive, all of your changes will be lost.", + "%u files have been modified with an external application. If you don't update the files in the archive, all of your changes will be lost.", + (gulong) n_files), + n_files); gtk_label_set_text (GTK_LABEL (data->update_files_secondary_text_label), label); g_free (label); } diff --git a/src/fr-window.c b/src/fr-window.c index b2ab22b..9a30f5e 100644 --- a/src/fr-window.c +++ b/src/fr-window.c @@ -1418,8 +1418,10 @@ fr_window_update_statusbar_list_info (FrWindow *window) { char *info, *archive_info, *selected_info; char *size_txt, *sel_size_txt; - int tot_n, sel_n; - goffset tot_size, sel_size; + gulong tot_n = 0; + gulong sel_n = 0; + goffset tot_size = 0; + goffset sel_size = 0; GList *scan; if (window == NULL) @@ -1430,9 +1432,6 @@ fr_window_update_statusbar_list_info (FrWindow *window) return; } - tot_n = 0; - tot_size = 0; - if (window->priv->archive_present) { GPtrArray *files = fr_window_get_current_dir_list (window); guint i; @@ -1449,9 +1448,6 @@ fr_window_update_statusbar_list_info (FrWindow *window) g_ptr_array_free (files, TRUE); } - sel_n = 0; - sel_size = 0; - if (window->priv->archive_present) { GList *selection = get_selection_as_fd (window); @@ -1471,12 +1467,12 @@ fr_window_update_statusbar_list_info (FrWindow *window) if (tot_n == 0) archive_info = g_strdup (""); else - archive_info = g_strdup_printf (ngettext ("%d object (%s)", "%d objects (%s)", tot_n), tot_n, size_txt); + archive_info = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, "%lu object (%s)", "%lu objects (%s)", tot_n), tot_n, size_txt); if (sel_n == 0) selected_info = g_strdup (""); else - selected_info = g_strdup_printf (ngettext ("%d object selected (%s)", "%d objects selected (%s)", sel_n), sel_n, sel_size_txt); + selected_info = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, "%lu object selected (%s)", "%lu objects selected (%s)", sel_n), sel_n, sel_size_txt); info = g_strconcat (archive_info, ((sel_n == 0) ? NULL : ", "), @@ -2710,17 +2706,19 @@ fr_window_progress_cb (FrArchive *archive, if ((archive != NULL) && (archive->command != NULL) && (archive->command->n_files > 0)) { char *message = NULL; - int remaining_files; + gulong remaining_files; - remaining_files = archive->command->n_files - archive->command->n_file + 1; + remaining_files = (gulong) (archive->command->n_files - archive->command->n_file + 1); switch (window->priv->action) { case FR_ACTION_ADDING_FILES: case FR_ACTION_EXTRACTING_FILES: case FR_ACTION_DELETING_FILES: - message = g_strdup_printf (ngettext ("%d file remaining", - "%d files remaining", - remaining_files), remaining_files); + message = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, + "%lu file remaining", + "%lu files remaining", + remaining_files), + remaining_files); break; default: break; -- cgit v1.2.1