Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganized locale directories and added Transifex for managing the translation process #866

Merged
merged 29 commits into from
Mar 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
90e40d0
consolidate and update all translatable strings into single locale di…
tobiasmcnulty Feb 17, 2019
1fc8905
add transifex config, client, and draft process docs
tobiasmcnulty Feb 18, 2019
ccad000
update transifex project name
tobiasmcnulty Feb 18, 2019
4a10268
remove location from po file + pull current French from transifex
tobiasmcnulty Feb 18, 2019
8375d4c
move dashboard and docs templates into their respective app folders
tobiasmcnulty Feb 19, 2019
4b99202
add source translation strings for dashboard + docs apps
tobiasmcnulty Feb 19, 2019
c04639f
add new dashboard and docs projects in Transifex config
tobiasmcnulty Feb 19, 2019
a1c078c
update slug for wwww.djangoproject.com project in transifex
tobiasmcnulty Feb 19, 2019
65de1b3
add/update location lines in source lang PO files; complete removal o…
tobiasmcnulty Feb 19, 2019
06ef957
ignore .mo files in any app
tobiasmcnulty Feb 19, 2019
a4b334b
we DO want location in translation source files
tobiasmcnulty Feb 19, 2019
d5b5536
add blurb on .po file organization
tobiasmcnulty Feb 19, 2019
c0136c6
add links to contributing docs for getting set up on Transifex
tobiasmcnulty Feb 19, 2019
9b18a6a
add direct link to Django transifex org
tobiasmcnulty Feb 19, 2019
e0b50ad
correct indentation
tobiasmcnulty Feb 19, 2019
1bceb2c
change emphasis
tobiasmcnulty Feb 19, 2019
c21fa3e
try again with emphasis
tobiasmcnulty Feb 19, 2019
6e8707b
update French translation from Transifex
tobiasmcnulty Feb 19, 2019
c4a9cbd
add script for updating translations from transifex
tobiasmcnulty Feb 19, 2019
2f6627e
clean french translation files
tobiasmcnulty Feb 19, 2019
1837b4e
don't try to run msgcat on absent .po files
tobiasmcnulty Feb 21, 2019
3eb8614
update French translation with latest from Transifex
tobiasmcnulty Feb 21, 2019
38a5c75
put dashboard app translations under main djangoproject.com project i…
tobiasmcnulty Feb 21, 2019
3722e61
clarify this repo contains only its own translated strings, not trans…
tobiasmcnulty Mar 1, 2019
ee7e7c0
unpin transifex-client
tobiasmcnulty Mar 6, 2019
e1b976d
shorten lines in translations section
tobiasmcnulty Mar 6, 2019
10cf67b
set --minimum-perc=70 and limit to French until more languages are sp…
tobiasmcnulty Mar 6, 2019
46cf20a
include instructions for adding new languages
tobiasmcnulty Mar 6, 2019
2a4b55c
update copyright
tobiasmcnulty Mar 6, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
__pycache__
*.pyc
*.db
docs/locale/*/LC_MESSAGES/django.mo
locale/*/LC_MESSAGES/django.mo
*/locale/*/LC_MESSAGES/django.mo
.sass-cache/
.coverage
.tox
Expand Down
23 changes: 23 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[main]
host = https://www.transifex.com
type = PO

# Get translations for the 'docs' app from the 'django-docs' project (resource: 'website-strings')
[django-docs.website-strings]
file_filter = docs/locale/<lang>/LC_MESSAGES/django.po
source_file = docs/locale/en/LC_MESSAGES/django.po
source_lang = en

# Get translations for the 'dashboard' app from the 'djangoproject.com' project (resource: 'dashboard-app')
# 'dashboard' is a reserved word in Transifex, so we use 'dashboard-app' instead.
[djangoproject-com.dashboard-app]
file_filter = dashboard/locale/<lang>/LC_MESSAGES/django.po
source_file = dashboard/locale/en/LC_MESSAGES/django.po
source_lang = en

# Send everything else to the 'main' resource in the 'djangoproject.com' project.
# If/when needed, other apps may be split out into separate resources (a la 'dashboard' above).
[djangoproject-com.main]
file_filter = locale/<lang>/LC_MESSAGES/django.po
source_file = locale/en/LC_MESSAGES/django.po
source_lang = en
84 changes: 84 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -287,3 +287,87 @@ from a copy of the production database and saved to the
To update this file, run::

./manage.py dumpdata dashboard --exclude dashboard.Datum --indent=4 > dashboard_production_metrics.json

Translation
-----------

We're using Transifex to help manage the translation process. The
``requirements/dev.txt`` file will install the Transifex client.

Before using the command-line Transifex client, create ``~/.transifexrc``
according to the instructions at
https://docs.transifex.com/client/client-configuration. You'll need to be a
member of the Django team in the `Django
<https://www.transifex.com/django/>`_ organization at Transifex. For
information on how to join, please see the `Translations
<https://docs.djangoproject.com/en/dev/internals/contributing/localizing/#translations>`_
section of the documentation on contributing to and localizing Django.

Since this repo hosts three separate sites, our ``.po`` files are organized by
website domain. At the moment, we have:

* ``dashboard/locale/`` contains the translation files for
https://dashboard.djangoproject.com
* ``docs/locale/`` contains the translation files for
https://docs.djangoproject.com (only for the strings in this repository;
translation of the documentation itself is handled elsewhere)
* ``locale/`` contains the translation files for https://www.djangoproject.com
(including strings from all apps other than ``dashboard`` and ``docs``)

**Important:** To keep this working properly, note that any templates for the
``dashboard`` and ``docs`` apps **must** be placed in the
``<app name>/templates/docs/`` directory for their respective app, **not** in
the ``djangoproject/templates/`` directory.

Updating messages on Transifex
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When there are changes to the messages in the code or templates, a member of
the translations team will need to update Transifex as follows:

1. Regenerate the English (only) .po file::

python manage.py makemessages -l en

(Never update alternate language .po files using makemessages. We'll update
the English file, upload it to Transifex, then later pull the .po files with
translations down from Transifex.)

2. Push the updated source file to Transifex::

tx push -s

3. Commit and push the changes to github::

git commit -m "Updated messages" locale/en/LC_MESSAGES/*
git push

Updating translations from Transifex
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Anytime translations on Transifex have been updated, someone should update
our translation files as follows:

1. Review the translations in Transifex and add to the space-delimited
``LANGUAGES`` list in ``update-translations.sh`` any new languages that have
reached 100% translation.

2. Pull the updated translation files::

./update-translations.sh

3. Use ``git diff`` to see if any translations have actually changed. If not,
you can just revert the .po file changes and stop here.

4. Compile the messages::

python manage.py compilemessages

5. Run the test suite one more time::

python manage.py test

6. Commit and push the changes to GitHub::

git commit -m "Updated translations" locale/*/LC_MESSAGES/*
git push
23 changes: 23 additions & 0 deletions dashboard/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (C) Django Software Foundation and contributors
# This file is distributed under the same license as the djangoproject.com
# source files.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-02-18 20:21-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: dashboard/templates/dashboard/index.html:22
#, python-format
msgid "Updated %(timestamp)s ago."
msgstr ""
25 changes: 25 additions & 0 deletions dashboard/locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (C) Django Software Foundation and contributors
# This file is distributed under the same license as the djangoproject.com
# source files.
#
# Translators:
# Tobias McNulty <tobias+dsf@caktusgroup.com>, 2019
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-02-18 20:21-0500\n"
"PO-Revision-Date: 2019-02-21 14:15+0000\n"
"Last-Translator: Tobias McNulty <tobias+dsf@caktusgroup.com>, 2019\n"
"Language-Team: French (https://www.transifex.com/django/teams/17080/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

#, python-format
msgid "Updated %(timestamp)s ago."
msgstr "Mis à jour il y a %(timestamp)s."
Loading