Closed johlton closed 8 years ago
Thanks! I don't have a L5.3 environment at hand, so let me test this tomorrow. I actually haven't tested this with any particular framework, however should indeed work.
Hi @johlton
Just checked and the function getHolidayNames() only returns the short names of the holidays. If you use the function getHolidays() you can get the localized names, like this:
$holidays = Yasumi::create('Germany', 2016, 'de_DE');
foreach ($holidays->getHolidays() as $name) {
echo $name->getName().PHP_EOL;
}
Result:
Neujahr
Karfreitag
Easter Sunday
Ostermontag
Tag der Arbeit
Christi Himmelfahrt
Whitsunday
Pfingstmontag
Tag der Deutschen Einheit
1. Weihnachtsfeiertag
2. Weihnachtsfeiertag
I admit the function name getHolidayNames() is a bit misleading :). The advantage of the getHolidays() function is that it returns a collection of Holiday objects, so you also can access other object properties!
Let me know if this works for you.
Thank you so much, it works like a charm. Keep up the great work! :)
Using this great library in Laravel 5.3 i cannot get the localized names to work (in my case German).
Calling:
$holidays = Yasumi::create('Germany', Carbon::now()->year, 'de_DE');
Result:
The locale is set correctly. I'm surely missing something obvious here but can you point me to the right direction?
Thanks!