GNOME Bugzilla – Bug 760923
Plural form for string "%d days ago"
Last modified: 2016-02-12 12:47:45 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
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.
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?
*** Bug 761644 has been marked as a duplicate of this bug. ***
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.
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.
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.
It's not fixed in the PO files: #: ../plugins/eds/gtd-panel-scheduled.c:83 #, c-format msgid "%d days ago" msgstr ""
Created attachment 320970 [details] [review] panel-schedule: don't translate translated strings This definitely fix issue 760923.
Attachment 320970 [details] pushed as 673081c - panel-schedule: don't translate translated strings