CRM_Utils_Date - Month and day names should match active locale #21569
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.
Overview
(Note: Some of the unit-tests in this patch depend on items from #21531. The PR will look a lot smaller after merge+rebase.)
This fixes a cache-bug in
CRM_Utils_Date
which prevents dates from being localized, as in a scenario like:Before
The first time that it translates a month name (
%B
),CRM_Utils_Date
stores a cache of all month names. This is shared by all locales. Thus, a French-speaking user may wind up seeing dates with Spanish names.After
The cache of month names and date names is split (per-locale).
Technical Details
I included a lower-level test to show the various caches are locale-friendly - as well as a higher-level test to show that dates are localized when composing batch-messages for different people in different locales.