Skip to main content

django-C3PO is a Django application using C3PO - module responsible for converting .po files from locale folder with translations to .ods format and sending them to Google Spreadsheets. This Django application provides panel where user can synchronize translations with GDocs and it gives possibility to push all translations on git and checkout last commit. django-C3PO uses celery since version 0.2. Be sure to properly configure it before using application.

Project description

django-C3PO
=============
django-C3PO is a Django application using C3PO - module responsible for converting .po files from locale folder
with translations to .ods format and sending them to Google Spreadsheets.

This Django application provides panel where user can synchronize translations with GDocs and it gives
possibility to push all translations on git and checkout last commit.

After synchronization django-C3PO sends post_compilemessages signal which notifies that translations are ready.
Server restart is needed then to reload compiled .mo files into application.

Application uses celery to prevent timeout when synchronizing translations.
Be sure to properly configure it before use.

django-C3PO includes custom compilemessages command called verbosecompilemessages.
It is needed to write msgfmt errors on the stderr, because standard compile messages
does not show them.

Quick start
-----------

1. Add "django-C3PO" to your INSTALLED_APPS setting like this:

```python
INSTALLED_APPS = (
...
'django_c3po',
)
```

2. Add C3PO variable to your settings and define them. For example:

```python
C3PO = {
'LANGUAGES': ['en', 'pl', 'jp'],
'EMAIL': 'ttestt123321@gmail.com',
'PASSWORD': 'zxcasdqwe.',
'URL': 'https://docs.google.com/spreadsheet/ccc?key=0AnVOHClWGpLZdGRuQVlrWG5Ia3QtOHJEWWpmZVYyYnc#gid=0',
'HEADER': '# translated with po_translator\n',
'LOCALE_ROOT': os.path.join('conf', 'locale'),
'PO_FILES_PATH': 'LC_MESSAGES',
'TEMP_PATH': 'temp',
'GIT_REPOSITORY': 'git@git.hiddendata.co:mnogacki/testpo.git',
'GIT_BRANCH': 'master',
'SOURCE': 'PO Translator',
}
```

3. Include the po_translator URLconf in your project urls.py like this::

```python
url(r'^c3po/', include('django_c3po.urls')),
```

4. Add post_compilemessages signal receiver for server restart:
```python
@receiver(post_compilemessages)
def restart_server_callback(sender, *args, **kwargs):
manage_path = os.path.join(settings.ROOT_DIR, '..', 'manage.py')
os.system('touch ' + manage_path)
```

5. Configure celery in your settings:
```python
BROKER_URL = 'django://'
CELERY_IMPORTS = ('test_app.models',)

import djcelery
djcelery.setup_loader()
```
Be sure to include module with your signal receiver in CELERY_IMPORTS.

6. Start the development server, visit http://127.0.0.1:8000/admin/
and add permission 'django-C3PO.can_translate' to user.

7. Visit http://127.0.0.1:8000/c3po/ and log in as user with can_translate permission.

8. Use buttons to synchronize, make messages and git operations.
-
Usage
-----
After configuration and logging into the translator's panel, you will see basic configuration info with
link to the spreadsheet defined in settings. User can manage app translations with three actions:

- Synchronize - Synchronized translations from local files with GDoc state. If project has new expressions
which are not in the spreadsheet, GDoc is updated with this entries. Remember that after this action server
should be restarted.
- Make messages - Runs makemessages command updating po files with new expressions to translate.
- Publish - Pushes current po files to git repository.
- Reset - Reverts current changes and checkouts project to last commit. Note that changes are also reverted
in spreadsheet, so all new translations will be lost.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-C3PO-0.3.0.tar.gz (185.1 kB view details)

Uploaded Source

File details

Details for the file django-C3PO-0.3.0.tar.gz.

File metadata

  • Download URL: django-C3PO-0.3.0.tar.gz
  • Upload date:
  • Size: 185.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-C3PO-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d31ebdf70bf2886049abf8ee5b6417a84a8e5ba5b7bcf144237a8058c73188c7
MD5 25c3140911edbacbbff6eb1304d686b9
BLAKE2b-256 77fb63c3fa06bb14d60c027176834921754efa74703727ac50f2d05d08aff045

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page