Skip to content

Commit c418b7b

Browse files
committed
Add lang option for public holidays
1 parent 09e61a5 commit c418b7b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

docs/widgets.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ Counting down to the next day off work? This widget displays upcoming public hol
707707
**`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`.
708708
**`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`
709709
**`monthsToShow`** | `number` | **Optional** | The number of months in advance to show. Min: `1`, max: `24`. Defaults to `12`
710+
**`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`.
710711

711712
#### Example
712713

@@ -717,6 +718,7 @@ Counting down to the next day off work? This widget displays upcoming public hol
717718
region: LND
718719
holidayType: all
719720
monthsToShow: 12
721+
lang: en
720722
```
721723

722724
#### Info

src/components/Widgets/PublicHolidays.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export default {
9090
const formatType = (ht) => capitalize(ht.replaceAll('_', ' '));
9191
holidays.forEach((holiday) => {
9292
results.push({
93-
name: holiday.name[0].text,
93+
name: holiday.name.filter(p => p.lang == this.options.lang)[0].text || holiday.name[0].text,
9494
date: makeDate(holiday.date),
9595
type: formatType(holiday.holidayType),
9696
observed: holiday.observedOn ? makeDate(holiday.observedOn) : '',

0 commit comments

Comments
 (0)