Skip to content

Commit

Permalink
chore: make cookie consent translatable, but it seems to load before …
Browse files Browse the repository at this point in the history
…the user's language selection (#98)

* chore: make cookie consent translatable, but it seems to load before the user's language selection

* chore: delay cookieconsent appearance until tolgee load complete
  • Loading branch information
budak7273 authored Nov 15, 2023
1 parent a24c165 commit 3c131cf
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// language - current active spelling language
"language": "en",
// words - list of words to be always considered correct
"words": ["cfworker", "felte", "ficsit", "pnpx", "prismjs", "urql", "webp", "wonka"],
"words": ["cfworker", "felte", "ficsit", "pnpx", "prismjs", "smui", "tolgee", "urql", "webp", "wonka"],
// flagWords - list of words to be always considered incorrect
// This is useful for offensive words and common spelling errors.
// cSpell:disable (don't complain about the words we listed here)
Expand Down
38 changes: 23 additions & 15 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,30 @@
await import('cookieconsent/src/cookieconsent');
if ('cookieconsent' in window) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
window.cookieconsent.initialise({
palette: {
popup: {
background: '#000'
tolgee.on('initialLoad', () => {
if ('cookieconsent' in window) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// cspell:ignore initialise
window.cookieconsent.initialise({
palette: {
popup: {
background: '#000'
},
button: {
background: '#f1d600'
}
},
button: {
background: '#f1d600'
}
},
theme: 'edgeless',
position: 'bottom-right'
});
}
content: {
message: tolgee.t('cookieconsent.message'),
link: tolgee.t('cookieconsent.link'),
dismiss: tolgee.t('cookieconsent.dismiss')
},
theme: 'edgeless',
position: 'bottom-right'
});
}
});
customProtocolCheck.set(await import('$lib/thirdparty/custom_protocol'));
Expand Down

0 comments on commit 3c131cf

Please sign in to comment.