feat(libSceIcu): implement uloc_getParent and the ISO code locale exports #20996

Merged
KSonny4 merged 1 commit from upstream-pr/20996 into main 2026-11-15 21:50:40 +00:00
KSonny4 commented 2026-11-15 19:05:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by KSonny4 on 2026-11-15T19:05:30Z.


What

Implements five libSceIcu exports from ICU 68.2 uloc.cpp (84e1f26): uloc_getParent, uloc_getISO3Language, uloc_getISO3Country, uloc_getISOLanguages and uloc_getISOCountries. Before this change, they threw through parameterless legacy stubs.

  • uloc_getParent cuts the ID at the last _ and applies the und_ shift, with the u_terminateChars status rules.
  • The ISO3 functions search the two-letter tables, including the obsolete-code second lists, and return the three-letter entry.
  • uloc_getISOLanguages and uloc_getISOCountries return the LANGUAGES and COUNTRIES tables, copied verbatim from ICU 68.2.
  • A null locale throws NotImplemented_nid_no_patch, because uloc_getDefault is not implemented. The debt fragment records this.

Overlap: tools/pr_overlap.py shows that #14340 and #14443 also add these five exports. Both PRs add about 450 ICU exports each, and both conflict with main now. This PR is small and has no conflicts, so it can merge first. Then #14340 and #14443 can drop these five functions when they rebase. If their author wants their version first, I will close this PR.

Tested

Linux (WSL2, Ubuntu), Release build. Not tested on a title or on PS5 hardware.

  • ctest --test-dir build -R guest_icu_locale_core: 1 of 1 passed. The new cases cover parent IDs, buffer capacities and status codes, ISO3 lookups with obsolete codes, and every entry of both ISO tables.
  • ctest --test-dir build -R icu (before the rebase on current main): 48 of 49 passed. guest_icu_recovered_signatures does not link, because GuestPointers::Run() is defined twice, in tests/DateFormat.cpp and in tests/RelativeDateTimeFormatter.cpp. This PR does not change these files.
  • python3 tools/check_conventions.py --base origin/main: 0 errors.

Checklist

  • Based on current main; no other open PR implements the same functions (exception: #14340 and #14443 also add these five exports, see What)
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5326105397 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20996). Originally posted by [KSonny4](https://github.com/KSonny4) on 2026-11-15T19:05:30Z. --- ### What Implements five `libSceIcu` exports from ICU 68.2 `uloc.cpp` ([84e1f26](https://github.com/unicode-org/icu/blob/84e1f26ea77152936e70d53178a816dbfbf69989/icu4c/source/common/uloc.cpp#L1642-L2098)): `uloc_getParent`, `uloc_getISO3Language`, `uloc_getISO3Country`, `uloc_getISOLanguages` and `uloc_getISOCountries`. Before this change, they threw through parameterless legacy stubs. - `uloc_getParent` cuts the ID at the last `_` and applies the `und_` shift, with the `u_terminateChars` status rules. - The ISO3 functions search the two-letter tables, including the obsolete-code second lists, and return the three-letter entry. - `uloc_getISOLanguages` and `uloc_getISOCountries` return the `LANGUAGES` and `COUNTRIES` tables, copied verbatim from ICU 68.2. - A null locale throws `NotImplemented_nid_no_patch`, because `uloc_getDefault` is not implemented. The debt fragment records this. Overlap: `tools/pr_overlap.py` shows that #14340 and #14443 also add these five exports. Both PRs add about 450 ICU exports each, and both conflict with `main` now. This PR is small and has no conflicts, so it can merge first. Then #14340 and #14443 can drop these five functions when they rebase. If their author wants their version first, I will close this PR. ### Tested Linux (WSL2, Ubuntu), Release build. Not tested on a title or on PS5 hardware. - `ctest --test-dir build -R guest_icu_locale_core`: 1 of 1 passed. The new cases cover parent IDs, buffer capacities and status codes, ISO3 lookups with obsolete codes, and every entry of both ISO tables. - `ctest --test-dir build -R icu` (before the rebase on current `main`): 48 of 49 passed. `guest_icu_recovered_signatures` does not link, because `GuestPointers::Run()` is defined twice, in `tests/DateFormat.cpp` and in `tests/RelativeDateTimeFormatter.cpp`. This PR does not change these files. - `python3 tools/check_conventions.py --base origin/main`: 0 errors. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions (exception: #14340 and #14443 also add these five exports, see What) - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!20996
No description provided.