Skip to content

Commit ea5e93f

Browse files
committed
Merge branch 'master' into beta
2 parents 2fbe156 + 58c7158 commit ea5e93f

File tree

12 files changed

+314
-90
lines changed

12 files changed

+314
-90
lines changed

CHANGELOG.md

+58
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,64 @@
2424
* - rename module option `isCssPolyfillEnabled` to `isCssPonyfillEnabled`
2525
- set module option `isCssPonyfillEnabled` default to `false`
2626

27+
# [4.6.0](https://github.com/dargmuesli/nuxt-cookie-control/compare/4.5.0...4.6.0) (2023-02-24)
28+
29+
30+
### Features
31+
32+
* **i18n:** adapt new locale format for Turkish translation ([9111d9c](https://github.com/dargmuesli/nuxt-cookie-control/commit/9111d9cc02a5db4b307b9fee57ffebadd9de2027))
33+
* **i18n:** add Turkish translation ([8dd647c](https://github.com/dargmuesli/nuxt-cookie-control/commit/8dd647c6030911857976def4667f7eb1631783c2))
34+
35+
# [4.5.0](https://github.com/dargmuesli/nuxt-cookie-control/compare/4.4.1...4.5.0) (2023-02-24)
36+
37+
38+
### Features
39+
40+
* **locale:** add Lithuanian locales ([db8a85e](https://github.com/dargmuesli/nuxt-cookie-control/commit/db8a85e19b124037c3351ed4488292d424ff5882))
41+
42+
## [4.4.1](https://github.com/dargmuesli/nuxt-cookie-control/compare/4.4.0...4.4.1) (2023-02-15)
43+
44+
45+
### Bug Fixes
46+
47+
* **release:** schedule release ([40a9795](https://github.com/dargmuesli/nuxt-cookie-control/commit/40a9795c9e295ea96ed492acd85b613db077ce45))
48+
49+
# [4.4.0](https://github.com/dargmuesli/nuxt-cookie-control/compare/4.3.0...4.4.0) (2023-02-07)
50+
51+
52+
### Features
53+
54+
* **locale:** add Czech and Slovak locales ([5db470c](https://github.com/dargmuesli/nuxt-cookie-control/commit/5db470ca5b8c1fd131be8a52f4c218762374f72f))
55+
56+
# [4.3.0](https://github.com/dargmuesli/nuxt-cookie-control/compare/4.2.0...4.3.0) (2023-02-02)
57+
58+
59+
### Features
60+
61+
* Updated bannerDescription translation for Azerbaijani language ([#35](https://github.com/dargmuesli/nuxt-cookie-control/issues/35)) ([b2c2977](https://github.com/dargmuesli/nuxt-cookie-control/commit/b2c297752673b678a128af0222de226e23462f4d))
62+
63+
# [4.2.0](https://github.com/dargmuesli/nuxt-cookie-control/compare/4.1.0...4.2.0) (2023-02-02)
64+
65+
66+
### Features
67+
68+
* **ko:** Add Korean Cookie message ([983c3e7](https://github.com/dargmuesli/nuxt-cookie-control/commit/983c3e7c02120778151a6e4c5f0b001833b11f9e))
69+
* **locale:** add Azerbaijani ([1bf8609](https://github.com/dargmuesli/nuxt-cookie-control/commit/1bf860944886cb4348cac0c47bd9d7c45d0a30ab))
70+
71+
# [4.1.0](https://github.com/dargmuesli/nuxt-cookie-control/compare/4.0.3...4.1.0) (2023-02-01)
72+
73+
74+
### Features
75+
76+
* **lang:** Add Danish language ([df8143b](https://github.com/dargmuesli/nuxt-cookie-control/commit/df8143b369412f1fe597d8f932a44e7d9a586096))
77+
78+
## [4.0.3](https://github.com/dargmuesli/nuxt-cookie-control/compare/4.0.2...4.0.3) (2023-01-29)
79+
80+
81+
### Bug Fixes
82+
83+
* **locale:** correct language switch reactivity ([5957224](https://github.com/dargmuesli/nuxt-cookie-control/commit/5957224e59311d7a18d4449ca962c2dadd9d2ff3))
84+
2785
## [4.0.2](https://github.com/dargmuesli/nuxt-cookie-control/compare/4.0.1...4.0.2) (2023-01-29)
2886

2987

README.md

+83-55
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,49 @@
44
![Nuxt Cookie Control](https://drive.google.com/a/broj42.com/uc?id=1FGQVyj2s0OT-gpTYxH_FuQhe6oU9iejW)
55

66

7-
Continuing Dario Ferderber's work on [gitlab.com/broj42/nuxt-cookie-control](https://gitlab.com/broj42/nuxt-cookie-control).
7+
✅ Translated for: ar, az, cs, da, de, en, es, fr, hr, hu, it, ja, ko, lt, nl, no, pt, ru, sk, tr and uk
88

9-
🚩 **Make sure to read the Migration instructions for all major version updates like [v2.0.0](https://github.com/dargmuesli/nuxt-cookie-control/releases/tag/2.0.0), [v3.0.0](https://github.com/dargmuesli/nuxt-cookie-control/releases/tag/3.0.0) and following!**
9+
✅ Vue 3 support
10+
11+
✅ Components and composables are [auto-imported](https://nuxt.com/docs/guide/concepts/auto-imports)
12+
13+
🚩 API changes since continuing Dario Ferderber's work on [gitlab.com/broj42/nuxt-cookie-control](https://gitlab.com/broj42/nuxt-cookie-control), make sure to read the README!
14+
15+
16+
## 🚀 Getting Started
1017

1118
[![Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/dargmuesli/nuxt-cookie-control?file=playground%2Fapp.vue)
1219

13-
## 🚀 Usage
20+
### Installation
1421
```bash
1522
npm i -D @dargmuesli/nuxt-cookie-control
1623
yarn add -D @dargmuesli/nuxt-cookie-control
1724
pnpm i -D @dargmuesli/nuxt-cookie-control
1825
```
1926

20-
27+
### Configuration
2128
```javascript
2229
// nuxt.config.js
2330

2431
modules: [
2532
'@dargmuesli/nuxt-cookie-control'
26-
]
33+
],
34+
cookieControl: {
35+
// typed module options
36+
}
37+
2738
// or
39+
2840
modules: [
2941
['@dargmuesli/nuxt-cookie-control', {
30-
// module options
42+
// untyped module options
3143
}]
3244
]
3345
```
3446

35-
Components and composables are [auto-imported](https://nuxt.com/docs/guide/concepts/auto-imports)!
36-
47+
### Usage
3748
```html
38-
<!-- component.vue -->
49+
<!-- app.vue -->
3950

4051
<template>
4152
<CookieControl locale="en" />
@@ -49,56 +60,39 @@ const {
4960
isModalActive,
5061
moduleOptions
5162
} = useCookieControl()
63+
64+
// example: react to a cookie being accepted
65+
watch(
66+
() => cookiesEnabledIds.value,
67+
(current, previous) => {
68+
if (
69+
(!previous?.includes('google-analytics') &&
70+
current?.includes('google-analytics'))
71+
) {
72+
// cookie with id `google-analytics` got added
73+
window.location.reload() // placeholder for your custom change handler
74+
}
75+
},
76+
{ deep: true }
77+
)
5278
</script>
5379
```
54-
## Component Slots
55-
### Bar
56-
```html
57-
<CookieControl>
58-
<template #bar>
59-
<h3>Bar title</h3>
60-
<p>Bar description (you can use $cookies.text.barDescription)</p>
61-
<n-link>Go somewhere</n-link>
62-
</template>
63-
</CookieControl>
64-
```
65-
### Modal
66-
```html
67-
<template #modal>
68-
<h3>Modal title</h3>
69-
<p>Modal description</p>
70-
</template>
71-
```
72-
### Cookie
73-
```html
74-
<template #cookie="{config}">
75-
<span v-for="c in config" :key="c.id" v-text="c.cookies"/>
76-
</template>
77-
```
7880
79-
## Props
80-
- locale: `['en']`
81-
```html
82-
<CookieControl locale="de"/>
81+
```ts
82+
// plugins/analytics.client.ts
83+
84+
// example: initialization based on enabled cookies
85+
const cookieControl = useCookieControl()
86+
87+
if (cookieControl.cookiesEnabledIds.value.includes('google-analytics')) {
88+
initGoogleAnalytics() // placeholder for your custom initialization
89+
}
8390
```
8491
85-
Currently available:
86-
- ar
87-
- de
88-
- en
89-
- es
90-
- fr
91-
- hr
92-
- hu
93-
- it
94-
- ja
95-
- nl
96-
- no
97-
- pt
98-
- ru
99-
- uk
100-
101-
## Module Options
92+
93+
## API
94+
95+
### Module Options
10296
10397
```javascript
10498
// Position of cookie bar.
@@ -191,7 +185,7 @@ localeTexts: {
191185
}
192186
```
193187
194-
### Cookies
188+
#### Cookies
195189
196190
Every property the includes a `{ en: ... }` value is a translatable property that could instead only specify a string (`'...'`) or other locales as well (`{ de: ..., uk: ... }`).
197191
@@ -209,6 +203,40 @@ Every property the includes a `{ en: ... }` value is a translatable property tha
209203
}
210204
```
211205
206+
### Component Slots
207+
208+
#### Bar
209+
```html
210+
<CookieControl>
211+
<template #bar>
212+
<h3>Bar title</h3>
213+
<p>Bar description (you can use $cookies.text.barDescription)</p>
214+
<n-link>Go somewhere</n-link>
215+
</template>
216+
</CookieControl>
217+
```
218+
219+
#### Modal
220+
```html
221+
<template #modal>
222+
<h3>Modal title</h3>
223+
<p>Modal description</p>
224+
</template>
225+
```
226+
227+
#### Cookie
228+
```html
229+
<template #cookie="{config}">
230+
<span v-for="c in config" :key="c.id" v-text="c.cookies"/>
231+
</template>
232+
```
233+
234+
### Props
235+
- locale: `['en']`
236+
```html
237+
<CookieControl locale="de"/>
238+
```
239+
212240
213241
<!-- Badges -->
214242
[npm-version-src]: https://badgen.net/npm/v/@dargmuesli/nuxt-cookie-control/latest

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@
6262
"publishConfig": {
6363
"access": "public"
6464
},
65-
"scheduleVersion": "2.2.2"
65+
"scheduleVersion": "4.4.1"
6666
}

playground/nuxt.config.ts

+31-33
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,36 @@
11
export default defineNuxtConfig({
2-
modules: [
3-
[
4-
'@dargmuesli/nuxt-cookie-control',
5-
{
6-
colors: {
7-
checkboxActiveBackground: '#00A34A', // text-green-600
8-
},
9-
cookies: {
10-
necessary: [
11-
{
12-
description: {
13-
de: 'Dieser Cookie tut etwas.',
14-
en: 'This cookie does something.',
15-
},
16-
name: {
17-
de: 'Notwendiger Cookie',
18-
en: 'Necessary Cookie',
19-
},
20-
targetCookieIds: ['NEC'],
21-
},
22-
],
23-
optional: [
24-
{
25-
name: 'Optional Cookie',
26-
id: 'op',
27-
targetCookieIds: ['_o', '_p', '_t'],
28-
},
29-
],
30-
},
31-
locales: ['en', 'de'],
32-
},
33-
],
34-
],
2+
modules: ['@dargmuesli/nuxt-cookie-control'],
353
typescript: {
364
includeWorkspace: true,
375
},
6+
7+
// module options
8+
cookieControl: {
9+
colors: {
10+
checkboxActiveBackground: '#00A34A', // text-green-600
11+
},
12+
cookies: {
13+
necessary: [
14+
{
15+
description: {
16+
de: 'Dieser Cookie tut etwas.',
17+
en: 'This cookie does something.',
18+
},
19+
name: {
20+
de: 'Notwendiger Cookie',
21+
en: 'Necessary Cookie',
22+
},
23+
targetCookieIds: ['NEC'],
24+
},
25+
],
26+
optional: [
27+
{
28+
name: 'Optional Cookie',
29+
id: 'op',
30+
targetCookieIds: ['_o', '_p', '_t'],
31+
},
32+
],
33+
},
34+
locales: ['en', 'de'],
35+
},
3836
})

pnpm-lock.yaml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/runtime/locale/az.ts

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { LocaleStrings } from '../types'
2+
3+
export default {
4+
accept: 'Qəbul et',
5+
acceptAll: 'Hamısını qəbul et',
6+
bannerDescription:
7+
'Biz öz kukilərimizdən və üçüncü tərəf kukilərindən istifadə edirik ki, biz bu veb-saytı düzgün göstərə bilək və təklif etdiyimiz xidmətləri təkmilləşdirmək məqsədilə bu veb-saytdan necə istifadə olunduğunu daha yaxşı başa düşək. Kukidən istifadə icazələri ilə bağlı qərar bu bannerdə seçim edildikdən sonra görünəcək kuki düyməsindən istifadə etməklə istənilən vaxt dəyişdirilə bilər.',
8+
bannerTitle: 'Kukilər',
9+
close: 'Bağla',
10+
cookiesFunctional: 'Funksional kukilər',
11+
cookiesNecessary: 'Zəruri kukilər',
12+
cookiesOptional: 'İstəyə bağlı kukilər',
13+
decline: 'Rədd et',
14+
declineAll: 'Hamısını rədd et',
15+
here: 'burada',
16+
iframeBlocked: 'Bunu görmək üçün funksional kukiləri aktiv edin',
17+
manageCookies: 'Kukiləri idarə et',
18+
save: 'Yadda saxla',
19+
settingsUnsaved: 'Yadda saxlanmamış ayarlarınız var',
20+
} as LocaleStrings

src/runtime/locale/cs.ts

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { LocaleStrings } from '../types'
2+
3+
export default {
4+
accept: 'Přijmout',
5+
acceptAll: 'Přijmout vše',
6+
bannerDescription:
7+
'Používáme soubory cookie a cookie třetích stran, abychom mohli vše správně zobrazovat a lépe porozumět tomu, jak tento web používáte, s cílem zlepšit nabízené služby. Rozhodnutí lze kdykoli změnit pomocí tlačítka cookie, které se zobrazí po provedení výběru na tomto banneru.',
8+
bannerTitle: 'Cookies',
9+
close: 'Zavřít',
10+
cookiesFunctional: 'Obslužné cookies',
11+
cookiesNecessary: 'Nezbytné cookies',
12+
cookiesOptional: 'Volitelné cookies',
13+
decline: 'Zamítnout',
14+
declineAll: 'Zamítnout vše',
15+
here: 'zde',
16+
iframeBlocked: 'Chcete-li ji zobrazit, povolte obslužné cookies',
17+
manageCookies: 'Další informace a přizpůsobení',
18+
save: 'Uložit',
19+
settingsUnsaved: 'Máte neuložená nastavení',
20+
} as LocaleStrings

0 commit comments

Comments
 (0)