feat(libSceIcu): resolve a null locale through the default locale #21242
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/21242"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by beardsciences on 2026-11-16T01:23:43Z.
What
Twelve implemented libSceIcu exports still throw
NotImplemented_nid_no_patchwhen the locale argument is null:uloc_getLanguage,uloc_getCountry,uloc_getScript,uloc_getVariant,uloc_getBaseName,uloc_canonicalize,uloc_getParent,uloc_getISO3Language,uloc_getISO3Country,uloc_isRightToLeft,u_strToLowerandu_strToUpper. In ICU a null locale names the default locale, and passing null is the usual way to ask for the system's language, region or case rules. #20642 addsuloc_getDefault; this PR completes these exports on top of it.uloc_getDefault()at the point where ICU 68.2 does, after its own status check, and then runs its existing code:uloc_getLanguage,uloc_getScript,uloc_getCountry,uloc_getVariant,_canonicalizeforuloc_getBaseNameanduloc_canonicalize,uloc_getParent,uloc_getISO3Languageanduloc_getISO3Country,uloc_isRightToLeftthroughuloc_getScript, andustrcase_getCaseLocalefor the two case mappers. A failed status still returns before the locale is read.CaseMapping.cpp,LocaleSyntax.cppandRightToLeft.cppinclude the bundled ICU's headers, whose renaming macros would turnuloc_getDefaultinto the bundled ICU's own (the host's default locale). They callIcu::DefaultLocaleName()instead, a one-line helper inLocaleCore.cpp, which includes no ICU header, around this module'suloc_getDefault.i-defaultwith the default locale inuloc_getBaseNameanduloc_canonicalize; that still needs the rest of ICU's canonicalizer and stays recorded in the debt entry.feat-libSceIcu-locale-iso-codes.mdandlibSceIcu-locale-syntax.mdalready change or add the entries that described these throws, andtools/debt_fold.pyrefuses a second fragment on one entry, so this PR edits their text. The new fragmentfeat-icu-null-locale-default.mdupdates the right-to-left and case-mapping entries.Tested
Windows 11 26200, WinLibs GCC 15.2.0, Release, Ryzen 5 5600X. Built and run at the head
1476512d23onmain98a39e8e05.guest_icu_null_locale_{turkish,arabic,long}: three guest environments (LANG=tr_TR.UTF-8@traditional,LC_ALL=ar_Arab_EG.UTF-8overLANG=fr_FR, and an over-long language that gives the empty default name). For all twelve exports, null gives exactly what the default locale's own name gives, and the expected values hold:tr/TR/TRADITIONAL/tr_TR/tur/TUR, Turkish dotted and dotless i fromu_strToUpperandu_strToLower(root mapping for""),Araband right-to-left for the Arabic default, and empty answers for the empty default. A failed status leaves a null locale unread.guest_icu_locale_core,guest_icu_locale_syntax,guest_icu_right_to_left) now assert the same rule: null answers as the default locale does.ctest -R '^public_headers|^guest_icu': 122 of 122 pass.python tools/check_conventions.py --base origin/mainwith this title and description: passed, with one warning: the existing 1786-characterLocaleCore.cppentry in #20996's fragment, which this PR does not change.python tools/debt_fold.py --check: passed.Not run: Linux, macOS, a console, any title.
Overlap
1476512d23. The repository merges with merge commits, so the diff shrinks to that commit once #20642 is onmain.uloc_getName,uloc_openKeywords) and #18210 (u_strToTitle) add new exports that throw for a null locale in the same way; once they and this PR land, they can useIcu::DefaultLocaleName()too. Neither changes the functions this PR completes.uloc_getVariantinLocaleSyntax.cpp, next to the one line this PR changes there; whichever lands second needs a one-line rebase.Checklist
main; no other open PR implements the same functions (see Overlap)NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T01:35:50Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
1476512d23:tools/check_conventions.pypassed;git diff --checkclean.guest_icu_default_locale_tests,guest_icu_locale_core_tests,guest_icu_locale_syntax_tests,guest_icu_null_locale_tests,guest_icu_right_to_left_testsbuilt cleanly.guest_icu_default_locale_posix,guest_icu_default_locale_messages,guest_icu_default_locale_codeset,guest_icu_default_locale_nynorsk,guest_icu_default_locale_long,guest_icu_locale_core,guest_icu_null_locale_turkish,guest_icu_null_locale_arabic,guest_icu_null_locale_long,guest_icu_locale_syntax,guest_icu_right_to_left):core/libs/prx/libSceIcu/CaseMapping.cpp,core/libs/prx/libSceIcu/Export.cpp,core/libs/prx/libSceIcu/LegacyExports.cpp,core/libs/prx/libSceIcu/LocaleCore.cpp,core/libs/prx/libSceIcu/LocaleSyntax.cpp,core/libs/prx/libSceIcu/RightToLeft.cpp,core/libs/prx/libSceIcu/include/InventoryExports.hpp,core/libs/prx/libSceIcu/include/LegacyExports.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T02:08:02Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
f2e21c7a05:tools/check_conventions.pypassed;git diff --checkclean.guest_icu_locale_core_tests,guest_icu_locale_syntax_tests,guest_icu_null_locale_tests,guest_icu_right_to_left_testsbuilt cleanly.guest_icu_locale_core,guest_icu_null_locale_turkish,guest_icu_null_locale_arabic,guest_icu_null_locale_long,guest_icu_locale_syntax,guest_icu_right_to_left):core/libs/prx/libSceIcu/CaseMapping.cpp,core/libs/prx/libSceIcu/LocaleCore.cpp,core/libs/prx/libSceIcu/LocaleSyntax.cpp,core/libs/prx/libSceIcu/RightToLeft.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T02:17:28Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the inspected implementation and reported checks support merging.
What I ran
Reviewed head
f2e21c7a056923bc34b6da39a3477dc7d0b37085usingrepo_read.py-backed review tools. No commands or tests were run in this review. The author reports 122 of 122 guest/header tests passing and 11 removal mutations caught; those results were not independently run here.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Build and test output, including the reported removal checks, was not independently verified. Linux, macOS, console behavior, and title compatibility were not run or confirmed. The reviewed files were
core/libs/prx/libSceIcu/CMakeLists.txt,core/libs/prx/libSceIcu/CaseMapping.cpp,core/libs/prx/libSceIcu/DefaultLocaleName.hpp,core/libs/prx/libSceIcu/LocaleCore.cpp,core/libs/prx/libSceIcu/LocaleSyntax.cpp,core/libs/prx/libSceIcu/RightToLeft.cpp,core/libs/prx/libSceIcu/tests/NullLocale.cpp,core/libs/prx/libSceIcu/tests/RightToLeft.cpp,core/libs/tests/GuestIcuLocaleCore.cpp,core/libs/tests/GuestIcuLocaleSyntax.cpp,docs/dev/debt/changes/feat-icu-null-locale-default.md,docs/dev/debt/changes/feat-libSceIcu-locale-iso-codes.md, anddocs/dev/debt/changes/libSceIcu-locale-syntax.md. No changed files were excluded by the review manifest.To get this to a good state
Nothing is required.