fix(tmdb): drive release/cert/provider region priority from locale, not a hardcoded FR list - #96
Open
ndandan wants to merge 3 commits into
Open
fix(tmdb): drive release/cert/provider region priority from locale, not a hardcoded FR list#96ndandan wants to merge 3 commits into
ndandan wants to merge 3 commits into
Conversation
…#2) Design-critique deferred item. TMDb release dates, certifications, alt titles and watch/providers all picked countries from hardcoded FR-first lists, so an English user saw French release dates and providers first. - New TmdbClient::regionPriority(locale, append) returns a country-code priority led by the locale's home region (en → US/GB/CA/AU, fr → FR/BE/LU/CA, + es/de/pt/it), followed by a broad common fallback chain and any extra countries present in the payload, de-duplicated and order-preserving. - Wired at all six sites (via $this->translator->getLocale()): TmdbController alt-titles / pickProviders / pickMovieCertification / pickTvCertification, DashboardController tmdbMovieReleaseDates / quick-look providers. - Unit test for regionPriority (6 cases: fr/en lead, locale suffix, append dedup, unknown + empty locale fallbacks) — green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…code to a country
Two regionPriority() fixes:
- An explicit region subtag now leads the chain outright: en_GB users get
GB-first (previously the 'en' language map still led with US), fr-CA
leads CA, pt_BR leads BR.
- The default arm no longer fabricates a country from the language code.
'sv' is Swedish but 'SV' is El Salvador — an unmapped language upcast
that way would rank the wrong country's certifications/providers first
('ja'->JA, 'ko'->KO, 'uk'->UK are invalid or wrong codes). Unmapped
languages now fall straight to the common chain + payload countries.
Latent today (enabled_locales is en+fr, both mapped) but the method is a
public static API; regression tests added for both behaviors.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
The Discover / quick-look TMDb lookups picked release dates, content certifications, alternative titles and streaming providers from a hardcoded FR-first country list (e.g.
['FR', 'BE', 'LU', 'US', 'GB'],['FR', 'US']). An English-locale install therefore saw French theatrical dates, French ratings and French provider availability instead of its own region's.Region priority is now derived from the active locale:
TmdbClient::regionPriority(string $locale, array $append = [])returns a country-code priority list led by the locale's home region (en→ US/GB/CA/AU,fr→ FR/BE/LU/CA, plus es/de/pt/it), followed by a broad common fallback chain and any extra countries actually present in the payload — de-duplicated and order-preserving.$this->translator->getLocale():TmdbControlleralt-titles / providers / movie-certification / tv-certification, andDashboardControllermovie release-dates / quick-look providers.TmdbClientRegionPriorityTestcovers 6 cases (fr/en lead, locale suffix, append dedup, unknown + empty locale fallbacks).Behaviour for FR installs is unchanged (FR still leads for
frlocale); non-FR installs now get their own region's data.