diff --git a/README.md b/README.md index f5624962..70a7c260 100644 --- a/README.md +++ b/README.md @@ -44,19 +44,22 @@ Each time that a commit needs to be translated in other languages, a link to thi ### Alerts -You can easily put a global alert on the website by changing the ALERT and ALERT\_CLASS variables in _config.yml. -And you can also set an alert specific to a language by appending the language code to the ALERT. +You can easily put an alert on the website by changing the ALERT and ALERT\_CLASS variables in _config.yml. +You can both set one fallback alert for all languages and many translated alerts for specific languages. Example: ``` -ALERT_CLASS: error -ALERT: Security alert: Please upgrade to 0.3.25 as soon as possible! -ALERT_fr: Alerte de sécurité: Mettez Bitcoin à jour vers la version 0.3.25 sans délais! +ALERT_CLASS: + all: Security alert: Please upgrade to 0.8.1 as soon as possible! + fr: Alerte de sécurité: Mettez Bitcoin à jour vers la version 0.8.1 sans délais! +ALERT: + all: error + fr: error ``` -will produce an english red alert box for all languages, and a translated red alert box for french language. -Possible classes are: error (red), info (blue), success (green) and warning (yellow) +This will produce an english red alert box for all languages, and a translated red alert box for french language. +Possible classes are: **error** (red), **info** (blue), **success** (green) and **warning** (yellow) ### Release Notes diff --git a/_config.yml b/_config.yml index 8e239f1b..4e3d19e5 100644 --- a/_config.yml +++ b/_config.yml @@ -1,6 +1,18 @@ DOWNLOAD_VERSION: 0.8.1 -ALERT_CLASS: -ALERT: + +ALERT_CLASS: + all: + en: + es: + fr: + nl: + +ALERT: + all: + en: + es: + fr: + nl: langsorder: - id: en diff --git a/_contrib/translate b/_contrib/translate index deeb8971..465b93b9 100755 --- a/_contrib/translate +++ b/_contrib/translate @@ -10,11 +10,11 @@ cp _layouts/base-en.html _layouts/base-${1}.html sed -i "s_layout: base-en_layout: base-${1}_g" ${1}/*.html sed -i "s_lang: en_lang: ${1}_g" ${1}/*.html sed -i "s_lang: en_lang: ${1}_g" _layouts/base-${1}.html -sed -i "s/ALERT_CLASS_en/ALERT_CLASS_${1}/g" _layouts/base-${1}.html -sed -i "s/ALERT_en/ALERT_${1}/g" _layouts/base-${1}.html -sed -i "/${1}: ${2}/d" _config.yml +sed -i "/id: ${1}/d" _config.yml +sed -i "/${1}: /d" _config.yml sed -i "/langs:/a - ${1}: ${2}" _config.yml sed -i "s_- ${1}: ${2}_ ${1}: ${2}_g" _config.yml -sed -i "/- id: ${1}/d" _config.yml sed -i "/langsorder:/a- id: ${1}" _config.yml sed -i "s_- id:${1}_- id: ${1}_g" _config.yml +sed -i "/all:/a- ${1}: " _config.yml +sed -i "s_- ${1}_ ${1}_g" _config.yml diff --git a/_layouts/base-en.html b/_layouts/base-en.html index b55a6f2a..5de21c6b 100644 --- a/_layouts/base-en.html +++ b/_layouts/base-en.html @@ -45,9 +45,9 @@ footer: © Bitcoin Project 2009–2013 Released under the
-{% if site.ALERT or site.ALERT_en %} - {% if site.ALERT_CLASS %}{% assign class = site.ALERT_CLASS%}{% endif %}{% if site.ALERT_CLASS_en %}{% assign class = site.ALERT_CLASS_en%}{% endif %} - {% if site.ALERT %}{% assign alert = site.ALERT%}{% endif %}{% if site.ALERT_en %}{% assign alert = site.ALERT_en%}{% endif %} +{% if site.ALERT.all or site.ALERT[page.lang] %} + {% if site.ALERT_CLASS.all %}{% assign class = site.ALERT_CLASS.all%}{% endif %}{% if site.ALERT_CLASS[page.lang] %}{% assign class = site.ALERT_CLASS[page.lang]%}{% endif %} + {% if site.ALERT.all %}{% assign alert = site.ALERT.all%}{% endif %}{% if site.ALERT[page.lang] %}{% assign alert = site.ALERT[page.lang]%}{% endif %} diff --git a/_layouts/base-es.html b/_layouts/base-es.html index a4af27a6..a568f287 100644 --- a/_layouts/base-es.html +++ b/_layouts/base-es.html @@ -43,9 +43,9 @@ footer: © Bitcoin Project 2009–2013 Publicado bajo la -{% if site.ALERT or site.ALERT_es %} - {% if site.ALERT_CLASS %}{% assign class = site.ALERT_CLASS%}{% endif %}{% if site.ALERT_CLASS_es %}{% assign class = site.ALERT_CLASS_es%}{% endif %} - {% if site.ALERT %}{% assign alert = site.ALERT%}{% endif %}{% if site.ALERT_es %}{% assign alert = site.ALERT_es%}{% endif %} +{% if site.ALERT.all or site.ALERT[page.lang] %} + {% if site.ALERT_CLASS.all %}{% assign class = site.ALERT_CLASS.all%}{% endif %}{% if site.ALERT_CLASS[page.lang] %}{% assign class = site.ALERT_CLASS[page.lang]%}{% endif %} + {% if site.ALERT.all %}{% assign alert = site.ALERT.all%}{% endif %}{% if site.ALERT[page.lang] %}{% assign alert = site.ALERT[page.lang]%}{% endif %} diff --git a/_layouts/base-fr.html b/_layouts/base-fr.html index 5015072a..5812787d 100644 --- a/_layouts/base-fr.html +++ b/_layouts/base-fr.html @@ -43,9 +43,9 @@ footer: © Bitcoin Project 2009–2013 Publié sous la -{% if site.ALERT or site.ALERT_fr %} - {% if site.ALERT_CLASS %}{% assign class = site.ALERT_CLASS%}{% endif %}{% if site.ALERT_CLASS_fr %}{% assign class = site.ALERT_CLASS_fr%}{% endif %} - {% if site.ALERT %}{% assign alert = site.ALERT%}{% endif %}{% if site.ALERT_fr %}{% assign alert = site.ALERT_fr%}{% endif %} +{% if site.ALERT.all or site.ALERT[page.lang] %} + {% if site.ALERT_CLASS.all %}{% assign class = site.ALERT_CLASS.all%}{% endif %}{% if site.ALERT_CLASS[page.lang] %}{% assign class = site.ALERT_CLASS[page.lang]%}{% endif %} + {% if site.ALERT.all %}{% assign alert = site.ALERT.all%}{% endif %}{% if site.ALERT[page.lang] %}{% assign alert = site.ALERT[page.lang]%}{% endif %} diff --git a/_layouts/base-nl.html b/_layouts/base-nl.html index 6959c997..9d15e22d 100644 --- a/_layouts/base-nl.html +++ b/_layouts/base-nl.html @@ -43,9 +43,9 @@ footer: © Bitcoin Project 2009–2013 Beschikbaar onder de -{% if site.ALERT or site.ALERT_nl %} - {% if site.ALERT_CLASS %}{% assign class = site.ALERT_CLASS%}{% endif %}{% if site.ALERT_CLASS_nl %}{% assign class = site.ALERT_CLASS_nl%}{% endif %} - {% if site.ALERT %}{% assign alert = site.ALERT%}{% endif %}{% if site.ALERT_nl %}{% assign alert = site.ALERT_nl%}{% endif %} +{% if site.ALERT.all or site.ALERT[page.lang] %} + {% if site.ALERT_CLASS.all %}{% assign class = site.ALERT_CLASS.all%}{% endif %}{% if site.ALERT_CLASS[page.lang] %}{% assign class = site.ALERT_CLASS[page.lang]%}{% endif %} + {% if site.ALERT.all %}{% assign alert = site.ALERT.all%}{% endif %}{% if site.ALERT[page.lang] %}{% assign alert = site.ALERT[page.lang]%}{% endif %}