🔀 Merge pull request #1192 from BhasherBEL/master

Add lang option for public holidays
This commit is contained in:
Alicia Sykes 2023-07-15 12:13:29 +01:00 committed by GitHub
commit 3c25fb8494
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -709,6 +709,7 @@ Counting down to the next day off work? This widget displays upcoming public hol
**`state`** | `string` | **Optional** | restrict a country to a specific state defined by [ISO_3166-2](https://en.wikipedia.org/wiki/ISO_3166-2), e.g. `LND`.
**`holidayType`** | `string` | **Optional** | The type of holidays to fetch. Can be: `all`, `public_holiday`, `observance`, `school_holiday`, `other_day` or `extra_working_day`. Defaults to `public_holiday`
**`monthsToShow`** | `number` | **Optional** | The number of months in advance to show. Min: `1`, max: `24`. Defaults to `12`
**`lang`** | `string` | **Optional** | The language in which the events should be. Usually local languages and english are available. Default to first available in the country. e.g. `en` or `fr`.
#### Example
@ -719,6 +720,7 @@ Counting down to the next day off work? This widget displays upcoming public hol
region: LND
holidayType: all
monthsToShow: 12
lang: en
```
#### Info

View File

@ -90,7 +90,7 @@ export default {
const formatType = (ht) => capitalize(ht.replaceAll('_', ' '));
holidays.forEach((holiday) => {
results.push({
name: holiday.name[0].text,
name: holiday.name.filter(p => p.lang == this.options.lang)[0].text || holiday.name[0].text,
date: makeDate(holiday.date),
type: formatType(holiday.holidayType),
observed: holiday.observedOn ? makeDate(holiday.observedOn) : '',