After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 760923 - Plural form for string "%d days ago"
Plural form for string "%d days ago"
Status: RESOLVED FIXED
Product: gnome-todo
Classification: Other
Component: User Interface
3.19.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME To Do maintainer(s)
GNOME To Do maintainer(s)
: 761644 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-01-21 07:53 UTC by Dušan
Modified: 2016-02-12 12:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Created plural form for given string. (963 bytes, patch)
2016-01-28 01:35 UTC, Rahul Nahata
needs-work Details | Review
panel-scheduled: fix headers (2.92 KB, patch)
2016-02-12 03:47 UTC, Georges Basile Stavracas Neto
committed Details | Review
panel-schedule: don't translate translated strings (996 bytes, patch)
2016-02-12 12:47 UTC, Georges Basile Stavracas Neto
committed Details | Review

Description Dušan 2016-01-21 07:53:27 UTC
Please create plural form for this string.


#: ../plugins/eds/gtd-panel-scheduled.c:70
#, c-format
msgid "%d days ago"


wiki dev: https://wiki.gnome.org/TranslationProject/DevGuidelines/Plurals
Comment 1 Rahul Nahata 2016-01-28 01:35:36 UTC
Created attachment 319885 [details] [review]
Created plural form for given string.

String modified in ../plugins/eds/gtd-panel-scheduled.c:70 to support
plural forms, through usage of ngettext() method.
Comment 2 Georges Basile Stavracas Neto 2016-01-30 14:15:31 UTC
Review of attachment 319885 [details] [review]:

::: plugins/eds/gtd-panel-scheduled.c
@@ +68,3 @@
   if (days_diff < -1)
     {
+      str = g_strdup_printf (ngettext ("%d day ago", "%d days ago", -days_diff), -days_diff);

I fear the solution will be a little trickier. I prefer to merge the "if (days_diff == -1)" condition, and translate it to Yesterday. The same applies to "if (days_diff == 1)" translating to Tomorrow.

Could you please rework this patch?
Comment 3 Georges Basile Stavracas Neto 2016-02-06 22:22:57 UTC
*** Bug 761644 has been marked as a duplicate of this bug. ***
Comment 4 Isaque Galdino 2016-02-11 02:40:52 UTC
I checked the code and the "Yesterday" and "Tomorrow" texts are already there (plugins/eds/gtd-panel-scheduled.c, starting on line 68):

--->8---
  if (days_diff < -1)
    {
      str = g_strdup_printf (_("%d days ago"), -days_diff);
    }
  else if (days_diff == -1)
    {
      str = g_strdup (_("Yesterday"));
    }
  else if (days_diff == 0)
    {
      str = g_strdup (_("Today"));
    }
  else if (days_diff == 1)
    {
      str = g_strdup (_("Tomorrow"));
    }
---8<---

so you might push Rahul commit's.
Comment 5 Georges Basile Stavracas Neto 2016-02-11 04:01:56 UTC
I personally prefer to make it a single if. For example:

if (days_diff < 0)
  str = g_strdup (g_dngettext ("Yesterday", "%d days ago", -days_diff);

instead of having multiple conditions to check each possibility. This makes better use of the translation tool and add proper support for plural strings.
Comment 6 Georges Basile Stavracas Neto 2016-02-12 03:47:37 UTC
Created attachment 320929 [details] [review]
panel-scheduled: fix headers

This commit better calculates the days
difference between the event's date and
the current date. More importantly, it now
considers the timezone.

It also uses the apropriate gettext function
to translate dates.
Comment 7 Piotr Drąg 2016-02-12 12:16:05 UTC
It's not fixed in the PO files:

#: ../plugins/eds/gtd-panel-scheduled.c:83
#, c-format
msgid "%d days ago"
msgstr ""
Comment 8 Georges Basile Stavracas Neto 2016-02-12 12:47:15 UTC
Created attachment 320970 [details] [review]
panel-schedule: don't translate translated strings

This definitely fix issue 760923.
Comment 9 Georges Basile Stavracas Neto 2016-02-12 12:47:42 UTC
Attachment 320970 [details] pushed as 673081c - panel-schedule: don't translate translated strings