Closed (won't fix)
Project:
Drupal core
Version:
11.x-dev
Component:
locale.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
25 Mar 2024 at 10:36 UTC
Updated:
5 Jun 2025 at 14:47 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #3
yazanmajadba commentedComment #4
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue.
While you are making the above changes, we recommend that you convert this patch to a merge request. Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)
Comment #5
yazanmajadba commentedComment #6
yazanmajadba commentedComment #7
nicxvan commentedThis is interesting, I think this needs two things.
1. Remove the comments after the Countries, that is throwing phpcs errors.
2. This will need a test, the nice thing is this is really easy to test.
To create the test go to:
core/tests/Drupal/KernelTests/Core/Locale/CountryManagerTest.php
Add a new test method called something like test twoCodeToAlphaThreeCode
Call your new iso2ToIso3 method with a known two code and assert that it returns the correct 3 code.
Comment #8
yazanmajadba commented@nicxvan Thanks for your feedback.
1-I removed the comments from the code.
2-I created a test method.
Comment #9
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #10
yazanmajadba commentedComment #11
nicxvan commentedThose assertions are not the same, so they will always fail. you probably want something like:
self::assertArrayHasKey('AC', $iso3_codes);
and
self::assertSame($iso3_codes['AC'], 'ASC');
You can then remove $expected_iso3_codes.
And rename iso3_codes to iso3Codes
Comment #12
nicxvan commentedComment #13
nicxvan commentedComment #15
smustgrave commentedTest-only feature https://git.drupalcode.org/issue/drupal-3435850/-/jobs/1241704
Seems like a reasonable request and core already maintains the other list so if ever a change is needed just update here too, same file.
Added a small typehint, super duper nitpicky.
LGTM
Comment #16
quietone commentedThanks for explaining your need. However, this looks like something that should be done in contrib or custom code. As far as I know, there is no need for this in core. Is this perhaps required by some other issue?
There is a core policy to help decide what is added to core. It is Criteria for evaluating proposed changes. So far I think this is a won't fix.
Comment #17
nicxvan commentedGoing by the criteria I think it should be included, it hits most of the items on that list.
Aim: It does not conflict with the aims of the Drupal project as far as I can tell.
On the correct branch: It is on the correct branch.
Risk: Very low.
Coding standards: This follows the coding standards for Drupal.
Demand: While there isn't significant demand there is some demand and the user that requested it put in the effort. Also the guidelines do not quantify how much demand is required, though obviously more demand means something is more likely to get included.
Usage: This is the one that falls farthest short I think. It says that it will be used by a significant portion of the Drupal base. I would think this type of utility would still pass that bar, you can't use something if it doesn't exist.
Technical Debt: Very low.
I agree this could be achieved in contrib or custom code, but for those users that do need this they will already have country manager injected and for users that don't need it this change does not add significant overhead.
I do recognize I'm not the one maintaining this, but from my perspective this should be included.
I'm curious if my evaluations align with the general core team's thought process, it would be helpful to know when looking at other feature requests in the future if I should encourage a user to use contrib for a feature.
Also @YazanMajadba if you have any additional insight into how this will be used and if there are other issues depending on it.
Comment #18
smustgrave commentedVery well put @nicxvan don't have much to add other then agree. Seems like a nice feature to have that won't be burdensome to maintain.
Comment #19
longwaveTo me this is won't fix, https://www.drupal.org/project/address provides this (and much more address handling) in contrib via the
commerceguys/addressinglibrary: https://github.com/commerceguys/addressing/blob/master/src/Country/Count...To be honest I'm not even sure why we ask in the installer or have a default country setting in core, we don't use it for anything that I can see.
Comment #20
catchGiven this is already provided by a well-used third party library I also don't see why we'd re-implement that in core. @longwave is also correct that we don't currently use the default country setting anywhere in core.
Comment #21
introfini commentedFor those looking to achieve this, I recommend using the suggestion by @longwave:
Comment #23
smustgrave commentedSince this got about 3 committers not for it. Going to close out.