azuyalabs / yasumi

The easy PHP Library for calculating holidays
https://www.yasumi.dev
Other
1.04k stars 152 forks source link

Add SubstituteHoliday #162

Closed c960657 closed 5 years ago

c960657 commented 5 years ago

I noticed that there is no translation for substituteHoliday:secondChristmasDay in the UnitedKingdom provider. I realised that providing translations for substitute holidays is cumbersome, especially when using global translations.

With this PR, substitute holidays are promoted into a first-class citizen with the SubstituteHoliday class. It references the substituted holiday and can inherit the translations from that with an “observed” suffix appended, if the substitute holiday itself does not have an original name.

The idea of using {0} as a placeholder is inherited from CLDR (see e.g. https://raw.githubusercontent.com/unicode-org/cldr/master/common/main/nl.xml).