Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#11275 closed enhancement (fixed)

[Patch] More info when multiple tag values present (helps prevent mistakes when editing multiple values)

Reported by: brycenesbitt Owned by: team
Priority: normal Milestone: 15.04
Component: Core Version:
Keywords: Cc:

Description (last modified by brycenesbitt)

A picture illustrates this patch well:

Showing object count / blank count / unique value count

The goal in part is to show the number of blanks, to help prevent the type of editing error where a tag is added to large numbers of innocent way nodes.

Attachments (3)

Selection_194.png (12.1 KB ) - added by brycenesbitt 9 years ago.
Showing object count / blank count / unique value count
josm_patch_multiple_select_more_info.diff (2.6 KB ) - added by brycenesbitt 9 years ago.
Updated patch with correct count in case of zero unset.
josm_patch_multiselect_rev_2.diff (3.2 KB ) - added by brycenesbitt 9 years ago.
Enhanced patch, shows value if there is just unset and one value.

Download all attachments as: .zip

Change History (24)

by brycenesbitt, 9 years ago

Attachment: Selection_194.png added

Showing object count / blank count / unique value count

comment:1 by brycenesbitt, 9 years ago

Description: modified (diff)

comment:2 by brycenesbitt, 9 years ago

Note the code does a string compare on "<different>" in two places. It seems fine relative to this patch,
but would break if this idea were extended.

comment:3 by stoecker, 9 years ago

"blank" sounds strange to me, otherwise the idea is good.

comment:4 by Don-vip, 9 years ago

Milestone: 15.04

Good idea indeed. Maybe "unset" is a better wording?

in reply to:  4 comment:5 by bastiK, 9 years ago

Replying to Don-vip:

Good idea indeed. Maybe "unset" is a better wording?

+1

I'm not a native speaker, but "unique" means that something exists only once. I.e. "N unique other values" implies, that non of the tags exists twice or more in the current selection. Maybe "distinct" fits better in this case.

Also it seems to be miscounting by 1 when there is no unset value.

Last edited 9 years ago by bastiK (previous) (diff)

comment:6 by brycenesbitt, 9 years ago

Fix uploaded for miscount Don-vip noticed.


Thinking about it: "unique" and "other" are redundant, and thus confusing.
English is pretty flexible, and a lot of wordings work. But how about this:
<2233 unset, 1 other value>

Extending the idea of the patch, how about taking the common case of one value with:
<2233 unset, 55 nodes with value "cluster">
or
<2233 unset, 55 "this is a really long value">

Last edited 9 years ago by brycenesbitt (previous) (diff)

by brycenesbitt, 9 years ago

Updated patch with correct count in case of zero unset.

by brycenesbitt, 9 years ago

Enhanced patch, shows value if there is just unset and one value.

comment:7 by stoecker, 9 years ago

Resolution: fixed
Status: newclosed

In 8170/josm:

fix #11275 - improve display of multiple values - original patch by Bryce Nesbitt

comment:8 by holgermappt, 9 years ago

I'm sorry for complaining, but strings like , {0} unset are nonsense from an internationalization point of view. Can you please use complete messages? Or at least give more context to translators so they know what the other part of the message is and what the possible combinations are.

comment:9 by brycenesbitt, 9 years ago

@holgermappt space is at a premium for these messages, thus the short form.
The best you'd get anyway is "<{0} unset, {00} other values>".

Is there a method that allows inserting a note to the translators?
http://xnap-commons.sourceforge.net/gettext-commons/apidocs/org/xnap/commons/i18n/I18n.html

What do you suggest as a fix?

Last edited 9 years ago by brycenesbitt (previous) (diff)

comment:10 by stoecker, 9 years ago

Notes are any comments in front of the string to translate.

Optimum for translators would be to switch between all possible complete strings, but this also does not work, as trn() can only take one number as base. This is one of the cases where perfect translation is impossible.

comment:11 by holgermappt, 9 years ago

I played with the tags and got these combinations:

  • foo: bar - one or more with key foo and the same value
  • foo: <n different> - same key foo, n different values, n is a number > 1
  • foo: <n 'bar', o unset> - n have the same key foo and value bar, n >= 1, o don't have key foo, o >= 1
  • foo: <n different, o unset> - key foo has n different values, n > 1, o don't have key foo, o >= 1

That means we have these build rules, all are translatable strings:

  1. indication that this is not a value but a message about different values: <{0}> with tr()
  2. concatenation of two message parts: {0}, {1} with tr(), this is the generic version for multiple concatenations, an alternative is <{0}, {1}> as there is no more than two parts
  3. n elements with same key: {0} '{1}' with trn(), {0} is the number (this might look silly, but there might be languages that need this)
  4. n different: {0} different with trn(), this is tr() now, which is wrong
  5. o unset: {0} unset with trn()

Or with complete strings:

  1. <{0} different> with trn()
  2. <{0} '{1}', {2} unset> - this doesn't work as {0} and {2} are numbers
  3. <{0} different, {1} unset> - this doesn't work as {0} and {1} are numbers

So my suggestion is to implement the build rules with comments what the strings mean and how they are used. If other code should/could use the same build rules it would make sense to write a class for this.

comment:12 by brycenesbitt, 9 years ago

The other place this code could be used is after you double click to set a value, the dialog also uses the word "different".
Search the code for the string different, and that's the list of places this might be useful.

comment:13 by aceman, 9 years ago

I also vote for fixing the localizability of this. But I understand there are quite a few combinations of the string fragments so I am not yet sure what the right fix would be. But at least, why does "unset" have plural forms (with trn) but "different) doesn't (tr only)?

comment:14 by brycenesbitt, 9 years ago

@aceman I used the plural for "different" only because the number is always 2 or greater. Is there a language for which the necessary word depends on the number before it?

Last edited 9 years ago by brycenesbitt (previous) (diff)

in reply to:  14 comment:15 by stoecker, 9 years ago

Replying to brycenesbitt:

@aceman I used the plural for "different" only because the number is always 2 or greater. Is there a language for which the necessary word depends on the number before it?

Sure. There are languages which have up to 6 plural forms.

See r8189.

Last edited 9 years ago by stoecker (previous) (diff)

comment:16 by aceman, 9 years ago

Yes please, never assume you can optimize out some form (e.g. singular). Other languages will still need the full pluralization support (trn). There may be different a form for 0, 1, 2, 10, x1, 100, etc. Just let the code and the localizers worry about it ;)

comment:17 by holgermappt, 9 years ago

@brycenesbitt See e.g. here: https://translations.launchpad.net/+languages/ar

There are also languages that go from right to left. For those languages something like str += ", {0} unset" would produce a message with items in the wrong (left to right) order. That's why I wrote the 5 build rules. They are all necessary to cover all languages. Even the <...> should be translatable as it might have a different meaning in other cultures or languages.

comment:18 by stoecker, 9 years ago

@holgermappt:

I added a tr() for the main no-text string, so LR languages simply can add the comma at the other side for the text with comma and reverse the display for the {0} '{1}'. I think current state is best which can be reached. Translators need to cope with it as it is :-)

comment:19 by aceman, 9 years ago

I think in these cases the no-text strings should be "<{0}, {1}>" (including the comma and brackets) so that localizers know what is the context and also can change the position of the comma or the brackets. Then you can have {0} be the "X different" string and {1} be the "X unset" string (both with trn).

comment:20 by stoecker, 9 years ago

In 8189/josm:

see #11275 - i18n fixes

in reply to:  17 comment:21 by holgermappt, 9 years ago

Replying to holgermappt:

There are also languages that go from right to left. For those languages something like str += ", {0} unset" would produce a message with items in the wrong (left to right) order.

My comment was wrong. It's the display that is right-to-left, the logical order would still be correct - first, second.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.