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 745658 - Make the delete notification strings consistent with nautilus
Make the delete notification strings consistent with nautilus
Status: RESOLVED FIXED
Product: gnome-documents
Classification: Core
Component: general
3.15.x
Other All
: Normal normal
: ---
Assigned To: GNOME documents maintainer(s)
GNOME documents maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-03-05 09:31 UTC by Debarshi Ray
Modified: 2015-03-06 15:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
notifications: Improve the delete message (2.11 KB, patch)
2015-03-05 09:33 UTC, Debarshi Ray
none Details | Review
notifications: Improve the delete message (1.62 KB, patch)
2015-03-06 13:14 UTC, Debarshi Ray
none Details | Review
notifications: Improve the delete message (1.56 KB, patch)
2015-03-06 13:19 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2015-03-05 09:31:11 UTC
Nautilus has grown in-app delete notifications, and its strings are better in my opinion. It makes sense to keep them consistent across applications.

Were using:
"Selected item has been deleted"
"Selected items have been deleted"

We want to use:
"%s deleted"
"%d item deleted"
"%d items deleted",
where %s is the name of the item, if available, and %d is the count.
Comment 1 Debarshi Ray 2015-03-05 09:33:49 UTC
Created attachment 298609 [details] [review]
notifications: Improve the delete message
Comment 2 Debarshi Ray 2015-03-05 09:36:00 UTC
We are almost entering string freeze from string change announcement announcement period, so I will notify the translation team.
Comment 3 André Klapper 2015-03-05 11:07:43 UTC
+ // Translators: one or more items might have been deleted, and
+ // this is the first part of a "%d items deleted" string.
+ let itemsStr = Gettext.ngettext("%d item",
+                                 "%d items",
+                                 this._docs.length).format(this._docs.length);
+ // Translators: one or more items might have been deleted, and
+ // this is the "%d items deleted" string, where %s is the first
+ // part enclosed in <b></b> markup.
+ msg = Gettext.ngettext("%s deleted",
+                        "%s deleted",
+                        this._docs.length).format('<b>' + itemsStr + '</b>');

Does this really have to be a split string, instead of using "<b>%d item</b> deleted" and "<b>%d items</b> deleted" directly? 
I don't think that keeping the <b> markup outside of a translatable string is more important than a bunch of broken translations to expect (see https://wiki.gnome.org/TranslationProject/DevGuidelines/Never%20split%20sentences ), plus those strings do not necessarily show up one next to each other in a po file.
Comment 4 Matthias Clasen 2015-03-05 11:50:07 UTC
(In reply to André Klapper from comment #3)
> + // Translators: one or more items might have been deleted, and
> + // this is the first part of a "%d items deleted" string.
> + let itemsStr = Gettext.ngettext("%d item",
> +                                 "%d items",
> +                                
> this._docs.length).format(this._docs.length);
> + // Translators: one or more items might have been deleted, and
> + // this is the "%d items deleted" string, where %s is the first
> + // part enclosed in <b></b> markup.
> + msg = Gettext.ngettext("%s deleted",
> +                        "%s deleted",
> +                        this._docs.length).format('<b>' + itemsStr +
> '</b>');
> 
> Does this really have to be a split string, instead of using "<b>%d item</b>
> deleted" and "<b>%d items</b> deleted" directly? 
> I don't think that keeping the <b> markup outside of a translatable string
> is more important than a bunch of broken translations to expect (see
> https://wiki.gnome.org/TranslationProject/DevGuidelines/
> Never%20split%20sentences ), plus those strings do not necessarily show up
> one next to each other in a po file.

I don't think putting markup into the translation is ever right. But I'd question why we make 'n items' bold here in the first place. That seems odd and unnecessary to me.
Comment 5 Debarshi Ray 2015-03-05 12:01:08 UTC
(In reply to André Klapper from comment #3)
> + // Translators: one or more items might have been deleted, and
> + // this is the first part of a "%d items deleted" string.
> + let itemsStr = Gettext.ngettext("%d item",
> +                                 "%d items",
> +                                
> this._docs.length).format(this._docs.length);
> + // Translators: one or more items might have been deleted, and
> + // this is the "%d items deleted" string, where %s is the first
> + // part enclosed in <b></b> markup.
> + msg = Gettext.ngettext("%s deleted",
> +                        "%s deleted",
> +                        this._docs.length).format('<b>' + itemsStr +
> '</b>');
> 
> Does this really have to be a split string, instead of using "<b>%d item</b>
> deleted" and "<b>%d items</b> deleted" directly? 
> I don't think that keeping the <b> markup outside of a translatable string
> is more important than a bunch of broken translations to expect (see
> https://wiki.gnome.org/TranslationProject/DevGuidelines/
> Never%20split%20sentences ),

There is a counter example in:
https://wiki.gnome.org/Initiatives/GnomeGoals/RemoveMarkupInMessages

But this one is the other way round (ie. what you are saying):
https://wiki.gnome.org/TranslationProject/DevGuidelines/Avoid%20markup%20wherever%20possible

> plus those strings do not necessarily show up
> one next to each other in a po file.

That is why I added a liberal dose of translator comments. I am not sure why the split strings are a problem, though. The translator does get to decide construction of the entire sentence.

Anyway ...

This patch basically does the same thing as nautilus, and there was already a round of discussion when that happened.

I don't have an opinion on this, but I don't want to go back and forth too many times either. So, tell me what you want and I will do that. :)
Comment 6 André Klapper 2015-03-05 12:12:25 UTC
> I am not sure why the split strings are a problem, though. The translator does get to decide construction of the entire sentence.

If you know for sure that none of the tens of thousands of human languages out there requires a different sentence structure than "foo deleted", for example "deleted foo", then there is indeed no problem and I admire your language skills. :)
Comment 7 Carlos Soriano 2015-03-05 12:13:26 UTC
Well, bold is more or less necessary because if name has spaces can be confusing with the "deleted" word near the name.

Mathias suggested quotes instead of bold, which will prevent translation problems if there is some.

On the other hand, is sad that we are limited in using markup in some cases.
Comment 8 Matthias Clasen 2015-03-05 12:17:11 UTC
Can I suggest to say:

“foobar.xyz” deleted

  for individual files and

5 items deleted

  for multiple items

?
Comment 9 Matthias Clasen 2015-03-05 12:18:09 UTC
I don't see any need to ever put a translated fragment inside the quotes/bold/whatever markup, though: if it is a name or filename, you don't translate it. If it is a string like '5 items', you don't quote it.
Comment 10 Matthias Clasen 2015-03-05 12:20:48 UTC
And to wrap up my commenting spree here, I don't think 'consistency with nautilus' is a very convincing argument for changing strings in Documents. The situation is different, different window width, document titles instead of filenames, etc etc.
Comment 11 Carlos Soriano 2015-03-05 12:23:40 UTC
(In reply to Matthias Clasen from comment #9)
> I don't see any need to ever put a translated fragment inside the
> quotes/bold/whatever markup, though: if it is a name or filename, you don't
> translate it. If it is a string like '5 items', you don't quote it.

If I understood correctly, you are proposing to separate the file name from the translated string, and that is the actual problem, splitting those.
Comment 12 Carlos Soriano 2015-03-05 12:24:38 UTC
(In reply to Carlos Soriano from comment #11)
> (In reply to Matthias Clasen from comment #9)
> > I don't see any need to ever put a translated fragment inside the
> > quotes/bold/whatever markup, though: if it is a name or filename, you don't
> > translate it. If it is a string like '5 items', you don't quote it.
> 
> If I understood correctly, you are proposing to separate the file name from
> the translated string, and that is the actual problem, splitting those
Both notification from documents and nautilus are for deleting files as well, consistency here is good to have, and designers agreed when we discussed it.
Comment 13 Debarshi Ray 2015-03-05 12:30:27 UTC
(In reply to André Klapper from comment #6)
> > I am not sure why the split strings are a problem, though. The translator
> > does get to decide construction of the entire sentence.
> 
> If you know for sure that none of the tens of thousands of human languages
> out there requires a different sentence structure than "foo deleted", for
> example "deleted foo",

The string is "% deleted". What is stopping the translator from making it "deleted %"?
Comment 14 Matthias Clasen 2015-03-05 12:47:11 UTC
(In reply to Carlos Soriano from comment #11)
> (In reply to Matthias Clasen from comment #9)
> > I don't see any need to ever put a translated fragment inside the
> > quotes/bold/whatever markup, though: if it is a name or filename, you don't
> > translate it. If it is a string like '5 items', you don't quote it.
> 
> If I understood correctly, you are proposing to separate the file name from
> the translated string, and that is the actual problem, splitting those.

'5 items' is not a filename. I suggest

g_strdup_print (ngettext ("“%$1s” deleted", "%$2d items deleted"), n_items), filename, n_items);

And I'm aware that gettext and/or gcc might not be smart enough to avoid warning about parameter mismatches here. Might need some annotation to shut xgettext up.
Comment 15 André Klapper 2015-03-05 12:51:40 UTC
(In reply to Debarshi Ray from comment #13)
> The string is "% deleted". What is stopping the translator from making it
> "deleted %"?

True that. :) In that case, imagine languages that require "15 deleted items" sentence structure. (Rule of thumb: Never assume anything about human langs.)

I can only repeat: Splitting strings is way way worse than having some markup. Especially when the markup is not really needed, like in this case.
Comment 16 Matthias Clasen 2015-03-05 12:51:58 UTC
or, more explicit and less tricky:

if (n_items == 1)
  s = g_strdup_printf ("“%s” deleted", filename);
else
  s = g_strdup_printf (ngettext ("%d item deleted", "%d items deleted", n_items), n_items);
Comment 17 Debarshi Ray 2015-03-05 14:07:00 UTC
(In reply to André Klapper from comment #15)
> (In reply to Debarshi Ray from comment #13)
> > The string is "% deleted". What is stopping the translator from making it
> > "deleted %"?
> 
> True that. :) In that case, imagine languages that require "15 deleted
> items" sentence structure. (Rule of thumb: Never assume anything about human
> langs.)

That is also doable. Translate "%d items" as "%d", and then "%s deleted" as "%s deleted items".

Anyway ...

(In reply to Matthias Clasen from comment #16)
> or, more explicit and less tricky:
> 
> if (n_items == 1)
>   s = g_strdup_printf ("“%s” deleted", filename);
> else
>   s = g_strdup_printf (ngettext ("%d item deleted", "%d items deleted",
> n_items), n_items);

Any objections to using quotes instead of <b> ?
Comment 18 André Klapper 2015-03-05 14:39:09 UTC
<offtopic>
(In reply to Debarshi Ray from comment #17)
> That is also doable. Translate "%d items" as "%d", and then "%s deleted" as
> "%s deleted items".

Might not be too obvious to translators who would just like to deal with proper English strings and then try to translate these English strings as good as they can, so strings don't look completely broken in a localized UI. Normally there's neither time nor interest to spend time thinking about moving random %s and %d placeholders around, across several strings, located in several places in a po file, if a translator has basically three weeks between string freeze and .0 release to finalize translations for dozens of modules, interrupted by late string changes because developers didn't fix stuff earlier in the cycle.

> Anyway ...

+1. :)
</offtopic>

> Any objections to using quotes instead of <b> ?

No. <b> feels just wrong here.
Comment 19 Matthias Clasen 2015-03-06 12:41:41 UTC
If we want this fixed, it should probably go in soon, to give translators some time. Don't forget to ask for a string freeze.
Comment 20 Debarshi Ray 2015-03-06 13:14:58 UTC
Created attachment 298708 [details] [review]
notifications: Improve the delete message
Comment 21 Debarshi Ray 2015-03-06 13:17:23 UTC
I dropped the <b> markup, and the strings are not split any more. The new strings are:
   “%s” deleted
   %d item deleted
   %d items deleted
Comment 22 Debarshi Ray 2015-03-06 13:19:13 UTC
Created attachment 298709 [details] [review]
notifications: Improve the delete message