Repository navigation
Conversation
`NativeGettext` replaced LC_MESSAGES even where `ilInitialisation::initLocale()` had set a real locale, so e.g. the ICU default locale could become "ilias__MESSAGES". It now sets LC_MESSAGES only for C, POSIX and C.<codeset>, and `ShippedTranslationsBuild` checks a build with its own locale. The Language tests restore locale, environment and static state after each test (`RestoresProcessState`).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #12327, after a question by Michael Jansen about global state.
NativeGettextreplaced LC_MESSAGES even whereilInitialisation::initLocale()had set a real locale (e.g.de_DE.UTF-8), so the ICU default locale could become "ilias__MESSAGES". It now sets LC_MESSAGES only forC,POSIXandC.<codeset>and otherwise sets justLANGUAGE(andLC_ALLin the environment on macOS/BSD).restore()only takes back what it set.ShippedTranslationsBuildchecks a build with its own locale, so a broken copy of the shipped locale is also refused when a real locale was active before.RestoresProcessStaterestores all locale categories,LANGUAGE,LC_ALL,LC_MESSAGES,LOCPATH,LANGand the static state after each test. Before,ShippedPoMergerTestandShippedLanguageFilesCompiledObjectiveTestleftLANGUAGE/LC_MESSAGESbehind. Checked with a PHPUnit extension after every test: 0 leaks in 8 runs with random order.Checked on macOS (Homebrew PHP 8.5, gettext 1.0) with GitHub Actions: lookups and
setup buildunder 8 locale environments, an administrator locale before and after the first lookup withphp -Sand php-fpm, and the Language tests. Under php-fpm without a locale environment a plaindgettext()crashes the forked worker (SIGSEGV, see beyondcode/herd-community#1656), the lookups of ILIAS do not, as they setLC_ALLsince #12327.Without an administrator locale, a php-fpm worker whose first ICU call comes before a lookup keeps "ilias__MESSAGES" as ICU default locale (documented in the README). No code in the core uses the ICU default locale.