aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Blaszczyk2015-01-07 11:13:03 +0000
committerCraig Blaszczyk2015-01-07 11:13:03 +0000
commit7913947757b0e6bd1b8828db81933c32c498e20a (patch)
treefc537c04ff69612219fb284b510aac83dba9d441
parent6fb37207d18949031fb7203d6fd67ee503df0a34 (diff)
downloaddjango-rest-framework-7913947757b0e6bd1b8828db81933c32c498e20a.tar.bz2
add config and documentation about uploading/downloading translations from Transifex
-rw-r--r--.tx/config9
-rw-r--r--CONTRIBUTING.md54
-rw-r--r--docs/topics/internationalisation.md9
3 files changed, 69 insertions, 3 deletions
diff --git a/.tx/config b/.tx/config
new file mode 100644
index 00000000..271fa1e3
--- /dev/null
+++ b/.tx/config
@@ -0,0 +1,9 @@
+[main]
+host = https://www.transifex.com
+
+[django-rest-framework.djangopo]
+file_filter = rest_framework/locale/<lang>/LC_MESSAGES/django.po
+source_file = rest_framework/locale/en_US/LC_MESSAGES/django.po
+source_lang = en_US
+type = PO
+
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b963a499..d94eb87e 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -177,6 +177,57 @@ We recommend the [`django-reusable-app`][django-reusable-app] template as a good
Once your package is decently documented and available on PyPI open a pull request or issue, and we'll add a link to it from the main REST framework documentation.
+# Translations
+
+If REST framework isn't translated into your language you can request that it is at the [Transifex project][transifex].
+
+## Managing Transfiex
+The [official Transifex client][transifex-client] is used to upload and download translations to Transifex. The client is installed using pip:
+
+```
+pip install transifex-client
+```
+
+To use it you'll need a login to Transifex which has a password, and you'll need to have administrative access to the Transifex project. You'll need to create a `~/.transifexrc` file which contains your authentication information:
+
+```
+[https://www.transifex.com]
+username = user
+token =
+password = p@ssw0rd
+hostname = https://www.transifex.com
+```
+
+## Upload new source translations
+When any user-visible strings are changed, they should be uploaded to Transifex so that the translators can start to translate them. To do this, just run:
+
+```
+cd rest_framework
+django-admin.py makemessages -l en_US
+cd ..
+tx push -s
+```
+
+When pushing source files, Transifex will update the source strings of a resource to match those from the new source file.
+
+Here's how differences between the old and new source files will be handled:
+
+* New strings will be added.
+* Modified strings will be added as well.
+* Strings which do not exist in the new source file will be removed from the database, along with their translations. If that source strings gets re-added later then [Transifex Translation Memory][translation-memory] will automatically restore the translated string too.
+
+
+## Get translations
+When a translator has finished translating their work needs to be downloaded from Transifex into the source repo. To do this, run:
+
+```
+tx pull -a
+cd rest_framework
+django-admin.py compilemessages
+```
+
+You can then commit as normal.
+
[cite]: http://www.w3.org/People/Berners-Lee/FAQ.html
[code-of-conduct]: https://www.djangoproject.com/conduct/
[google-group]: https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework
@@ -190,3 +241,6 @@ Once your package is decently documented and available on PyPI open a pull reque
[docs]: https://github.com/tomchristie/django-rest-framework/tree/master/docs
[mou]: http://mouapp.com/
[django-reusable-app]: https://github.com/dabapps/django-reusable-app
+[transifex]: https://www.transifex.com/projects/p/django-rest-framework/
+[transifex-client]: https://pypi.python.org/pypi/transifex-client
+[translation-memory]: http://docs.transifex.com/guides/tm#let-tm-automatically-populate-translations \ No newline at end of file
diff --git a/docs/topics/internationalisation.md b/docs/topics/internationalisation.md
index fac3bdb7..2a476c86 100644
--- a/docs/topics/internationalisation.md
+++ b/docs/topics/internationalisation.md
@@ -3,11 +3,13 @@ REST framework ships with translatable error messages. You can make these appea
## How to translate REST Framework errors
+REST framework translations are managed online using [Transifex.com][transifex]. To get started, checkout the guide in the [CONTRIBUTING.md guide][contributing].
-This guide assumes you are already familiar with how to translate a Django app. If you're not, start by reading [Django's translation docs][django-translation].
+Sometimes you may want to use REST Framework in a language which has not been translated yet on Transifex. If that is the case then you should translate the error messages locally.
+#### How to translate REST Framework error messages locally:
-#### To translate REST framework error messages:
+This guide assumes you are already familiar with how to translate a Django app. If you're not, start by reading [Django's translation docs][django-translation].
1. Make a new folder where you want to store the translated errors. Add this
path to your [`LOCALE_PATHS`][django-locale-paths] setting.
@@ -89,4 +91,5 @@ display as Django does. You can find more info in the [Django docs on discoveri
[django-translation]: https://docs.djangoproject.com/en/1.7/topics/i18n/translation
[django-language-preference]: https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#how-django-discovers-language-preference
[django-locale-paths]: https://docs.djangoproject.com/en/1.7/ref/settings/#std:setting-LOCALE_PATHS
-[django-locale-name]: https://docs.djangoproject.com/en/1.7/topics/i18n/#term-locale-name \ No newline at end of file
+[django-locale-name]: https://docs.djangoproject.com/en/1.7/topics/i18n/#term-locale-name
+[contributing]: ../../CONTRIBUTING.md