GNOME Bugzilla – Bug 763572
Some comments not visible to translators
Last modified: 2016-03-24 12:20:52 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)
(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.
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.
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.
Created attachment 324055 [details] [review] patch updated.
Created attachment 324061 [details] [review] The two commits squashed
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.
Created attachment 324078 [details] [review] Comments indented like they were peviously I indented the comments and keep each row within 80 characters.
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)
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.
Review of attachment 324153 [details] [review]: Looks good to me. Push after freeze.
Comment on attachment 324153 [details] [review] Make comments to be seen by translators Pushed to master as commit 37ac90243b3cadf518805c3c034ced3beaf4ecaf. Thanks!