Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locale override for getName() #184

Closed
wants to merge 1 commit into from

Conversation

c960657
Copy link
Contributor

@c960657 c960657 commented Oct 31, 2019

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 the translations 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.

@c960657 c960657 changed the title Locale override Locale override for getName() Oct 31, 2019
@c960657
Copy link
Contributor Author

c960657 commented Nov 10, 2019

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.

@c960657
Copy link
Contributor Author

c960657 commented Jan 3, 2020

I have created a alternative PR that implements the suggestion in my latest comment: #195.

@github-actions
Copy link

github-actions bot commented Mar 5, 2020

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

@stelgenhof
Copy link
Member

@c960657 I have reviewed and merged your other PR. I guess we can close this one, right?

@c960657
Copy link
Contributor Author

c960657 commented May 2, 2020

Yes, this PR is no longer relevant.

@c960657 c960657 closed this May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No easy way to get substituted holiday translations?
2 participants