Mark all motion state names as translatable in JS. (Fixes #1864)

Updated README for how to update translations.
This commit is contained in:
Emanuel Schuetze 2016-01-22 20:46:20 +01:00
parent 48781b95ba
commit a8544f016d
4 changed files with 101 additions and 53 deletions

View File

@ -1,27 +1,35 @@
Instruction to update translation for OpenSlides:
-------------------------------------------------
Instruction to update translations for OpenSlides (JavaScipt and Django):
-------------------------------------------------------------------------
1. Go to the openslides directory (which contains the 'locale' directory):
1. Update English resource files:
a) for JavaScript run:
$ ./node_modules/.bin/gulp pot
-> updates 'openslides/locale/angular-gettext/template-en.pot'
b) for Django:
$ cd openslides
$ django-admin.py makemessages -l en
-> updates 'openslides/locale/en/LC_MESSAGES/django.po'
2. Update the German po file (locale/de/LC_MESSAGES/django.po):
$ django-admin.py makemessages -l de
$ django-admin.py makemessages -l de -d djangojs
2. Commit and merge the following files into OpenSlides master repo:
a) openslides/locale/angular-gettext/template-en.pot
b) openslides/locale/en/LC_MESSAGES/django.po
3. Edit the German po file: locale/de/LC_MESSAGES/django.po
Don't forget the js-file: locale/de/LC_MESSAGES/djangojs.po
(Search for "fuzzy" and empty msgstr entries.)
Transifex will update both resource files once a day by pulling from GitHub.
4. Update the German mo file (locale/de/LC_MESSAGES/django.mo):
3. Translate both files in transifex into desired languages.
https://www.transifex.com/openslides/
4. Download translated po files for each language and override it:
a) openslides/locale/angular-gettext/{LANG-CODE}.po
b) openslides/locale/{LANG-CODE}/LC_MESSAGES/django.po
5. Create mo file for each language (only for django po files required)
$ cd openslides
$ django-admin.py compilemessages
5. Restart server:
$ python manage.py runserver
--
Additional hints for internationalization (i18n) in Django:
https://docs.djangoproject.com/en/dev/topics/i18n/
Note: gettext is required to extract message IDs or compile message files.
For gettext on Windows read:
https://docs.djangoproject.com/en/dev/topics/i18n/translation/#gettext-on-windows
6. Commit and merge for each language the following files:
a) openslides/locale/angular-gettext/{LANG-CODE}.po
b) openslides/locale/{LANG-CODE}/LC_MESSAGES/django.po
openslides/locale/{LANG-CODE}/LC_MESSAGES/django.mo

View File

@ -1,6 +1,6 @@
from django.core.validators import MinValueValidator
from django.utils.translation import ugettext as _
from django.utils.translation import pgettext, ugettext_lazy, ugettext_noop
from django.utils.translation import pgettext, ugettext_lazy
from openslides.core.config import ConfigVariable
from openslides.poll.models import PERCENT_BASE_CHOICES
@ -181,79 +181,79 @@ def create_builtin_workflows(sender, **kwargs):
# If there is at least one workflow, then do nothing.
return
workflow_1 = Workflow.objects.create(name=ugettext_noop('Simple Workflow'))
state_1_1 = State.objects.create(name=ugettext_noop('submitted'),
workflow_1 = Workflow.objects.create(name='Simple Workflow')
state_1_1 = State.objects.create(name='submitted',
workflow=workflow_1,
allow_create_poll=True,
allow_support=True,
allow_submitter_edit=True)
state_1_2 = State.objects.create(name=ugettext_noop('accepted'),
state_1_2 = State.objects.create(name='accepted',
workflow=workflow_1,
action_word=ugettext_noop('Accept'),
action_word='Accept',
css_class='success')
state_1_3 = State.objects.create(name=ugettext_noop('rejected'),
state_1_3 = State.objects.create(name='rejected',
workflow=workflow_1,
action_word=ugettext_noop('Reject'),
action_word='Reject',
css_class='danger')
state_1_4 = State.objects.create(name=ugettext_noop('not decided'),
state_1_4 = State.objects.create(name='not decided',
workflow=workflow_1,
action_word=ugettext_noop('Do not decide'),
action_word='Do not decide',
css_class='default')
state_1_1.next_states.add(state_1_2, state_1_3, state_1_4)
workflow_1.first_state = state_1_1
workflow_1.save()
workflow_2 = Workflow.objects.create(name=ugettext_noop('Complex Workflow'))
state_2_1 = State.objects.create(name=ugettext_noop('published'),
workflow_2 = Workflow.objects.create(name='Complex Workflow')
state_2_1 = State.objects.create(name='published',
workflow=workflow_2,
allow_support=True,
allow_submitter_edit=True,
dont_set_identifier=True)
state_2_2 = State.objects.create(name=ugettext_noop('permitted'),
state_2_2 = State.objects.create(name='permitted',
workflow=workflow_2,
action_word=ugettext_noop('Permit'),
action_word='Permit',
allow_create_poll=True,
allow_submitter_edit=True,
versioning=True,
leave_old_version_active=True)
state_2_3 = State.objects.create(name=ugettext_noop('accepted'),
state_2_3 = State.objects.create(name='accepted',
workflow=workflow_2,
action_word=ugettext_noop('Accept'),
action_word='Accept',
versioning=True,
css_class='success')
state_2_4 = State.objects.create(name=ugettext_noop('rejected'),
state_2_4 = State.objects.create(name='rejected',
workflow=workflow_2,
action_word=ugettext_noop('Reject'),
action_word='Reject',
versioning=True,
css_class='danger')
state_2_5 = State.objects.create(name=ugettext_noop('withdrawed'),
state_2_5 = State.objects.create(name='withdrawed',
workflow=workflow_2,
action_word=ugettext_noop('Withdraw'),
action_word='Withdraw',
versioning=True,
css_class='default')
state_2_6 = State.objects.create(name=ugettext_noop('adjourned'),
state_2_6 = State.objects.create(name='adjourned',
workflow=workflow_2,
action_word=ugettext_noop('Adjourn'),
action_word='Adjourn',
versioning=True,
css_class='default')
state_2_7 = State.objects.create(name=ugettext_noop('not concerned'),
state_2_7 = State.objects.create(name='not concerned',
workflow=workflow_2,
action_word=ugettext_noop('Do not concern'),
action_word='Do not concern',
versioning=True,
css_class='default')
state_2_8 = State.objects.create(name=ugettext_noop('commited a bill'),
state_2_8 = State.objects.create(name='commited a bill',
workflow=workflow_2,
action_word=ugettext_noop('Commit a bill'),
action_word='Commit a bill',
versioning=True,
css_class='default')
state_2_9 = State.objects.create(name=ugettext_noop('needs review'),
state_2_9 = State.objects.create(name='needs review',
workflow=workflow_2,
action_word=ugettext_noop('Needs review'),
action_word='Needs review',
versioning=True,
css_class='default')
state_2_10 = State.objects.create(name=ugettext_noop('rejected (not authorized)'),
state_2_10 = State.objects.create(name='rejected (not authorized)',
workflow=workflow_2,
action_word=ugettext_noop('Reject (not authorized)'),
action_word='Reject (not authorized)',
versioning=True,
css_class='default')
state_2_1.next_states.add(state_2_2, state_2_5, state_2_10)

View File

@ -312,5 +312,45 @@ angular.module('OpenSlidesApp.motions', ['OpenSlidesApp.users'])
'Motion',
'Category',
function(Motion, Category) {}
])
// Mark all motion workflow state strings for translation in JavaScript.
// (see motions/signals.py)
.config([
'gettext',
function (gettext) {
// workflow 1
gettext('Simple Workflow')
gettext('submitted')
gettext('accepted')
gettext('Accept')
gettext('rejected')
gettext('Reject')
gettext('not decided')
gettext('Do not decide')
// workflow 2
gettext('Complex Workflow')
gettext('published')
gettext('permitted')
gettext('Permit')
gettext('accepted')
gettext('Accept')
gettext('rejected')
gettext('Reject')
gettext('withdrawed')
gettext('Withdraw')
gettext('adjourned')
gettext('Adjourn')
gettext('not concerned')
gettext('Do not concern')
gettext('commited a bill')
gettext('Commit a bill')
gettext('needs review')
gettext('Needs review')
gettext('rejected (not authorized)')
gettext('Reject (not authorized)')
}
]);
}());

View File

@ -3,7 +3,7 @@
<div id="sidebox">
<!-- State -->
<h3 translate>State</h3>
{{ motion.state.name }}
{{ motion.state.name | translate }}
<!-- Submitters -->
<h3 ng-if="motion.submitters.length > 0" translate>Submitters</h3>