Skip to content

Commit

Permalink
add translations for english, french, spanish, german and italian.
Browse files Browse the repository at this point in the history
  • Loading branch information
naucon committed Oct 29, 2017
1 parent bfbfae7 commit 56d461d
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 17 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# v0.2.0
## 10/29/2017

1. [](#new)
* Add translations for english, french, spanish, german and italian.
* Translations will be used if no `content_message`, `content_dismiss`, `content_link` or `content_href` are defined in `cookieconsent.yaml`.

# v0.1.0
## 08/17/2017

Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ enabled: true
You can customize texts, shape and color with the following available options:
```yaml
# Message on the banner
# Message on the banner (overwrite translation)
content_message: 'This website uses cookies to ensure you get the best experience on our website.'
# Dismiss button text
# Dismiss button text (overwrite translation)
content_dismiss: 'Got it!'
# Policy link text
# Policy link text (overwrite translation)
content_link: 'Learn more'
# Link to policy
# Link to policy (overwrite translation)
content_href: 'https://cookiesandyou.com'

# Color of banner background
Expand Down Expand Up @@ -76,6 +76,13 @@ position: bottom
theme: block
```
### Translation
Translations are defined in the `languages.yaml` file.

Translations will be used if no `content_message`, `content_dismiss`, `content_link` or `content_href` are defined in `cookieconsent.yaml`.



## License

Expand Down
10 changes: 5 additions & 5 deletions blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Cookie Consent
version: 0.1.0
version: 0.2.0
description: This grav plugin is to alert users about the use of cookies on your website. The plugin integrates the popular js lib cookie consent by insites.
icon: gavel
author:
Expand Down Expand Up @@ -27,25 +27,25 @@ form:
type: text
label: Message
help: Message on the banner
default: "This website uses cookies to ensure you get the best experience on our website."
placeholder: "This website uses cookies to ensure you get the best experience on our website."
validate:
type: text
content_dismiss:
type: text
label: Dismiss button text
default: "Got it!"
placeholder: "Got it!"
validate:
type: text
content_link:
type: text
label: Policy link text
default: "Learn more"
placeholder: "Learn more"
validate:
type: text
content_href:
type: text
label: Link to policy
default: "https://cookiesandyou.com"
placeholder: "https://cookiesandyou.com"
validate:
type: url
popup_background_color:
Expand Down
4 changes: 0 additions & 4 deletions cookieconsent.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
enabled: true
content_message: 'This website uses cookies to ensure you get the best experience on our website.'
content_dismiss: 'Got it!'
content_link: 'Learn more'
content_href: 'https://cookiesandyou.com'
popup_background_color: '#000'
popup_text_color: '#fff'
button_background_color: '#f1d600'
Expand Down
39 changes: 39 additions & 0 deletions languages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
en:
PLUGINS:
COOKIECONSENT:
CONTENT_MESSAGE: "This website uses cookies to ensure you get the best experience on our website."
CONTENT_DISMISS: "Got it!"
CONTENT_LINK: "Learn more"
CONTENT_HREF: "https://cookiesandyou.com"

fr:
PLUGINS:
COOKIECONSENT:
CONTENT_MESSAGE: "Nous utilisons des cookies pour assurer une meilleure navigation sur notre site. En utilisant nos services, vous acceptez notre utilisation des cookies."
CONTENT_DISMISS: "OK"
CONTENT_LINK: "En savoir plus"
CONTENT_HREF: "https://cookiesandyou.com"

de:
PLUGINS:
COOKIECONSENT:
CONTENT_MESSAGE: "Diese Webseite verwendet Cookies, um Ihnen einen besseren Service bieten zu können. Durch die weitere Nutzung der Seite stimmen Sie der Verwendung zu."
CONTENT_DISMISS: "OK"
CONTENT_LINK: "Weitere Informationen"
CONTENT_HREF: "https://cookiesandyou.com"

it:
PLUGINS:
COOKIECONSENT:
CONTENT_MESSAGE: "Utilizziamo i cookie per migliorare i nostri servizi. Avvalendoti dei nostri servizi accetti la politica sull'uso dei cookie."
CONTENT_DISMISS: "OK"
CONTENT_LINK: "scopri di più"
CONTENT_HREF: "https://cookiesandyou.com"

es:
PLUGINS:
COOKIECONSENT:
CONTENT_MESSAGE: "Usamos cookies para ofrecer nuestros servicios de la mejor forma posible. Al usar nuestros servicios, usted acepta nuestro uso de cookies."
CONTENT_DISMISS: "OK"
CONTENT_LINK: "ver más"
CONTENT_HREF: "https://cookiesandyou.com"
8 changes: 4 additions & 4 deletions templates/partials/cookieconsent.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ window.cookieconsent.initialise({
{% endif %}
"theme": "{{ config.plugins.cookieconsent.theme }}",
"content": {
"message": "{{ config.plugins.cookieconsent.content_message }}",
"dismiss": "{{ config.plugins.cookieconsent.content_dismiss }}",
"link": "{{ config.plugins.cookieconsent.content_link }}",
"href": "{{ config.plugins.cookieconsent.content_href }}"
"message": "{% if config.plugins.cookieconsent.content_message %}{{ config.plugins.cookieconsent.content_message }}{% else %}{{ 'PLUGINS.COOKIECONSENT.CONTENT_MESSAGE'|t }}{% endif %}",
"dismiss": "{% if config.plugins.cookieconsent.content_dismiss %}{{ config.plugins.cookieconsent.content_dismiss }}{% else %}{{ 'PLUGINS.COOKIECONSENT.CONTENT_DISMISS'|t }}{% endif %}",
"link": "{% if config.plugins.cookieconsent.content_link %}{{ config.plugins.cookieconsent.content_link }}{% else %}{{ 'PLUGINS.COOKIECONSENT.CONTENT_LINK'|t }}{% endif %}",
"href": "{% if config.plugins.cookieconsent.content_href %}{{ config.plugins.cookieconsent.content_href }}{% else %}{{ 'PLUGINS.COOKIECONSENT.CONTENT_HREF'|t }}{% endif %}"
}
})});

0 comments on commit 56d461d

Please sign in to comment.