From d1c90a6232c717e014143d3e79c6d1620d1f1d3e Mon Sep 17 00:00:00 2001 From: Saivann Date: Mon, 25 Mar 2013 00:01:18 -0400 Subject: [PATCH] improve translation system jekyll now automatically generates sitemap alternate hreflang is now correctly handled by sitemaps language bar now gracefully associate with the translated equivalent of the page update README with updated translation guidelines and instructions --- README.md | 28 ++++-- _config.yml | 58 ++++++++++- _contrib/translate | 11 +-- _contrib/updatesitemap | 26 ----- _layouts/base-en.html | 46 ++++----- _layouts/base-fr.html | 48 ++++----- _less/main.less | 10 +- en/about.html | 1 + en/bitcoin-for-developers.html | 1 + en/bitcoin-for-enthusiasts.html | 1 + en/bitcoin-for-individuals.html | 1 + en/bitcoin-for-organizations.html | 1 + en/choose-your-wallet.html | 1 + en/community.html | 1 + en/development.html | 1 + en/download.html | 1 + en/faq.html | 1 + en/foundation.html | 1 + en/how-it-works.html | 1 + en/index.html | 1 + en/resources.html | 1 + en/support-bitcoin.html | 1 + en/version-history.html | 1 + en/vocabulary.html | 1 + en/you-need-to-know.html | 1 + fr/a-propos.html | 1 + fr/bitcoin-pour-developpeurs.html | 1 + fr/bitcoin-pour-organisations.html | 1 + fr/bitcoin-pour-particuliers.html | 1 + fr/bitcoin-pour-passionnes.html | 1 + fr/choisir-votre-porte-monnaie.html | 1 + fr/comment-ca-marche.html | 1 + fr/communaute.html | 1 + fr/developpement.html | 1 + fr/fondation.html | 1 + fr/index.html | 1 + fr/ressources.html | 1 + fr/supporter-bitcoin.html | 1 + fr/telecharger.html | 1 + fr/vocabulaire.html | 1 + fr/vous-devez-savoir.html | 1 + index.html | 3 +- sitemap.xml | 145 ++-------------------------- 43 files changed, 173 insertions(+), 236 deletions(-) delete mode 100755 _contrib/updatesitemap diff --git a/README.md b/README.md index 34f69963..02a748d4 100644 --- a/README.md +++ b/README.md @@ -8,19 +8,33 @@ Installing dependencies # Usage * update DOWNLOAD\_VERSION in _config.yml -* run ./_contrib/updatesitemap if you changed a page * run jekyll * output will be in \_site/ -# Translation +## Translation + +### Guidelines + +* You must be a native speaker for the language you choose to translate. +* At least one other reviewer might be required and is highly recommanded. +* Try to avoid changing the meaning of any statements. If you need to change the meaning of anything, make a note of it and list that in the pull request. +* Sentences and popular expressions should be adapted so that they sound native in your language. + +### How to translate + +1. Begin, Run ./_contrib/translate (ISO 639-1 language code) (language name) to create your language. Ex : ./_contrib/translate fr "Français" +2. Texts, Open .html files in the appropriate folder and in _layouts and translate all human readable english dialogs (without touching the html tags and the page id). +3. Links, Update the name of each .html file so that it reflects your language and update the links in the .html files accordingly. +4. Sitemap, Add links to your translated pages in _config.yml under their equivalent english version. +5. Images, Update the few images that contain text with any vector image editing software like Inkscape. +6. Languages, Make sure that the languages are listed in alphabetical order in _config.yml -* Find the two letter ISO 639-1 code for your language (fr, en, jp) -* Run ./_contrib/translate (language code) (language name) -* Make sure that languages are listed in alphabetical order in _config.yml -* Rename html files in (lang)/ according to your language. And update links in _layouts/base-(lang).html and (lang)/*.html to reflect your changes. -* Translate all .html and images files in (lang)/ and _layouts/base-(lang).html * A tips for translators, you can preview your work in a simple Google chrome browser with no HTTP server. Just go to the existing english page, open the javascript console with CTRL + SHIFT + J and use the following command to make the page editable : document.body.contentEditable=true +### Update + +All changes made in the english version can be easily tracked on github. + ## Advanced Usage ### Alerts diff --git a/_config.yml b/_config.yml index 5754abd4..89904d0d 100644 --- a/_config.yml +++ b/_config.yml @@ -3,11 +3,61 @@ ALERT_CLASS: ALERT: langs: -- langcode: fr - langtext: Français -- langcode: en - langtext: English + fr: Français + en: English +section: + index: + en: + fr: + about: + en: about + fr: a-propos + bitcoin-for-developers: + en: bitcoin-for-developers + fr: bitcoin-pour-developpeurs + bitcoin-for-enthusiasts: + en: bitcoin-for-enthusiasts + fr: bitcoin-pour-passionnes + bitcoin-for-individuals: + en: bitcoin-for-individuals + fr: bitcoin-pour-particuliers + bitcoin-for-organizations: + en: bitcoin-for-organizations + fr: bitcoin-pour-organisations + choose-your-wallet: + en: choose-your-wallet + fr: choisir-votre-porte-monnaie + community: + en: community + fr: communaute + development: + en: development + fr: developpement + download: + en: download + fr: telecharger + foundation: + en: foundation + fr: fondation + how-it-works: + en: how-it-works + fr: comment-ca-marche + resources: + en: resources + fr: ressources + support-bitcoin: + en: support-bitcoin + fr: supporter-bitcoin + version-history: + en: version-history + vocabulary: + en: vocabulary + fr: vocabulaire + you-need-to-know: + en: you-need-to-know + fr: vous-devez-savoir + safe: false auto: false server: false diff --git a/_contrib/translate b/_contrib/translate index cff28262..e3b11347 100755 --- a/_contrib/translate +++ b/_contrib/translate @@ -12,12 +12,9 @@ sed -i "s_href=\"/en/_href=\"/${1}/_g" ${1}/*.html sed -i "s_src=\"/en/_src=\"/${1}/_g" ${1}/*.html sed -i "s_href=\"/en/_href=\"/${1}/_g" _layouts/base-${1}.html sed -i "s_src=\"/en/_src=\"/${1}/_g" _layouts/base-${1}.html -sed -i "s_langcode: en_langcode: ${1}_g" _layouts/base-${1}.html -sed -i "s_langtext: English_langtext: ${2}_g" _layouts/base-${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 "/langcode: ${1}/d" _config.yml -sed -i "/langtext: ${2}/d" _config.yml -sed -i "/langs:/a - langtext: ${2}" _config.yml -sed -i "/langs:/a - langcode: ${1}" _config.yml -sed -i "s_- langtext: ${2}_ langtext: ${2}_g" _config.yml +sed -i "/${1}: ${2}/d" _config.yml +sed -i "/langs:/a - ${1}: ${2}" _config.yml +sed -i "s_- ${1}: ${2}_ ${1}: ${2}_g" _config.yml diff --git a/_contrib/updatesitemap b/_contrib/updatesitemap deleted file mode 100755 index dacd0d49..00000000 --- a/_contrib/updatesitemap +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -#Should be called each time a page is updated, added or removed to update sitemaps -echo '' > sitemap.xml -echo '' >> sitemap.xml -for l in *; do - if [[ ! -d $l || $l == "_site" || $l == "_layouts" ]]; then - continue - fi - files=`find ${l} -name "*.html" -type f` - for f in $files; do - c=(${f//"."/ }) - c=${c[@]:0:1} - if [[ $c == "${l}/index" ]]; then - c=(${c//"/"/ }) - c="${c[@]:0:1}/" - fi - t=$(stat -c "%y" ${f}) - t=(${t//" "/ }) - t=${t[@]:0:1} - echo "" >> sitemap.xml - echo " http://bitcoin.org/${c}" >> sitemap.xml - echo " ${t}" >> sitemap.xml - echo "" >> sitemap.xml - done -done -echo '' >> sitemap.xml diff --git a/_layouts/base-en.html b/_layouts/base-en.html index 87ee088a..f6574824 100644 --- a/_layouts/base-en.html +++ b/_layouts/base-en.html @@ -1,42 +1,38 @@ --- -langcode: en -langtext: English +lang: en menufor: - text: Individuals - url: /en/bitcoin-for-individuals + url: bitcoin-for-individuals - text: Organizations - url: /en/bitcoin-for-organizations + url: bitcoin-for-organizations - text: Developers - url: /en/bitcoin-for-developers + url: bitcoin-for-developers - text: Enthusiasts - url: /en/bitcoin-for-enthusiasts + url: bitcoin-for-enthusiasts menu: - text: How it works - url: /en/how-it-works + url: how-it-works - text: Vocabulary - url: /en/vocabulary + url: vocabulary - text: Resources - url: /en/resources + url: resources - text: Community - url: /en/community + url: community - text: Development - url: /en/development + url: development - text: Foundation - url: /en/foundation + url: foundation - text: About - url: /en/about + url: about --- - + {{ page.title }} {% lesscss bootstrap.less %} -{% for lang in site.langs %}{% if lang.langcode != page.langcode %} - -{% endif %}{% endfor %} {% if site.ALERT or site.ALERT_en %} @@ -49,24 +45,24 @@ menu: diff --git a/_layouts/base-fr.html b/_layouts/base-fr.html index 454c0408..1d4634ed 100644 --- a/_layouts/base-fr.html +++ b/_layouts/base-fr.html @@ -1,44 +1,38 @@ --- -ALERT_CLASS: -ALERT: -langcode: fr -langtext: Français +lang: fr menufor: - text: Particuliers - url: /fr/bitcoin-pour-particuliers + url: bitcoin-pour-particuliers - text: Organisations - url: /fr/bitcoin-pour-organisations + url: bitcoin-pour-organisations - text: Développeurs - url: /fr/bitcoin-pour-developpeurs + url: bitcoin-pour-developpeurs - text: Passionnés - url: /fr/bitcoin-pour-passionnes + url: bitcoin-pour-passionnes menu: - text: Comment ça marche - url: /fr/comment-ca-marche + url: comment-ca-marche - text: Vocabulaire - url: /fr/vocabulaire + url: vocabulaire - text: Ressources - url: /fr/ressources + url: ressources - text: Communauté - url: /fr/communaute + url: communaute - text: Développement - url: /fr/developpement + url: developpement - text: Fondation - url: /fr/fondation + url: fondation - text: À propos - url: /fr/a-propos + url: a-propos --- - + {{ page.title }} {% lesscss bootstrap.less %} -{% for lang in site.langs %}{% if lang.langcode != page.langcode %} - -{% endif %}{% endfor %} {% if site.ALERT or site.ALERT_fr %} @@ -51,24 +45,24 @@ menu: diff --git a/_less/main.less b/_less/main.less index d9fe98d5..07ab5b96 100644 --- a/_less/main.less +++ b/_less/main.less @@ -77,7 +77,7 @@ cursor:pointer; #lang{ position:absolute; right:0px; -height:28px; +height:30px; border-left:1px solid transparent; border-right:1px solid transparent; border-top:1px solid transparent; @@ -85,10 +85,11 @@ border-top:1px solid transparent; #lang>li>ul{ display:none; right:-1px; -top:26px; +top:28px; position:absolute; background-color:#fff; margin-left:-5px; +padding-bottom:4px; border-radius-bottom-right:5px; -webkit-border-radius-bottom-right:5px; border-radius-bottom-left:5px; @@ -107,8 +108,11 @@ background-color:#fff; #lang>li:hover>ul{ display:block; } -#lang a,#lang a:link,#lang a:visited,#lang a:active{ +#lang>li>a,#lang>li>a:link,#lang>li>a:visited,#lang>li>a:active{ padding:4px 8px; +} +#lang a,#lang a:link,#lang a:visited,#lang a:active{ +padding:2px 8px; text-decoration:none; color:#000; font-size:18px; diff --git a/en/about.html b/en/about.html index eb767b12..b1611ffd 100644 --- a/en/about.html +++ b/en/about.html @@ -1,5 +1,6 @@ --- layout: base-en +id: about title: About - Bitcoin ---

About Bitcoin

diff --git a/en/bitcoin-for-developers.html b/en/bitcoin-for-developers.html index c828174f..1d88d13d 100644 --- a/en/bitcoin-for-developers.html +++ b/en/bitcoin-for-developers.html @@ -1,5 +1,6 @@ --- layout: base-en +id: bitcoin-for-developers title: Bitcoin for Developers - Bitcoin ---

Bitcoin for Developers

diff --git a/en/bitcoin-for-enthusiasts.html b/en/bitcoin-for-enthusiasts.html index c22d9813..93ab4df6 100644 --- a/en/bitcoin-for-enthusiasts.html +++ b/en/bitcoin-for-enthusiasts.html @@ -1,5 +1,6 @@ --- layout: base-en +id: bitcoin-for-enthusiasts title: Bitcoin for Enthusiasts ---

Bitcoin for Enthusiasts

diff --git a/en/bitcoin-for-individuals.html b/en/bitcoin-for-individuals.html index 45884671..c2a731c5 100644 --- a/en/bitcoin-for-individuals.html +++ b/en/bitcoin-for-individuals.html @@ -1,5 +1,6 @@ --- layout: base-en +id: bitcoin-for-individuals title: Bitcoin for Individuals - Bitcoin ---

Bitcoin for Individuals

diff --git a/en/bitcoin-for-organizations.html b/en/bitcoin-for-organizations.html index 7655b75c..a60bdac4 100644 --- a/en/bitcoin-for-organizations.html +++ b/en/bitcoin-for-organizations.html @@ -1,5 +1,6 @@ --- layout: base-en +id: bitcoin-for-organizations title: Bitcoin for Organizations - Bitcoin ---

Bitcoin for Organizations

diff --git a/en/choose-your-wallet.html b/en/choose-your-wallet.html index 34fb8e42..1e9abd3c 100644 --- a/en/choose-your-wallet.html +++ b/en/choose-your-wallet.html @@ -1,5 +1,6 @@ --- layout: base-en +id: choose-your-wallet title: Choose your wallet - Bitcoin --- diff --git a/en/community.html b/en/community.html index bcaf4df4..b40f9de6 100644 --- a/en/community.html +++ b/en/community.html @@ -1,5 +1,6 @@ --- layout: base-en +id: community title: Community - Bitcoin ---

Bitcoin communities

diff --git a/en/development.html b/en/development.html index 0187b376..08fbb10b 100644 --- a/en/development.html +++ b/en/development.html @@ -1,5 +1,6 @@ --- layout: base-en +id: development title: Development - Bitcoin ---

Bitcoin development

diff --git a/en/download.html b/en/download.html index 4b76fc10..ec756a2b 100644 --- a/en/download.html +++ b/en/download.html @@ -1,5 +1,6 @@ --- layout: base-en +id: download title: Download - Bitcoin ---

Download Bitcoin-Qt

diff --git a/en/faq.html b/en/faq.html index 2dda2d66..542b7a91 100644 --- a/en/faq.html +++ b/en/faq.html @@ -1,5 +1,6 @@ --- layout: base-en +id: faq title: Frequently Asked Questions ---

Frequently Asked Questions

diff --git a/en/foundation.html b/en/foundation.html index e58dce63..ee5a7a9d 100644 --- a/en/foundation.html +++ b/en/foundation.html @@ -1,5 +1,6 @@ --- layout: base-en +id: foundation title: Bitcoin Foundation --- diff --git a/en/how-it-works.html b/en/how-it-works.html index 67ca7f5d..e874ce02 100644 --- a/en/how-it-works.html +++ b/en/how-it-works.html @@ -1,5 +1,6 @@ --- layout: base-en +id: how-it-works title: How does Bitcoin work? - Bitcoin ---

How does Bitcoin work?

diff --git a/en/index.html b/en/index.html index 55a230ad..66cc9a2d 100644 --- a/en/index.html +++ b/en/index.html @@ -1,5 +1,6 @@ --- layout: base-en +id: index title: Bitcoin ---

An open source P2P digital currency

diff --git a/en/resources.html b/en/resources.html index 2384b663..1d252338 100644 --- a/en/resources.html +++ b/en/resources.html @@ -1,5 +1,6 @@ --- layout: base-en +id: resources title: Resources - Bitcoin ---

Bitcoin resources

diff --git a/en/support-bitcoin.html b/en/support-bitcoin.html index e43e3f01..f05615e0 100644 --- a/en/support-bitcoin.html +++ b/en/support-bitcoin.html @@ -1,5 +1,6 @@ --- layout: base-en +id: support-bitcoin title: Support Bitcoin - Bitcoin ---

Support Bitcoin

diff --git a/en/version-history.html b/en/version-history.html index e9e1c912..95038d29 100644 --- a/en/version-history.html +++ b/en/version-history.html @@ -1,4 +1,5 @@ --- layout: post +id: version-history title: Version history --- diff --git a/en/vocabulary.html b/en/vocabulary.html index 79ff87b2..42c79620 100644 --- a/en/vocabulary.html +++ b/en/vocabulary.html @@ -1,5 +1,6 @@ --- layout: base-en +id: vocabulary title: Vocabulary - Bitcoin ---

Some Bitcoin words you might hear

diff --git a/en/you-need-to-know.html b/en/you-need-to-know.html index 7a555825..5aca3788 100644 --- a/en/you-need-to-know.html +++ b/en/you-need-to-know.html @@ -1,5 +1,6 @@ --- layout: base-en +id: you-need-to-know title: Some things you need to know - Bitcoin ---

Some things you need to know

diff --git a/fr/a-propos.html b/fr/a-propos.html index 08576b9d..c8c87cf8 100644 --- a/fr/a-propos.html +++ b/fr/a-propos.html @@ -1,5 +1,6 @@ --- layout: base-fr +id: about title: À propos - Bitcoin ---

À propos du Bitcoin

diff --git a/fr/bitcoin-pour-developpeurs.html b/fr/bitcoin-pour-developpeurs.html index 4c4573b1..2f3ef8c6 100644 --- a/fr/bitcoin-pour-developpeurs.html +++ b/fr/bitcoin-pour-developpeurs.html @@ -1,5 +1,6 @@ --- layout: base-fr +id: bitcoin-for-developers title: Bitcoin pour les Développeurs - Bitcoin ---

Bitcoin pour les Développeurs

diff --git a/fr/bitcoin-pour-organisations.html b/fr/bitcoin-pour-organisations.html index e8834636..ab5be638 100644 --- a/fr/bitcoin-pour-organisations.html +++ b/fr/bitcoin-pour-organisations.html @@ -1,5 +1,6 @@ --- layout: base-fr +id: bitcoin-for-organizations title: Bitcoin pour les Entreprises - Bitcoin ---

Bitcoin pour les Organisations

diff --git a/fr/bitcoin-pour-particuliers.html b/fr/bitcoin-pour-particuliers.html index 63a3240f..82f47832 100644 --- a/fr/bitcoin-pour-particuliers.html +++ b/fr/bitcoin-pour-particuliers.html @@ -1,5 +1,6 @@ --- layout: base-fr +id: bitcoin-for-individuals title: Bitcoin pour les Particuliers - Bitcoin ---

Bitcoin pour les Particuliers

diff --git a/fr/bitcoin-pour-passionnes.html b/fr/bitcoin-pour-passionnes.html index 72a1a7bb..c2331e82 100644 --- a/fr/bitcoin-pour-passionnes.html +++ b/fr/bitcoin-pour-passionnes.html @@ -1,5 +1,6 @@ --- layout: base-fr +id: bitcoin-for-enthusiasts title: Bitcoin pour les Passionnés ---

Bitcoin pour les Passionnés

diff --git a/fr/choisir-votre-porte-monnaie.html b/fr/choisir-votre-porte-monnaie.html index f0d5daa2..2c1f3669 100644 --- a/fr/choisir-votre-porte-monnaie.html +++ b/fr/choisir-votre-porte-monnaie.html @@ -1,5 +1,6 @@ --- layout: base-fr +id: choose-your-wallet title: Choisir votre porte-monnaie - Bitcoin --- diff --git a/fr/comment-ca-marche.html b/fr/comment-ca-marche.html index 38dd4ab9..211a14a6 100644 --- a/fr/comment-ca-marche.html +++ b/fr/comment-ca-marche.html @@ -1,5 +1,6 @@ --- layout: base-fr +id: how-it-works title: Comment fonctionne Bitcoin? - Bitcoin ---

Comment fonctionne Bitcoin?

diff --git a/fr/communaute.html b/fr/communaute.html index d1af1d68..874acb1c 100644 --- a/fr/communaute.html +++ b/fr/communaute.html @@ -1,5 +1,6 @@ --- layout: base-fr +id: community title: Communauté - Bitcoin ---

Les communautés Bitcoin

diff --git a/fr/developpement.html b/fr/developpement.html index db45b087..2764eeac 100644 --- a/fr/developpement.html +++ b/fr/developpement.html @@ -1,5 +1,6 @@ --- layout: base-fr +id: development title: Développement - Bitcoin ---

Développement du Bitcoin

diff --git a/fr/fondation.html b/fr/fondation.html index b58ea3bf..b97a20eb 100644 --- a/fr/fondation.html +++ b/fr/fondation.html @@ -1,5 +1,6 @@ --- layout: base-fr +id: foundation title: Fondation Bitcoin --- diff --git a/fr/index.html b/fr/index.html index 7292ead5..24afca19 100644 --- a/fr/index.html +++ b/fr/index.html @@ -1,5 +1,6 @@ --- layout: base-fr +id: index title: Bitcoin ---

Une devise virtuelle P2P libre et ouverte

diff --git a/fr/ressources.html b/fr/ressources.html index 9cc2bbbe..4d2b0026 100644 --- a/fr/ressources.html +++ b/fr/ressources.html @@ -1,5 +1,6 @@ --- layout: base-fr +id: resources title: Ressources - Bitcoin ---

Ressources sur le Bitcoin

diff --git a/fr/supporter-bitcoin.html b/fr/supporter-bitcoin.html index 7d5cb4ed..a0a2cd85 100644 --- a/fr/supporter-bitcoin.html +++ b/fr/supporter-bitcoin.html @@ -1,5 +1,6 @@ --- layout: base-fr +id: support-bitcoin title: Supporter Bitcoin - Bitcoin ---

Supporter Bitcoin

diff --git a/fr/telecharger.html b/fr/telecharger.html index 6c5128b5..59677583 100644 --- a/fr/telecharger.html +++ b/fr/telecharger.html @@ -1,5 +1,6 @@ --- layout: base-fr +id: download title: Télécharger - Bitcoin ---

Télécharger Bitcoin-Qt

diff --git a/fr/vocabulaire.html b/fr/vocabulaire.html index 78afed90..c38ff6de 100644 --- a/fr/vocabulaire.html +++ b/fr/vocabulaire.html @@ -1,5 +1,6 @@ --- layout: base-fr +id: vocabulary title: Vocabulaire - Bitcoin ---

Quelques mots que vous pourriez entendre

diff --git a/fr/vous-devez-savoir.html b/fr/vous-devez-savoir.html index 916df238..a29bd05e 100644 --- a/fr/vous-devez-savoir.html +++ b/fr/vous-devez-savoir.html @@ -1,5 +1,6 @@ --- layout: base-fr +id: you-need-to-know title: Ce que vous devez savoir - Bitcoin ---

Ce que vous devez savoir

diff --git a/index.html b/index.html index 2bd7ab08..791bc51c 100644 --- a/index.html +++ b/index.html @@ -1,10 +1,11 @@ --- layout: base-en +id: index title: Bitcoin ---