Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

Add lang option for public holidays

Bhasherc418b7b7ae0a
diff --git a/docs/widgets.md b/docs/widgets.md
index cc9a1450..b31ef13a 100644
--- a/docs/widgets.md
+++ b/docs/widgets.md
@@ -707,6 +707,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
@@ -717,6 +718,7 @@ Counting down to the next day off work? This widget displays upcoming public hol
region: LND
holidayType: all
monthsToShow: 12
+ lang: en
```
#### Info
diff --git a/src/components/Widgets/PublicHolidays.vue b/src/components/Widgets/PublicHolidays.vue
index 6d3d1e12..424160cf 100644
--- a/src/components/Widgets/PublicHolidays.vue
+++ b/src/components/Widgets/PublicHolidays.vue
@@ -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) : '',