Modify

Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#9110 closed defect (fixed)

errors in usage of plural forms (part 1)

Reported by: aceman Owned by: team
Priority: normal Milestone: 14.01
Component: Core Version: latest
Keywords: i18n Cc: stoecker

Description

I have found some possible problems with using strings in plural forms.

Missing proper plural forms (string only has a single form):
#: ../core/src/org/openstreetmap/josm/actions/AbstractInfoAction.java:87
#, java-format
msgid ""
"You are about to launch {0} browser windows.<br>This may both clutter your "
"screen with browser windows<br>and take some time to finish."

#: ../core/src/org/openstreetmap/josm/actions/AbstractInfoAction.java:95
#, java-format
msgid "Click to continue and to open {0} browsers"

#: ../core/src/org/openstreetmap/josm/actions/CombineWayAction.java:190
#, java-format
msgid "Combine {0} ways"

#: ../core/src/org/openstreetmap/josm/actions/DownloadAlongAction.java:101
#, java-format
msgid ""
"<html>This action will require {0} individual<br>download requests. Do you "
"wish<br>to continue?</html>"

#: ../core/src/org/openstreetmap/josm/actions/MergeNodesAction.java:353
#, java-format
msgid "Merge {0} nodes"

#: ../core/src/org/openstreetmap/josm/actions/SplitWayAction.java:507
#, java-format
msgid "Split way {0} into {1} parts"

#: ../core/src/org/openstreetmap/josm/actions/UnGlueAction.java:381
#, java-format
msgid "Dupe into {0} nodes"

#: ../core/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java:804
#, java-format
msgid ""
"You moved more than {0} elements. Moving a large number of elements is often "
"an error.\n"
"Really move them?"

#: ../core/src/org/openstreetmap/josm/command/ChangePropertyCommand.java:168
#, java-format
msgid "Remove \"{0}\" for {1} objects"

#: ../core/src/org/openstreetmap/josm/command/ChangePropertyCommand.java:170
#, java-format
msgid "Set {0}={1} for {2} objects"

#: ../core/src/org/openstreetmap/josm/command/ChangePropertyCommand.java:182
#, java-format
msgid "Deleted {0} properties for {1} objects"

#: ../core/src/org/openstreetmap/josm/command/ChangePropertyCommand.java:184
#, java-format
msgid "Set {0} properties for {1} objects"

#: ../core/src/org/openstreetmap/josm/command/TagConflictResolveCommand.java:60
#, java-format
msgid "Resolve {0} tag conflicts in node {1}"

#: ../core/src/org/openstreetmap/josm/command/TagConflictResolveCommand.java:61
#, java-format
msgid "Resolve {0} tag conflicts in way {1}"

#: ../core/src/org/openstreetmap/josm/command/TagConflictResolveCommand.java:62
#, java-format
msgid "Resolve {0} tag conflicts in relation {1}"

#: ../core/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java:598
#, java-format
msgid ""
"You are about to combine {0} objects, but the following tags are used "
"conflictingly:<br/>{1}If these objects are combined, the resulting object "
"may have unwanted tags.<br/>If you want to continue, you are shown a dialog "
"to fix the conflicting tags.<br/><br/>Do you want to continue?"

Does not contain the {0} placement of the count (context is not known and the number may be placed wrongly if some string concatenation is hardcoded):
#: ../core/src/org/openstreetmap/josm/actions/JoinAreasAction.java:346
#: ../plugins/simplifyarea/src/sk/zdila/josm/plugin/simplify/SimplifyAreaAction.java:82
msgid "The selected way has nodes outside of the downloaded data region."
msgid_plural ""
"The selected ways have nodes outside of the downloaded data region."

#: ../core/src/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTask.java:184
msgid "Conflict during download"
msgid_plural "Conflicts during download"

#: ../core/src/org/openstreetmap/josm/command/ChangePropertyKeyCommand.java:77
#: ../core/src/org/openstreetmap/josm/data/validation/util/MultipleNameVisitor.java:58
msgid "object"
msgid_plural "objects"

#. ICON(data/)
#: ../core/src/org/openstreetmap/josm/data/osm/OsmPrimitiveType.java:13
#: ../core/src/org/openstreetmap/josm/data/validation/util/NameVisitor.java:47
#: ../core/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java:176
msgid "node"
msgid_plural "nodes"

#. ICON(data/)
#. light cyan
#: ../core/src/org/openstreetmap/josm/data/osm/OsmPrimitiveType.java:14
#: ../core/src/org/openstreetmap/josm/data/osm/visitor/paint/PaintColors.java:23
#: ../core/src/org/openstreetmap/josm/data/validation/util/NameVisitor.java:59
msgid "way"
msgid_plural "ways"

#. ICON(data/)
#. dark blue
#: ../core/src/org/openstreetmap/josm/data/osm/OsmPrimitiveType.java:15
#: ../core/src/org/openstreetmap/josm/data/osm/visitor/paint/PaintColors.java:24
#: ../core/src/org/openstreetmap/josm/data/validation/util/NameVisitor.java:69
#: ../core/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java:439
#: ../core/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java:636
msgid "relation"
msgid_plural "relations"

Add a localization note if this "{0}" is supposed to be a count OR some string, e.g. type of objects:
#: ../core/src/org/openstreetmap/josm/gui/dialogs/FilterTableModel.java:367
#, java-format
msgid "<p><b>{0}</b> objects hidden"

#: ../core/src/org/openstreetmap/josm/gui/dialogs/FilterTableModel.java:375
#, java-format
msgid "<b>{0}</b> objects disabled"

Attachments (0)

Change History (14)

comment:1 by AlfonZ, 10 years ago

Keywords: i18n added

comment:2 by simon04, 10 years ago

Cc: stoecker added

Just for reference, at the moment, we have the following plural settings in the .po files:

"Plural-Forms: nplurals=1; plural=0;\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 1 : (n>=2 && n<=4) ? 2 : 0;\n"

Dirk, for an adequate translation of languages with more complex plural rules, we'd need a trn() for all of those strings although for many above examples the condition n>1 holds (e.g., when merging nodes). What do you think?

comment:3 by stoecker, 10 years ago

I'm not sure what you want to say, but whenever a number is inserted into texts, then trn() must be used. No assumptions about the target languages.

comment:4 by simon04, 10 years ago

I tried to stress that there's no need to translate "Combine {0} ways" for the case {0} = 1, i.e., for most languages there's no singular form to be translated.

comment:5 by aceman, 10 years ago

But some languages need 2 forms for n>1 so however you twist it, you must provide full plural translation capability (probably the 'trn') for these strings even when n=1 is never used.
And for the case like:
msgid "way"
msgid_plural "ways"

this is totally wrong as the number is missing so this can't be properly translated because we don't know which form of n>1 to use. And there is no context shown how this string is used.

comment:6 by simon04, 10 years ago

Sure, the plural translation capability should be available for languages that need this. On the other hand, it would be great to not have to translate the string "Combine {0} way", where {0} can only be 1 due to the plural form of this specific language when it's given that the number of ways is greater equal 1. But that might not be possible …

comment:7 by simon04, 10 years ago

Resolution: fixed
Status: newclosed

In 6507/josm:

fix #9110 - i18n: fix errors in usage of plural forms

comment:8 by holgermappt, 10 years ago

Resolution: fixed
Status: closedreopened

Hi, I reopened this because now the singular is wrong. Is that intentional? I.e. the previous plural texts were changed from tr("Combine {0} ways", ...) to trn("Combine {0} ways", "Combine {0} ways", ...). But the first argument of trn is the singular, it must be trn("Combine {0} way", "Combine {0} ways", ...). It is confusing for translators to translate a singular but to read the English plural.

comment:9 by holgermappt, 10 years ago

I found a tough one in core/src/org/openstreetmap/josm/command/ChangePropertyCommand.java:190: Set {0} tags for {1} objects. Is the singular for tags or for objects? Or for both?

comment:10 by stoecker, 10 years ago

In 6679/josm:

see #9110 - fix singular forms, even if they are useless

comment:11 by aceman, 9 years ago

holgermappt, do you think the last commit 6679 solved the problems? Can this ticket be closed?

comment:12 by stoecker, 9 years ago

Resolution: fixed
Status: reopenedclosed

comment:13 by holgermappt, 9 years ago

Yes, the last commit solved the problem. Singular might be useless from the software point of view, but it's easier for translators if the singular is right because they do not need to dig into the code to find out why it is not as expected.

comment:14 by Don-vip, 9 years ago

Milestone: 14.01

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.