use ngettext() for the close dialog. Fixes bug #396513.
2007-01-15 Sven Neumann <sven@gimp.org> * app/display/gimpdisplayshell-close.c: use ngettext() for the close dialog. Fixes bug #396513. svn path=/trunk/; revision=21709
This commit is contained in:

committed by
Sven Neumann

parent
56db462ee7
commit
6a6d5e2cf7
@ -1,3 +1,8 @@
|
|||||||
|
2007-01-15 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/display/gimpdisplayshell-close.c: use ngettext() for the
|
||||||
|
close dialog. Fixes bug #396513.
|
||||||
|
|
||||||
2007-01-14 Hans Breuer <hans@breuer.org>
|
2007-01-14 Hans Breuer <hans@breuer.org>
|
||||||
|
|
||||||
* plug-ins/script-fu/tinyscheme/scheme.[ch] : to make it compile with
|
* plug-ins/script-fu/tinyscheme/scheme.[ch] : to make it compile with
|
||||||
|
@ -57,8 +57,8 @@ static void gimp_display_shell_close_response (GtkWidget *widget
|
|||||||
GimpDisplayShell *shell);
|
GimpDisplayShell *shell);
|
||||||
|
|
||||||
static void gimp_time_since (guint then,
|
static void gimp_time_since (guint then,
|
||||||
gchar **hours,
|
gint *hours,
|
||||||
gchar **minutes);
|
gint *minutes);
|
||||||
|
|
||||||
|
|
||||||
/* public functions */
|
/* public functions */
|
||||||
@ -220,26 +220,44 @@ gimp_display_shell_close_time_changed (GimpMessageBox *box)
|
|||||||
|
|
||||||
if (image->dirty_time)
|
if (image->dirty_time)
|
||||||
{
|
{
|
||||||
gchar *hours = NULL;
|
gint hours = 0;
|
||||||
gchar *minutes = NULL;
|
gint minutes = 0;
|
||||||
|
|
||||||
gimp_time_since (image->dirty_time, &hours, &minutes);
|
gimp_time_since (image->dirty_time, &hours, &minutes);
|
||||||
|
|
||||||
if (hours && minutes)
|
if (hours > 0)
|
||||||
/* time period ("... from the last 3 hours and 20 minutes ...") */
|
{
|
||||||
|
if (hours > 1 || minutes == 0)
|
||||||
gimp_message_box_set_text (box,
|
gimp_message_box_set_text (box,
|
||||||
_("If you don't save the image, changes "
|
ngettext ("If you don't save the image, "
|
||||||
"from the last %s and %s will be lost."),
|
"changes from the last hour "
|
||||||
hours, minutes);
|
"will be lost.",
|
||||||
else
|
"If you don't save the image, "
|
||||||
/* time period ("... from the last 20 minutes ...") */
|
"changes from the last %d "
|
||||||
gimp_message_box_set_text (box,
|
"hours will be lost.",
|
||||||
_("If you don't save the image, changes "
|
hours), hours);
|
||||||
"from the last %s will be lost."),
|
|
||||||
hours ? hours : minutes);
|
|
||||||
|
|
||||||
g_free (hours);
|
else
|
||||||
g_free (minutes);
|
gimp_message_box_set_text (box,
|
||||||
|
ngettext ("If you don't save the image, "
|
||||||
|
"changes from the last hour "
|
||||||
|
"and %d minute will be lost.",
|
||||||
|
"If you don't save the image, "
|
||||||
|
"changes from the last hour "
|
||||||
|
"and %d minutes will be lost.",
|
||||||
|
minutes), minutes);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gimp_message_box_set_text (box,
|
||||||
|
ngettext ("If you don't save the image, "
|
||||||
|
"changes from the last minute "
|
||||||
|
"will be lost.",
|
||||||
|
"If you don't save the image, "
|
||||||
|
"changes from the last %d "
|
||||||
|
"minutes will be lost.",
|
||||||
|
minutes), minutes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -274,15 +292,12 @@ gimp_display_shell_close_response (GtkWidget *widget,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_time_since (guint then,
|
gimp_time_since (guint then,
|
||||||
gchar **hours,
|
gint *hours,
|
||||||
gchar **minutes)
|
gint *minutes)
|
||||||
{
|
{
|
||||||
guint now = time (NULL);
|
guint now = time (NULL);
|
||||||
guint diff = 1 + now - then;
|
guint diff = 1 + now - then;
|
||||||
|
|
||||||
*minutes = NULL;
|
|
||||||
*hours = NULL;
|
|
||||||
|
|
||||||
g_return_if_fail (now >= then);
|
g_return_if_fail (now >= then);
|
||||||
|
|
||||||
/* first round up to the nearest minute */
|
/* first round up to the nearest minute */
|
||||||
@ -296,11 +311,9 @@ gimp_time_since (guint then,
|
|||||||
|
|
||||||
if (diff >= 120)
|
if (diff >= 120)
|
||||||
{
|
{
|
||||||
*hours = g_strdup_printf (ngettext ("%d hour", "%d hours",
|
*hours = diff / 60;
|
||||||
diff / 60), diff / 60);
|
|
||||||
diff = (diff % 60);
|
diff = (diff % 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (diff > 0)
|
*minutes = diff;
|
||||||
*minutes = g_strdup_printf (ngettext ("minute", "%d minutes", diff), diff);
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user