From 055a20606a2e338d339fc58299f7b05cd3c66396 Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Mon, 6 Jan 2014 13:28:39 +0100 Subject: [PATCH 1/4] add tx-pull and tx-push FILE helper scripts tx-pull fetches translations from Transifex to .tx// and converts the JSON into an AMD module. Requires `transifex-client` from PyPi. tx-push FILE submits a AMD translation module to Transifex using `curl` and credentials from ~/.transifexrc. --- bin/tx-pull | 13 +++++++++++++ bin/tx-push | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100755 bin/tx-pull create mode 100755 bin/tx-push diff --git a/bin/tx-pull b/bin/tx-pull new file mode 100755 index 0000000..1f9d884 --- /dev/null +++ b/bin/tx-pull @@ -0,0 +1,13 @@ +#!/usr/bin/env fish + +set -g TRANSIFEX ".tx/js/" +set -g JS "isso/js/app/i18n/%s.js" + +# fetch latest translations to .tx// +tx pull -a + +for lang in (ls $TRANSIFEX) + printf "define(" > (printf $JS $lang) + cat .tx/js/$lang >> (printf $JS $lang) + printf ");\n" >> (printf $JS $lang) +end diff --git a/bin/tx-push b/bin/tx-push new file mode 100755 index 0000000..f98155c --- /dev/null +++ b/bin/tx-push @@ -0,0 +1,34 @@ +#!/usr/bin/env fish + +set TRANSIFEX "https://www.transifex.com/api/2" + +if [ (count $argv) -ne 1 ] + echo "tx-push FILE" + exit 2 +end + +if [ ! -f ~/.transifexrc ] + echo "no ~/.transifexrc found" + exit 1 +end + +set user (cat ~/.transifexrc | grep -E "^username" | awk -F " ?= ?" '{ print $2 }') +set pass (cat ~/.transifexrc | grep -E "^password" | awk -F " ?= ?" '{ print $2 }') + +set lang (echo $argv | cut -d / -f 5 | cut -d . -f 1) +set trans (mktemp -t tx) + +if [ $lang = "en" ] + set url "$TRANSIFEX/project/isso/resource/js/content/" +else + set url "$TRANSIFEX/project/isso/resource/js/translation/$lang/" +end + +printf '{"content":' > $trans +cat $argv \ + | sed "s,^define(,,g;\$ s,);,,g" \ + | python -c 'import json,sys; print json.dumps(sys.stdin.read())' \ + >> $trans +printf '}' >> $trans + +curl -L -u $user:$pass -XPUT $url -H "Content-Type: application/json" -d @$trans From 4d530fb2f1b10d41ae2c53f43d9bee6c1946752a Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Mon, 6 Jan 2014 13:31:13 +0100 Subject: [PATCH 2/4] add Transifex project configuration file --- .tx/config | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .tx/config diff --git a/.tx/config b/.tx/config new file mode 100644 index 0000000..147aa58 --- /dev/null +++ b/.tx/config @@ -0,0 +1,6 @@ +[main] +host = https://www.transifex.com +[isso.js] +file_filter = .tx/js/ +source_lang = en +type = KEYVALUEJSON From bfae158bde6b7a975d9dc93989f937bccd1025b1 Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Mon, 6 Jan 2014 13:33:28 +0100 Subject: [PATCH 3/4] update translations from Transifex (initial pull) --- isso/js/app/i18n/de.js | 11 ++++------- isso/js/app/i18n/en.js | 2 +- isso/js/app/i18n/fr.js | 3 --- isso/js/app/i18n/it.js | 3 --- isso/js/app/i18n/ru.js | 9 +++------ 5 files changed, 8 insertions(+), 20 deletions(-) diff --git a/isso/js/app/i18n/de.js b/isso/js/app/i18n/de.js index 1e180ba..dcdbac3 100644 --- a/isso/js/app/i18n/de.js +++ b/isso/js/app/i18n/de.js @@ -1,12 +1,10 @@ define({ - "postbox-text" : "Kommentar hier eintippen (mindestens 3 Zeichen)", - "postbox-author" : "Name (optional)", - "postbox-email" : "Email (optional)", + "postbox-text": "Kommentar hier eintippen (mindestens 3 Zeichen)", + "postbox-author": "Name (optional)", + "postbox-email": "Email (optional)", "postbox-submit": "Abschicken", - "num-comments": "1 Kommentar\n{{ n }} Kommentare", "no-comments": "Keine Kommentare bis jetzt", - "comment-reply": "Antworten", "comment-edit": "Bearbeiten", "comment-save": "Speichern", @@ -17,7 +15,6 @@ define({ "comment-deleted": "Kommentar gelöscht.", "comment-queued": "Kommentar muss noch freigeschaltet werden.", "comment-anonymous": "Anonym", - "date-now": "eben jetzt", "date-minute": "vor einer Minute\nvor {{ n }} Minuten", "date-hour": "vor einer Stunde\nvor {{ n }} Stunden", @@ -25,4 +22,4 @@ define({ "date-week": "letzte Woche\nvor {{ n }} Wochen", "date-month": "letzten Monat\nvor {{ n }} Monaten", "date-year": "letztes Jahr\nvor {{ n }} Jahren" -}); \ No newline at end of file +}); diff --git a/isso/js/app/i18n/en.js b/isso/js/app/i18n/en.js index 0381a63..40b5bc9 100644 --- a/isso/js/app/i18n/en.js +++ b/isso/js/app/i18n/en.js @@ -25,4 +25,4 @@ define({ "date-week": "last week\n{{ n }} weeks ago", "date-month": "last month\n{{ n }} months ago", "date-year": "last year\n{{ n }} years ago" -}); \ No newline at end of file +}); diff --git a/isso/js/app/i18n/fr.js b/isso/js/app/i18n/fr.js index fbc8762..5ba3b69 100644 --- a/isso/js/app/i18n/fr.js +++ b/isso/js/app/i18n/fr.js @@ -3,10 +3,8 @@ define({ "postbox-author": "Nom (optionel)", "postbox-email": "Courriel (optionel)", "postbox-submit": "Soumettre", - "num-comments": "Un commentaire\n{{ n }} commentaires", "no-comments": "Aucun commentaire pour l'instant", - "comment-reply": "Répondre", "comment-edit": "Éditer", "comment-save": "Enregistrer", @@ -17,7 +15,6 @@ define({ "comment-deleted": "Commentaire supprimé.", "comment-queued": "Commentaire en attente de modération.", "comment-anonymous": "Anonyme", - "date-now": "À l'instant'", "date-minute": "Il y a une minute \n{{ n }} minutes", "date-hour": "Il y a une heure\n{{ n }} heures ", diff --git a/isso/js/app/i18n/it.js b/isso/js/app/i18n/it.js index d53af6d..7a8bf51 100644 --- a/isso/js/app/i18n/it.js +++ b/isso/js/app/i18n/it.js @@ -3,10 +3,8 @@ define({ "postbox-author": "Nome (opzionale)", "postbox-email": "E-mail (opzionale)", "postbox-submit": "Invia", - "num-comments": "Un Commento\n{{ n }} Commenti", "no-comments": "Ancora Nessun Commento", - "comment-reply": "Rispondi", "comment-edit": "Modifica", "comment-save": "Salva", @@ -17,7 +15,6 @@ define({ "comment-deleted": "Commento eliminato.", "comment-queued": "Commento in coda per moderazione.", "comment-anonymous": "Anonimo", - "date-now": "poco fa", "date-minute": "un minuto fa\n{{ n }} minuti fa", "date-hour": "un ora fa\n{{ n }} ore fa", diff --git a/isso/js/app/i18n/ru.js b/isso/js/app/i18n/ru.js index 24c7b62..94fbc9a 100644 --- a/isso/js/app/i18n/ru.js +++ b/isso/js/app/i18n/ru.js @@ -1,12 +1,10 @@ define({ - "postbox-text" : "Комментировать здесь (миниум 3 символа)", - "postbox-author" : "Имя (необязательно)", - "postbox-email" : "Email (необязательно)", + "postbox-text": "Комментировать здесь (миниум 3 символа)", + "postbox-author": "Имя (необязательно)", + "postbox-email": "Email (необязательно)", "postbox-submit": "Отправить", - "num-comments": "1 Комментарий\n{{ n }} Комментарии", "no-comments": "Нет Комментарев", - "comment-reply": "Ответить", "comment-edit": "Правка", "comment-save": "Сохранить", @@ -17,7 +15,6 @@ define({ "comment-deleted": "Удалить комментарий", "comment-queued": "Комментарий должен быть разблокирован", "comment-anonymous": "Аномимый", - "date-now": "Сейчас", "date-minute": "Минут назад\n{{ n }} минут", "date-hour": "Час назад\n{{ n }} часов", From ebf6ca7a856a29258def0939691750df22864c36 Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Mon, 6 Jan 2014 18:38:16 +0100 Subject: [PATCH 4/4] add Transifex translation to contributing guide --- docs/contribute.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/contribute.rst b/docs/contribute.rst index 39f0201..b7c22c3 100644 --- a/docs/contribute.rst +++ b/docs/contribute.rst @@ -30,6 +30,20 @@ Report issues - **Isso-related issues** – Copy and paste traceback into a ticket and provide some details of your usage. +Translations +------------ + +Isso supports multiple languages and it is fairly easy to add new translations. +You can either use the `english translation file`__ or use Transifex_. Contact +me on IRC (@posativ) if you want to be the main contributor for a language. + +You may notice some "weird" newlines in translations -- that's the separator +for pluralforms_ in the templating engine. + +.. __: https://github.com/posativ/isso/blob/master/isso/js/app/i18n/en.js +.. _Transifex: https://www.transifex.com/projects/p/isso/ +.. _pluralforms: http://docs.translatehouse.org/projects/localization-guide/en/latest/l10n/pluralforms.html?id=l10n/pluralforms + Where I need help. ------------------