Closed c960657 closed 4 years ago
One further possible feature would be allowing the user override the “default fallback locale chain”, e.g. by passing an array of locales instead of just a string.
E.g. $holiday->getName('ca_ES')
would look for translations in Catalan with fallback to English, while $holiday->getName(['ca_ES', 'es_ES', 'en'])
would look for Catalan, then Spanish, and finally English.
I have created a alternative PR that implements the suggestion in my latest comment: #195.
This pull request has been open 30 days with no activity. Please remove the stale label or comment, or this will be closed in 5 days
@c960657 I have reviewed and merged your other PR. I guess we can close this one, right?
Yes, this PR is no longer relevant.
Sometimes you need multiple translations for the same holiday.
Pre v2.2.0 you could easily access all translations in
$holiday->translations
. With the introduction of locale fallback in #176, things got more complicated, especially with substitute holidays (introduced in #162), so accessing thetranslations
property is difficult.I suggest adding an optional
$locale
parameter to$holiday->getName()
.This fixes #181.
This suggestion is a subset of what was proposed in #123. This PR does not include the default locale part, only the locale override.