﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
22693	[PATCH] `PresetListEntry` should use `trc` instead of `tr` for `display_value`	taylor.smock	team	"The originating problem comes from comment:8:ticket:22588 (Hufkratzer):
> I have tested this in the latest available build 18645 and found that in the preset for `sport=equestrian` the string ""Horse Riding Arena"" isn't translated, although there have been translations entered in launchpad.
> [...snip...]

From comment:15:ticket:22588 (taylor.smock):
> I've done a bit of debugging.
> It looks like we are mapping `_:riding\nHorse Riding Arena` to `Cancha para equitación` during i18n load.
> 
> The call tree for `tr` starts in `PresetListEntry#getDisplayValue`. I think the problem here is that we are calling `tr(display_value)` instead of `trc(cms == null ? null : cms.values_context, display_value)`. The latter gives us the expected translation of `Cancha para equitación` while the former just returns `Horse Riding Arena`.
> 
> A patch for that is relatively trivial, but I don't know what the fallout would be (are there some values that depend upon the context not being set?).
> {{{#!diff
> Index: src/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntry.java
> ===================================================================
> diff --git a/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntry.java b/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntry.java
> --- a/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntry.java	(revision 18646)
> +++ b/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntry.java	(date 1659357971990)
> @@ -130,7 +130,8 @@
>                  cachedDisplayValue = Utils.firstNonNull(value, "" "");
>              } else {
>                  cachedDisplayValue = Utils.firstNonNull(
> -                    locale_display_value, tr(display_value), trc(cms == null ? null : cms.values_context, value), "" "");
> +                    locale_display_value, trc(cms == null ? null : cms.values_context, display_value),
> +                        trc(cms == null ? null : cms.values_context, value), "" "");
>              }
>          }
>          return cachedDisplayValue;
> }}}
> 
> The entries in the preset `leisure` list have other translation locations, as follows:
> * `Horse Riding Arena`: None (not translated elsewhere)
> * `Horse Riding Centre`: source:trunk/resources/data/defaultpresets.xml#L4065
> * `Sports Centre`: source:trunk/resources/data/defaultpresets.xml#L5162
> * `Stadium`: source:trunk/resources/data/defaultpresets.xml#L5154
> * `Racetrack`: source:trunk/resources/data/defaultpresets.xml#L5189
> 
> This is probably why they all have translations -- the `gettext` code doesn't need the context for them, since they have been translated ''without'' context.
"	defect	closed	normal	23.02	Core		fixed		
