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 763572 - Some comments not visible to translators
Some comments not visible to translators
Status: RESOLVED FIXED
Product: gnome-logs
Classification: Other
Component: general
git master
Other All
: Normal enhancement
: ---
Assigned To: gnome-logs maintainer(s)
gnome-logs maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-03-13 18:33 UTC by Ask Hjorth Larsen
Modified: 2016-03-24 12:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gnome-logs: Some comments not visible to translators (10.71 KB, patch)
2016-03-15 21:18 UTC, Ovidiu Dancila
needs-work Details | Review
patch updated. (7.28 KB, patch)
2016-03-15 22:24 UTC, Ovidiu Dancila
needs-work Details | Review
The two commits squashed (4.08 KB, patch)
2016-03-15 22:56 UTC, Ovidiu Dancila
needs-work Details | Review
Comments indented like they were peviously (4.15 KB, patch)
2016-03-16 09:25 UTC, Ovidiu Dancila
needs-work Details | Review
Make comments to be seen by translators (4.42 KB, patch)
2016-03-17 05:48 UTC, Ovidiu Dancila
committed Details | Review

Description Ask Hjorth Larsen 2016-03-13 18:33:19 UTC
In this example:

                        /* Translators: timestamp format for events in a        
                         * different year, showing the abbreviated month name,  
                         * day of the month, year and the time without seconds  
                         * in 12-hour format. */
                        time = g_date_time_format (local,
                                                   _("%b %e %Y %l:%M %p"));

the gettext call _("...")) does not "see" the preceding comment because it is two lines above.  The comment will therefore not be seen by translators.  To fix this, rearrange lines (ugly though it is):

                        time = g_date_time_format (local,
                        /* Translators: timestamp format for events in a        
                         * different year, showing the abbreviated month name,  
                         * day of the month, year and the time without seconds  
                         * in 12-hour format. */
                                                   _("%b %e %Y %l:%M %p"));

or refrain from breaking the line (also ugly I guess).

There are several of these in gl-util.c.  Translations may be wrong if explanation is not clear to translators (12-hour format will be almost certainly be changed into 24-hour format in many languages if nothing instructs the translator to do otherwise, causing 12-hour setting to be broken in that language)
Comment 1 Jonathan Kang 2016-03-14 01:42:17 UTC
(In reply to Ask Hjorth Larsen from comment #0)
> In this example:
> 
>                         /* Translators: timestamp format for events in a    
> 
>                          * different year, showing the abbreviated month
> name,  
>                          * day of the month, year and the time without
> seconds  
>                          * in 12-hour format. */
>                         time = g_date_time_format (local,
>                                                    _("%b %e %Y %l:%M %p"));
> 
> the gettext call _("...")) does not "see" the preceding comment because it
> is two lines above.  The comment will therefore not be seen by translators. 
> To fix this, rearrange lines (ugly though it is):
> 
>                         time = g_date_time_format (local,
>                         /* Translators: timestamp format for events in a    
> 
>                          * different year, showing the abbreviated month
> name,  
>                          * day of the month, year and the time without
> seconds  
>                          * in 12-hour format. */
>                                                    _("%b %e %Y %l:%M %p"));
> 
Thanks for the report.

I did some investigation on it. I looked through the source code of a few other GNOME projects, and found that some are doing exactly like what you suggest(add comment right after the parameter), while some are not(like what Logs does ATM). So it makes sense to me to make the changes.

The following format should be a better option.

time = g_date_time_format (local,
                           /* Translators: timestamp format for events in a        
                            * different year, showing the abbreviated month name,  
                            * day of the month, year and the time without seconds  
                            * in 12-hour format. */
                            _("%b %e %Y %l:%M %p"));

> or refrain from breaking the line (also ugly I guess).
> 
The reason why we "break" the line is we want to keep the codes of a single line within 80 characters. So refraining from breaking the line is not a good option for me.
Comment 2 Ovidiu Dancila 2016-03-15 21:18:37 UTC
Created attachment 324049 [details] [review]
gnome-logs:  Some comments not visible to translators

The comments will not be seen by translators.

Make the comments easy to be seen by translators.

To fix this I added comments right after the parameters. I also keep the coding style by indenting the comments and having no more than 79 characters on a line.
Comment 3 David King 2016-03-15 21:44:00 UTC
Review of attachment 324049 [details] [review]:

Looks generally good. Can you leave the lines where the comment is shown correctly (where the function call is all on one line) alone, as that will reduce the change slightly. Also, please make sure that your commit message is formatted to only 72 characters in width (your text editor probably has an automatic indenting function for this) for the body, and 50 characters for the first line.
Comment 4 Ovidiu Dancila 2016-03-15 22:24:51 UTC
Created attachment 324055 [details] [review]
patch updated.
Comment 5 Ovidiu Dancila 2016-03-15 22:56:07 UTC
Created attachment 324061 [details] [review]
The two commits squashed
Comment 6 Jonathan Kang 2016-03-16 01:14:21 UTC
Review of attachment 324061 [details] [review]:

The subject of your patch should be a summary of what you do in this patch instead of "The two commits squashed". In my opinion, you'd better modify the comments a bit to make each row to be within 80 characters.

::: src/gl-util.c
@@ +166,3 @@
+                               * day of the month and the time with seconds
+in
+                               * 12-hour format. */

Indent the comment as how it was previously.

@@ +188,3 @@
+                               * day of the month, year and the time with
+seconds
+                               * in 12-hour format. */

The same as what's mentioned above. The following changes should also follow the rule.
Comment 7 Ovidiu Dancila 2016-03-16 09:25:10 UTC
Created attachment 324078 [details] [review]
Comments indented like they were peviously

I indented the comments and keep each row within 80 characters.
Comment 8 Jonathan Kang 2016-03-16 09:33:03 UTC
Review of attachment 324078 [details] [review]:

The patch looks good to me except the subject of the patch.

The subject should a short summary of what the patch does. You can find more information about it in the link: https://wiki.gnome.org/Newcomers/CodeContributionWorkflow (the commit guidelines part)
Comment 9 Ovidiu Dancila 2016-03-17 05:48:18 UTC
Created attachment 324153 [details] [review]
Make comments to be seen by translators

The problem is that there are comments for translators which are two
lines above the gettext call _("...") and these will not be seen by
translators.

To fix this rearrange lines in order to place the commentaries right
after the parameter. Also keep the coding style by indenting the
comments and having no more than 79 characters on a line.
Comment 10 Jonathan Kang 2016-03-17 07:59:51 UTC
Review of attachment 324153 [details] [review]:

Looks good to me. Push after freeze.
Comment 11 Jonathan Kang 2016-03-24 12:20:35 UTC
Comment on attachment 324153 [details] [review]
Make comments to be seen by translators

Pushed to master as commit 37ac90243b3cadf518805c3c034ced3beaf4ecaf.

Thanks!