Skip to content

Commit

Permalink
Add specific holiday strings to germany
Browse files Browse the repository at this point in the history
  • Loading branch information
Dlurak committed Jun 28, 2024
1 parent 9f59aa4 commit 8947e10
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
14 changes: 12 additions & 2 deletions src/lib/components/holiday/HolidayBox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
return obj.text;
}
function nationwideLocalizer(country: string) {
switch (country.toLowerCase()) {
case 'de':
return '.germany';
default:
return '';
}
}
</script>

<script lang="ts">
Expand All @@ -28,6 +37,7 @@
type HolidayEvent = Awaited<ReturnType<Holiday['getSchoolHolidays']>>[number];
export let holiday: HolidayEvent;
export let country: string | undefined;
$: name = getPrefferedString(holiday.name, $currentLang);
$: comment = getPrefferedString(holiday.comment ?? [], $currentLang);
Expand Down Expand Up @@ -82,9 +92,9 @@
<Icon src={MapPin} class="h-5 w-5" mini />

{#if holiday.nationwide}
<Store store={i('holiday.nationwide.true')} />
<Store store={i(`holiday.nationwide.true${nationwideLocalizer(country ?? '')}`)} />
{:else}
<Store store={i('holiday.nationwide.false')} />
<Store store={i(`holiday.nationwide.false${nationwideLocalizer(country ?? '')}`)} />
{/if}
</div>
</div>
6 changes: 2 additions & 4 deletions src/lib/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -584,12 +584,10 @@ const de = {
}
},

/*
* TODO:Add some specific to countries, e.g
* `Bund` and `Bundesländer` for germany
*/
'holiday.nationwide.true': 'Im gesamten Land',
'holiday.nationwide.true.germany': 'Im gesamten Bund',
'holiday.nationwide.false': 'Nur in einigen Provinzen',
'holiday.nationwide.false.germany': 'Nur in einigen Bundesländern',

'filter.filter': 'Filter',

Expand Down
6 changes: 2 additions & 4 deletions src/lib/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -571,12 +571,10 @@ const en = {
}
},

/*
* TODO:Add some specific to countries, e.g
* `Bund` and `Bundesländer` for germany
*/
'holiday.nationwide.true': 'In the entire country',
'holiday.nationwide.true.germany': 'In all German states',
'holiday.nationwide.false': 'Only in some subdivisions',
'holiday.nationwide.false.germany': 'Only in some states',

'filter.filter': 'Filters',

Expand Down
2 changes: 1 addition & 1 deletion src/routes/holiday/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

<div class="grid w-full grid-cols-[repeat(auto-fill,minmax(min(20rem,100%),1fr))] gap-2">
{#each data.holidays as holiday}
<HolidayBox {holiday} />
<HolidayBox {holiday} country={data.location.apiCountry?.isoCode} />
{/each}
</div>

Expand Down

0 comments on commit 8947e10

Please sign in to comment.