- πΊπΈUnited States mmenavas
It looks like I'm not the only one who is happy with the patch. What's keeping it from being merged?
- πΊπ¦Ukraine ruslan piskarov Kyiv, Ukraine
I use this patch for 6 year for all projects. Will be nice if it will be merged.
- Status changed to Needs work
over 1 year ago 10:52pm 21 May 2023 - π©πͺGermany marcusx
For "Italien" Addresses there is no locality.code. The locality name is just a string in 'locaity'. And what does code in this context mean? I understand "code" for the country is the ISO shortcut. But why would the city name e.g. "Berlin" for a German address be in `locality.code` and not `locality.name` ?
See:
- Assigned to sickness29
- Status changed to Needs review
about 1 year ago 11:28am 9 November 2023 - last update
about 1 year ago 32 pass, 2 fail - πΊπ¦Ukraine sickness29
Added only tests per @dww comment that check plain address formatter ,so this should fail.
There are 2 tests: one to check if all address data present in plain formatter output and the other checks if all data is shown when some property is optional and empty (apart from country_code which determines empty field). - Issue was unassigned.
- last update
about 1 year ago 34 pass - πΊπ¦Ukraine sickness29
Now I apply same tests from #17 with fixes from #9 into one patch.
This should now pass. - Status changed to Needs work
about 1 year ago 10:34am 3 December 2023 - π·πΈSerbia bojanz
For "Italien" Addresses there is no locality.code. The locality name is just a string in 'locaity'. And what does code in this context mean? I understand "code" for the country is the ISO shortcut. But why would the city name e.g. "Berlin" for a German address be in `locality.code` and not `locality.name` ?
The template file that you're modifying tells you this:
* if a subdivision (dependent_locality, locality, administrative_area) was * entered, the array will always have a code. If it's a predefined subdivision, * it will also have a name. The code is always preferred.
This is because if a subdivision is predefined, it has two names, "name" which is supposed to be used in the UI when selecting a value, and "code" which is supposed to be shown when rendering an address. Sometimes this "code" matches the "name", sometimes it matches an ISO code, depending on the rules for that country. The use of "code" to mean user-facing label is unfortunate, but we inherited that decision from Google 10 years ago and we can't change it.
We can extend the comment in the template file to explain what I just explained here.
@sickness29
Thank you for illustrating a case in which the current code fails, something I've been asking for since 2019.However, we already have a AddressPlainFormatterTest in Drupal\Tests\address\Kernel\Formatter, can we add a new test case there instead of introducing an independent test?
Furthermore, the twig file changes don't seem correct, the twig file now looks like this:
{% if locality.name %} {{ locality.name }} <br> {% endif %} {% if dependent_locality.code %} {{ dependent_locality.code }} <br> {% endif %} {% if locality.code or postal_code or administrative_area.code %} {{ locality.code }} {{ postal_code }} {{ administrative_area.code }} <br> {% endif %}
So we output the locality, then the dependent_locality, then the locality again?
I still think this patch should not make any changes to the twig file itself, nor should it switch "code" for "name" in the formatter plugin.
- Status changed to Needs review
12 months ago 12:34pm 27 December 2023 - last update
12 months ago 35 pass, 1 fail - πΊπ¦Ukraine sickness29
Hi @bojanz
I have added changes to Kernel\Formatter\AddressPlainFormatterTest to illustrate the issue in test failure.
When only country and admin area were selected, there is no admin area in output, however it should be as we allow optional values.
I will add this same test with fix as next comment - last update
12 months ago 42 pass - Status changed to Needs work
12 months ago 2:26pm 27 December 2023 - π·πΈSerbia bojanz
Fix looks great now. Needs a reroll though, π Usage of content language instead of the language of the interface. Needs work changed the tests.
-
bojanz β
committed 32a09e4b on 8.x-1.x authored by
sickness29 β
Issue #2881391 by sickness29, Ruslan Piskarov, bojanz: The locality.name...
-
bojanz β
committed 32a09e4b on 8.x-1.x authored by
sickness29 β
- π·πΈSerbia bojanz
Committed #21 to 8.x-1.x, changing version to focus on the 2.0.x reroll.
- Status changed to Needs review
12 months ago 3:14pm 27 December 2023 - last update
12 months ago 43 pass -
bojanz β
committed 38289a64 on 2.0.x
Issue #2881391 by sickness29, Ruslan Piskarov, bojanz: The locality.name...
-
bojanz β
committed 38289a64 on 2.0.x
- Status changed to Fixed
12 months ago 3:23pm 27 December 2023 Automatically closed - issue fixed for 2 weeks with no activity.