From a5a00a7eda0d289f290e72d44111141ef5e3492e Mon Sep 17 00:00:00 2001 From: Maximilian Krambach Date: Thu, 9 Jun 2016 16:12:13 +0200 Subject: [PATCH] Config translations moved to client side (Issue #2093) --- openslides/agenda/config_variables.py | 52 ++++---- openslides/agenda/static/js/agenda/site.js | 25 +++- openslides/assignments/config_variables.py | 62 +++++----- .../assignments/static/js/assignments/site.js | 24 ++++ openslides/core/config_variables.py | 106 ++++++++-------- openslides/core/static/js/core/site.js | 34 ++++++ openslides/motions/config_variables.py | 114 +++++++++--------- openslides/motions/static/js/motions/site.js | 30 +++++ openslides/users/config_variables.py | 65 +++++----- openslides/users/static/js/users/site.js | 23 ++++ 10 files changed, 328 insertions(+), 207 deletions(-) diff --git a/openslides/agenda/config_variables.py b/openslides/agenda/config_variables.py index 5b5ba9994..9525b4c16 100644 --- a/openslides/agenda/config_variables.py +++ b/openslides/agenda/config_variables.py @@ -2,8 +2,6 @@ from datetime import datetime from django.core.exceptions import ValidationError as DjangoValidationError from django.core.validators import MaxLengthValidator, MinValueValidator -from django.utils.translation import ugettext as _ -from django.utils.translation import ugettext_lazy from openslides.core.config import ConfigVariable @@ -12,7 +10,7 @@ def validate_start_time(value): try: datetime.strptime(value, '%d.%m.%Y %H:%M') except ValueError: - raise DjangoValidationError(_('Invalid input.')) + raise DjangoValidationError('Invalid input.') def get_config_variables(): @@ -24,34 +22,34 @@ def get_config_variables(): yield ConfigVariable( name='agenda_number_prefix', default_value='', - label=ugettext_lazy('Numbering prefix for agenda items'), - help_text=ugettext_lazy('This prefix will be set if you run the automatic agenda numbering.'), + label='Numbering prefix for agenda items', + help_text='This prefix will be set if you run the automatic agenda numbering.', weight=210, - group=ugettext_lazy('Agenda'), - subgroup=ugettext_lazy('General'), + group='Agenda', + subgroup='General', validators=(MaxLengthValidator(20),)) yield ConfigVariable( name='agenda_numeral_system', default_value='arabic', input_type='choice', - label=ugettext_lazy('Numeral system for agenda items'), + label='Numeral system for agenda items', choices=( - {'value': 'arabic', 'display_name': ugettext_lazy('Arabic')}, - {'value': 'roman', 'display_name': ugettext_lazy('Roman')}), + {'value': 'arabic', 'display_name': 'Arabic'}, + {'value': 'roman', 'display_name': 'Roman'}), weight=215, - group=ugettext_lazy('Agenda'), - subgroup=ugettext_lazy('General')) + group='Agenda', + subgroup='General') # TODO: Use an input type with generic datetime support. yield ConfigVariable( name='agenda_start_event_date_time', default_value='', - label=ugettext_lazy('Begin of event'), - help_text=ugettext_lazy('Input format: DD.MM.YYYY HH:MM'), + label='Begin of event', + help_text='Input format: DD.MM.YYYY HH:MM', weight=220, - group=ugettext_lazy('Agenda'), - subgroup=ugettext_lazy('General'), + group='Agenda', + subgroup='General', validators=(validate_start_time,)) # List of speakers @@ -60,29 +58,29 @@ def get_config_variables(): name='agenda_show_last_speakers', default_value=1, input_type='integer', - label=ugettext_lazy('Number of last speakers to be shown on the projector'), + label='Number of last speakers to be shown on the projector', weight=230, - group=ugettext_lazy('Agenda'), - subgroup=ugettext_lazy('List of speakers'), + group='Agenda', + subgroup='List of speakers', validators=(MinValueValidator(0),)) yield ConfigVariable( name='agenda_countdown_warning_time', default_value=0, input_type='integer', - label=ugettext_lazy('Show orange countdown in the last x seconds of speaking time'), - help_text=ugettext_lazy('Enter duration in seconds. Choose 0 to disable warning color.'), + label='Show orange countdown in the last x seconds of speaking time', + help_text='Enter duration in seconds. Choose 0 to disable warning color.', weight=235, - group=ugettext_lazy('Agenda'), - subgroup=ugettext_lazy('List of speakers'), + group='Agenda', + subgroup='List of speakers', validators=(MinValueValidator(0),)) yield ConfigVariable( name='agenda_couple_countdown_and_speakers', default_value=False, input_type='boolean', - label=ugettext_lazy('Couple countdown with the list of speakers'), - help_text=ugettext_lazy('[Begin speech] starts the countdown, [End speech] stops the countdown.'), + label='Couple countdown with the list of speakers', + help_text='[Begin speech] starts the countdown, [End speech] stops the countdown.', weight=240, - group=ugettext_lazy('Agenda'), - subgroup=ugettext_lazy('List of speakers')) + group='Agenda', + subgroup='List of speakers') diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index 4f31cff1e..c10c998d1 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -524,6 +524,29 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) element.target = '_blank'; }; } -]); +]) + +//mark all agenda config strings for translation with Javascript +.config([ + 'gettext', + function (gettext) { + gettext('Numbering prefix for agenda items'); + gettext('This prefix will be set if you run the automatic agenda numbering.'); + gettext('Agenda'); + gettext('Invalid input.'); + gettext('Numeral system for agenda items'); + gettext('Arabic'); + gettext('Roman'); + gettext('Begin of event'); + gettext('Input format: DD.MM.YYYY HH:MM'); + gettext('Number of last speakers to be shown on the projector'); + gettext('List of speakers'); + gettext('Show orange countdown in the last x seconds of speaking time'); + gettext('Enter duration in seconds. Choose 0 to disable warning color.'); + gettext('Couple countdown with the list of speakers'); + gettext('[Begin speech] starts the countdown, [End speech] stops the' + + ' countdown.'); + } + ]); }()); diff --git a/openslides/assignments/config_variables.py b/openslides/assignments/config_variables.py index 4912424d3..ab38087f5 100644 --- a/openslides/assignments/config_variables.py +++ b/openslides/assignments/config_variables.py @@ -1,6 +1,4 @@ from django.core.validators import MinValueValidator -from django.utils.translation import ugettext as _ -from django.utils.translation import ugettext_lazy from openslides.core.config import ConfigVariable from openslides.poll.models import PERCENT_BASE_CHOICES @@ -18,74 +16,74 @@ def get_config_variables(): name='assignments_poll_vote_values', default_value='auto', input_type='choice', - label=ugettext_lazy('Election method'), + label='Election method', choices=( - {'value': 'auto', 'display_name': ugettext_lazy('Automatic assign of method')}, - {'value': 'votes', 'display_name': ugettext_lazy('Always one option per candidate')}, - {'value': 'yesnoabstain', 'display_name': ugettext_lazy('Always Yes-No-Abstain per candidate')}, - {'value': 'yesno', 'display_name': ugettext_lazy('Always Yes/No per candidate')}), + {'value': 'auto', 'display_name': 'Automatic assign of method'}, + {'value': 'votes', 'display_name': 'Always one option per candidate'}, + {'value': 'yesnoabstain', 'display_name': 'Always Yes-No-Abstain per candidate'}, + {'value': 'yesno', 'display_name': 'Always Yes/No per candidate'}), weight=410, - group=ugettext_lazy('Elections'), - subgroup=ugettext_lazy('Ballot and ballot papers')) + group='Elections', + subgroup='Ballot and ballot papers') yield ConfigVariable( name='assignments_poll_100_percent_base', default_value='WITHOUT_INVALID', input_type='choice', - label=ugettext_lazy('The 100 % base of an election result consists of'), + label='The 100 % base of an election result consists of', choices=PERCENT_BASE_CHOICES, weight=420, - group=ugettext_lazy('Elections'), - subgroup=ugettext_lazy('Ballot and ballot papers')) + group='Elections', + subgroup='Ballot and ballot papers') yield ConfigVariable( name='assignments_pdf_ballot_papers_selection', default_value='CUSTOM_NUMBER', input_type='choice', - label=ugettext_lazy('Number of ballot papers (selection)'), + label='Number of ballot papers (selection)', choices=( - {'value': 'NUMBER_OF_DELEGATES', 'display_name': ugettext_lazy('Number of all delegates')}, - {'value': 'NUMBER_OF_ALL_PARTICIPANTS', 'display_name': ugettext_lazy('Number of all participants')}, - {'value': 'CUSTOM_NUMBER', 'display_name': ugettext_lazy('Use the following custom number')}), + {'value': 'NUMBER_OF_DELEGATES', 'display_name': 'Number of all delegates'}, + {'value': 'NUMBER_OF_ALL_PARTICIPANTS', 'display_name': 'Number of all participants'}, + {'value': 'CUSTOM_NUMBER', 'display_name': 'Use the following custom number'}), weight=430, - group=ugettext_lazy('Elections'), - subgroup=ugettext_lazy('Ballot and ballot papers')) + group='Elections', + subgroup='Ballot and ballot papers') yield ConfigVariable( name='assignments_pdf_ballot_papers_number', default_value=8, input_type='integer', - label=ugettext_lazy('Custom number of ballot papers'), + label='Custom number of ballot papers', weight=440, - group=ugettext_lazy('Elections'), - subgroup=ugettext_lazy('Ballot and ballot papers'), + group='Elections', + subgroup='Ballot and ballot papers', validators=(MinValueValidator(1),)) yield ConfigVariable( name='assignments_publish_winner_results_only', default_value=False, input_type='boolean', - label=ugettext_lazy('Publish election result for elected candidates only ' - '(projector view)'), + label='Publish election result for elected candidates only ' + '(projector view)', weight=450, - group=ugettext_lazy('Elections'), - subgroup=ugettext_lazy('Ballot and ballot papers')) + group='Elections', + subgroup='Ballot and ballot papers') # PDF yield ConfigVariable( name='assignments_pdf_title', - default_value=_('Elections'), - label=ugettext_lazy('Title for PDF document (all elections)'), + default_value='Elections', + label='Title for PDF document (all elections)', weight=460, - group=ugettext_lazy('Elections'), - subgroup=ugettext_lazy('PDF'), + group='Elections', + subgroup='PDF', translatable=True) yield ConfigVariable( name='assignments_pdf_preamble', default_value='', - label=ugettext_lazy('Preamble text for PDF document (all elections)'), + label='Preamble text for PDF document (all elections)', weight=470, - group=ugettext_lazy('Elections'), - subgroup=ugettext_lazy('PDF')) + group='Elections', + subgroup='PDF') diff --git a/openslides/assignments/static/js/assignments/site.js b/openslides/assignments/static/js/assignments/site.js index f6972488c..badc5949f 100644 --- a/openslides/assignments/static/js/assignments/site.js +++ b/openslides/assignments/static/js/assignments/site.js @@ -691,6 +691,30 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments']) }); }; } +]) + +//mark all assignment config strings for translation with Javascript +.config([ + 'gettext', + function (gettext) { + gettext('Election method'); + gettext('Automatic assign of method'); + gettext('Always one option per candidate'); + gettext('Always Yes-No-Abstain per candidate'); + gettext('Always Yes/No per candidate'); + gettext('Elections'); + gettext('Ballot and ballot papers'); + gettext('The 100 % base of an election result consists of'); + gettext('Number of ballot papers (selection)'); + gettext('Number of all delegates'); + gettext('Number of all participants'); + gettext('Use the following custom number'); + gettext('Custom number of ballot papers'); + gettext('Publish election result for elected candidates only (' + + 'projector view)'); + gettext('Title for PDF document (all elections)'); + gettext('Preamble text for PDF document (all elections)'); + } ]); }()); diff --git a/openslides/core/config_variables.py b/openslides/core/config_variables.py index affaeee7b..019a682a2 100644 --- a/openslides/core/config_variables.py +++ b/openslides/core/config_variables.py @@ -1,7 +1,4 @@ from django.core.validators import MaxLengthValidator -from django.utils.translation import ugettext as _ -from django.utils.translation import ugettext_lazy - from openslides.core.config import ConfigVariable @@ -16,76 +13,76 @@ def get_config_variables(): yield ConfigVariable( name='general_event_name', default_value='OpenSlides', - label=ugettext_lazy('Event name'), + label='Event name', weight=110, - group=ugettext_lazy('General'), - subgroup=ugettext_lazy('Event'), + group='General', + subgroup='Event', validators=(MaxLengthValidator(50),)) yield ConfigVariable( name='general_event_description', - default_value=_('Presentation and assembly system'), - label=ugettext_lazy('Short description of event'), + default_value='Presentation and assembly system', + label='Short description of event', weight=115, - group=ugettext_lazy('General'), - subgroup=ugettext_lazy('Event'), + group='General', + subgroup='Event', validators=(MaxLengthValidator(100),), translatable=True) yield ConfigVariable( name='general_event_date', default_value='', - label=ugettext_lazy('Event date'), + label='Event date', weight=120, - group=ugettext_lazy('General'), - subgroup=ugettext_lazy('Event')) + group='General', + subgroup='Event') yield ConfigVariable( name='general_event_location', default_value='', - label=ugettext_lazy('Event location'), + label='Event location', weight=125, - group=ugettext_lazy('General'), - subgroup=ugettext_lazy('Event')) + group='General', + subgroup='Event') yield ConfigVariable( name='general_event_organizer', default_value='', - label=ugettext_lazy('Event organizer'), + label='Event organizer', weight=130, - group=ugettext_lazy('General'), - subgroup=ugettext_lazy('Event')) + group='General', + subgroup='Event') yield ConfigVariable( name='general_event_legal_notice', - default_value=_( - 'OpenSlides is a free web based ' - 'presentation and assembly system for visualizing and controlling agenda, ' - 'motions and elections of an assembly.'), + default_value='OpenSlides is a ' + 'free web based presentation and assembly system for ' + 'visualizing and controlling agenda, motions and ' + 'elections of an assembly.', input_type='text', - label=ugettext_lazy('Legal notice'), + label='Legal notice', weight=132, - group=ugettext_lazy('General'), - subgroup=ugettext_lazy('Event'), + group='General', + subgroup='Event', translatable=True) yield ConfigVariable( name='general_event_welcome_title', - default_value=_('Welcome to OpenSlides'), - label=ugettext_lazy('Front page title'), + default_value='Welcome to OpenSlides', + label='Front page title', weight=134, - group=ugettext_lazy('General'), - subgroup=ugettext_lazy('Event'), + group='General', + subgroup='Event', translatable=True) yield ConfigVariable( name='general_event_welcome_text', - default_value=_('[Space for your welcome text.]'), + default_value='[Space for your welcome text.]', input_type='text', - label=ugettext_lazy('Front page text'), + label='Front page text', weight=136, - group=ugettext_lazy('General'), - subgroup=ugettext_lazy('Event'), + group='General', + subgroup='Event', translatable=True) # General System @@ -94,18 +91,18 @@ def get_config_variables(): name='general_system_enable_anonymous', default_value=False, input_type='boolean', - label=ugettext_lazy('Allow access for anonymous guest users'), + label='Allow access for anonymous guest users', weight=138, - group=ugettext_lazy('General'), - subgroup=ugettext_lazy('System')) + group='General', + subgroup='System') yield ConfigVariable( name='general_login_info_text', default_value='', - label=ugettext_lazy('Show this text on the login page.'), + label='Show this text on the login page.', weight=140, - group=ugettext_lazy('General'), - subgroup=ugettext_lazy('System')) + group='General', + subgroup='System') # Projector @@ -113,48 +110,47 @@ def get_config_variables(): name='projector_enable_logo', default_value=True, input_type='boolean', - label=ugettext_lazy('Show logo on projector'), - help_text=ugettext_lazy( - 'You can replace the logo. Just copy a file to ' - '"static/img/logo-projector.png" in your OpenSlides data path.'), + label='Show logo on projector', + help_text='You can replace the logo. Just copy a file to ' + '"static/img/logo-projector.png" in your OpenSlides data path.', weight=150, - group=ugettext_lazy('Projector')) + group='Projector') yield ConfigVariable( name='projector_enable_title', default_value=True, input_type='boolean', - label=ugettext_lazy('Show title and description of event on projector'), + label='Show title and description of event on projector', weight=155, - group=ugettext_lazy('Projector')) + group='Projector') yield ConfigVariable( name='projector_header_backgroundcolor', default_value='#317796', input_type='colorpicker', - label=ugettext_lazy('Background color of projector header and footer'), + label='Background color of projector header and footer', weight=160, - group=ugettext_lazy('Projector')) + group='Projector') yield ConfigVariable( name='projector_header_fontcolor', default_value='#F5F5F5', input_type='colorpicker', - label=ugettext_lazy('Font color of projector header and footer'), + label='Font color of projector header and footer', weight=165, - group=ugettext_lazy('Projector')) + group='Projector') yield ConfigVariable( name='projector_h1_fontcolor', default_value='#317796', input_type='colorpicker', - label=ugettext_lazy('Font color of projector headline'), + label='Font color of projector headline', weight=170, - group=ugettext_lazy('Projector')) + group='Projector') yield ConfigVariable( name='projector_default_countdown', default_value=60, - label=ugettext_lazy('Default countdown'), + label='Default countdown', weight=185, - group=ugettext_lazy('Projector')) + group='Projector') diff --git a/openslides/core/static/js/core/site.js b/openslides/core/static/js/core/site.js index 62ee12aa4..da205b5db 100644 --- a/openslides/core/static/js/core/site.js +++ b/openslides/core/static/js/core/site.js @@ -1111,6 +1111,40 @@ angular.module('OpenSlidesApp.core.site', [ } }; } +]) + +//Mark all core config strings for translation in Javascript +.config([ + 'gettext', + function (gettext) { + gettext('Presentation and assembly system'); + gettext('Event name'); + gettext('OpenSlides is a free' + + ' web based presentation and assembly system for visualizing' + + ' and controlling agenda, motions and elections of an' + + ' assembly.'); + gettext('General'); + gettext('Event'); + gettext('Short description of Event'); + gettext('Event date'); + gettext('Event location'); + gettext('Event organizer'); + gettext('Legal notice'); + gettext('Front page title'); + gettext('Front page text'); + gettext('Allow access for anonymous guest users'); + gettext('Show this text on the login page.'); + gettext('Show logo on projector'); + gettext('You can replace the logo. Just copy a file to '); + gettext('"static/img/logo-projector.png" in your OpenSlides data' + + ' path.'); + gettext('Projector'); + gettext('Show title and description of event on projector'); + gettext('Backgroundcolor of projector header and footer'); + gettext('Font color of projector header and footer'); + gettext('Font color of projector headline'); + gettext('Default countdown'); + } ]); }()); diff --git a/openslides/motions/config_variables.py b/openslides/motions/config_variables.py index 74cf3dc8c..7071e73ce 100644 --- a/openslides/motions/config_variables.py +++ b/openslides/motions/config_variables.py @@ -1,6 +1,4 @@ from django.core.validators import MinValueValidator -from django.utils.translation import ugettext as _ -from django.utils.translation import pgettext, ugettext_lazy from openslides.core.config import ConfigVariable from openslides.poll.models import PERCENT_BASE_CHOICES @@ -13,7 +11,7 @@ def get_workflow_choices(): Returns a list of all workflows to be used as choices for the config variable 'motions_workflow'. Each list item contains the pk and the display name. """ - return [{'value': str(workflow.pk), 'display_name': ugettext_lazy(workflow.name)} + return [{'value': str(workflow.pk), 'display_name': workflow.name} for workflow in Workflow.objects.all()] @@ -30,51 +28,51 @@ def get_config_variables(): name='motions_workflow', default_value='1', input_type='choice', - label=ugettext_lazy('Workflow of new motions'), + label='Workflow of new motions', choices=get_workflow_choices, weight=310, - group=ugettext_lazy('Motions'), - subgroup=ugettext_lazy('General')) + group='Motions', + subgroup='General') yield ConfigVariable( name='motions_identifier', default_value='per_category', input_type='choice', - label=ugettext_lazy('Identifier'), + label='Identifier', choices=( - {'value': 'per_category', 'display_name': ugettext_lazy('Numbered per category')}, - {'value': 'serially_numbered', 'display_name': ugettext_lazy('Serially numbered')}, - {'value': 'manually', 'display_name': ugettext_lazy('Set it manually')}), + {'value': 'per_category', 'display_name': 'Numbered per category'}, + {'value': 'serially_numbered', 'display_name': 'Serially numbered'}, + {'value': 'manually', 'display_name': 'Set it manually'}), weight=315, - group=ugettext_lazy('Motions'), - subgroup=ugettext_lazy('General')) + group='Motions', + subgroup='General') yield ConfigVariable( name='motions_preamble', - default_value=_('The assembly may decide,'), - label=ugettext_lazy('Motion preamble'), + default_value='The assembly may decide,', + label='Motion preamble', weight=320, - group=ugettext_lazy('Motions'), - subgroup=ugettext_lazy('General'), + group='Motions', + subgroup='General', translatable=True) yield ConfigVariable( name='motions_stop_submitting', default_value=False, input_type='boolean', - label=ugettext_lazy('Stop submitting new motions by non-staff users'), + label='Stop submitting new motions by non-staff users', weight=325, - group=ugettext_lazy('Motions'), - subgroup=ugettext_lazy('General')) + group='Motions', + subgroup='General') yield ConfigVariable( name='motions_allow_disable_versioning', default_value=False, input_type='boolean', - label=ugettext_lazy('Allow to disable versioning'), + label='Allow to disable versioning', weight=330, - group=ugettext_lazy('Motions'), - subgroup=ugettext_lazy('General')) + group='Motions', + subgroup='General') # Amendments # Amendments currently not implemented. (TODO: Implement it like in OpenSlides 1.7.) @@ -82,20 +80,20 @@ def get_config_variables(): name='motions_amendments_enabled', default_value=False, input_type='boolean', - label=ugettext_lazy('Activate amendments'), + label='Activate amendments', hidden=True, weight=335, - group=ugettext_lazy('Motions'), - subgroup=ugettext_lazy('Amendments')) + group='Motions', + subgroup='Amendments') yield ConfigVariable( name='motions_amendments_prefix', - default_value=pgettext('Prefix for the identifier for amendments', 'A'), - label=ugettext_lazy('Prefix for the identifier for amendments'), + default_value='A', + label='Prefix for the identifier for amendments', hidden=True, weight=340, - group=ugettext_lazy('Motions'), - subgroup=ugettext_lazy('Amendments')) + group='Motions', + subgroup='Amendments') # Supporters @@ -103,21 +101,21 @@ def get_config_variables(): name='motions_min_supporters', default_value=0, input_type='integer', - label=ugettext_lazy('Number of (minimum) required supporters for a motion'), - help_text=ugettext_lazy('Choose 0 to disable the supporting system.'), + label='Number of (minimum) required supporters for a motion', + help_text='Choose 0 to disable the supporting system.', weight=345, - group=ugettext_lazy('Motions'), - subgroup=ugettext_lazy('Supporters'), + group='Motions', + subgroup='Supporters', validators=(MinValueValidator(0),)) yield ConfigVariable( name='motions_remove_supporters', default_value=False, input_type='boolean', - label=ugettext_lazy('Remove all supporters of a motion if a submitter edits his motion in early state'), + label='Remove all supporters of a motion if a submitter edits his motion in early state', weight=350, - group=ugettext_lazy('Motions'), - subgroup=ugettext_lazy('Supporters')) + group='Motions', + subgroup='Supporters') # Voting and ballot papers @@ -125,59 +123,59 @@ def get_config_variables(): name='motions_poll_100_percent_base', default_value='WITHOUT_INVALID', input_type='choice', - label=ugettext_lazy('The 100 % base of a voting result consists of'), + label='The 100 % base of a voting result consists of', choices=PERCENT_BASE_CHOICES, weight=355, - group=ugettext_lazy('Motions'), - subgroup=ugettext_lazy('Voting and ballot papers')) + group='Motions', + subgroup='Voting and ballot papers') yield ConfigVariable( name='motions_pdf_ballot_papers_selection', default_value='CUSTOM_NUMBER', input_type='choice', - label=ugettext_lazy('Number of ballot papers (selection)'), + label='Number of ballot papers (selection)', choices=( - {'value': 'NUMBER_OF_DELEGATES', 'display_name': ugettext_lazy('Number of all delegates')}, - {'value': 'NUMBER_OF_ALL_PARTICIPANTS', 'display_name': ugettext_lazy('Number of all participants')}, - {'value': 'CUSTOM_NUMBER', 'display_name': ugettext_lazy('Use the following custom number')}), + {'value': 'NUMBER_OF_DELEGATES', 'display_name': 'Number of all delegates'}, + {'value': 'NUMBER_OF_ALL_PARTICIPANTS', 'display_name': 'Number of all participants'}, + {'value': 'CUSTOM_NUMBER', 'display_name': 'Use the following custom number'}), weight=360, - group=ugettext_lazy('Motions'), - subgroup=ugettext_lazy('Voting and ballot papers')) + group='Motions', + subgroup='Voting and ballot papers') yield ConfigVariable( name='motions_pdf_ballot_papers_number', default_value=8, input_type='integer', - label=ugettext_lazy('Custom number of ballot papers'), + label='Custom number of ballot papers', weight=365, - group=ugettext_lazy('Motions'), - subgroup=ugettext_lazy('Voting and ballot papers'), + group='Motions', + subgroup='Voting and ballot papers', validators=(MinValueValidator(1),)) # PDF yield ConfigVariable( name='motions_pdf_title', - default_value=_('Motions'), - label=ugettext_lazy('Title for PDF document (all motions)'), + default_value='Motions', + label='Title for PDF document (all motions)', weight=370, - group=ugettext_lazy('Motions'), - subgroup=ugettext_lazy('PDF'), + group='Motions', + subgroup='PDF', translatable=True) yield ConfigVariable( name='motions_pdf_preamble', default_value='', - label=ugettext_lazy('Preamble text for PDF document (all motions)'), + label='Preamble text for PDF document (all motions)', weight=375, - group=ugettext_lazy('Motions'), - subgroup=ugettext_lazy('PDF')) + group='Motions', + subgroup='PDF') yield ConfigVariable( name='motions_pdf_paragraph_numbering', default_value=False, input_type='boolean', - label=ugettext_lazy('Show paragraph numbering (only in PDF)'), + label='Show paragraph numbering (only in PDF)', weight=380, - group=ugettext_lazy('Motions'), - subgroup=ugettext_lazy('PDF')) + group='Motions', + subgroup='PDF') diff --git a/openslides/motions/static/js/motions/site.js b/openslides/motions/static/js/motions/site.js index f674b5bf1..135ed75ee 100644 --- a/openslides/motions/static/js/motions/site.js +++ b/openslides/motions/static/js/motions/site.js @@ -1051,6 +1051,36 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions']) ); }; } +]) + +//mark all motions config strings for translation in javascript +.config([ + 'gettext', + function (gettext) { + gettext('The assembly may decide,'); + gettext('Workflow of new motions'); + gettext('Motions'); + gettext('Identifier'); + gettext('Numbered per category'); + gettext('Serially numbered'); + gettext('Set it manually'); + gettext('Motion preamble'); + gettext('Stop submitting new motions by non-staff users'); + gettext('Allow to disable versioning'); + gettext('Activate amendments'); + gettext('Amendments'); + gettext('Prefix for the identifier for amendments'); + gettext('Number of (minimum) required supporters for a motion'); + gettext('Choose 0 to disable the supporting system.'); + gettext('Supporters'); + gettext('Remove all supporters of a motion if a submitter edits his' + + ' motion in early state'); + gettext('Title for PDF document (all motions)'); + gettext('Preamble text for PDF document (all motioqns)'); + gettext('Show paragraph numbering (only in PDF)'); + /// Prefix for the identifier for amendments + gettext('A'); + } ]); }()); diff --git a/openslides/users/config_variables.py b/openslides/users/config_variables.py index 171f313a7..b6ffc8aca 100644 --- a/openslides/users/config_variables.py +++ b/openslides/users/config_variables.py @@ -1,6 +1,3 @@ -from django.utils.translation import ugettext as _ -from django.utils.translation import ugettext_lazy - from openslides.core.config import ConfigVariable @@ -16,71 +13,71 @@ def get_config_variables(): name='users_sort_users_by_first_name', default_value=False, input_type='boolean', - label=ugettext_lazy('Sort users by first name'), - help_text=ugettext_lazy('Disable for sorting by last name'), + label='Sort users by first name', + help_text='Disable for sorting by last name', weight=510, - group=ugettext_lazy('Users'), - subgroup=ugettext_lazy('Sorting')) + group='Users', + subgroup='Sorting') # PDF yield ConfigVariable( name='users_pdf_welcometitle', - default_value=_('Welcome to OpenSlides!'), - label=ugettext_lazy('Title for access data and welcome PDF'), + default_value='Welcome to OpenSlides!', + label='Title for access data and welcome PDF', weight=520, - group=ugettext_lazy('Users'), - subgroup=ugettext_lazy('PDF'), + group='Users', + subgroup='PDF', translatable=True) yield ConfigVariable( name='users_pdf_welcometext', - default_value=_('[Place for your welcome and help text.]'), - label=ugettext_lazy('Help text for access data and welcome PDF'), + default_value='[Place for your welcome and help text.]', + label='Help text for access data and welcome PDF', weight=530, - group=ugettext_lazy('Users'), - subgroup=ugettext_lazy('PDF'), + group='Users', + subgroup='PDF', translatable=True) # TODO: Use Django's URLValidator here. yield ConfigVariable( name='users_pdf_url', default_value='http://example.com:8000', - label=ugettext_lazy('System URL'), - help_text=ugettext_lazy('Used for QRCode in PDF of access data.'), + label='System URL', + help_text='Used for QRCode in PDF of access data.', weight=540, - group=ugettext_lazy('Users'), - subgroup=ugettext_lazy('PDF')) + group='Users', + subgroup='PDF') yield ConfigVariable( name='users_pdf_wlan_ssid', default_value='', - label=ugettext_lazy('WLAN name (SSID)'), - help_text=ugettext_lazy('Used for WLAN QRCode in PDF of access data.'), + label='WLAN name (SSID)', + help_text='Used for WLAN QRCode in PDF of access data.', weight=550, - group=ugettext_lazy('Users'), - subgroup=ugettext_lazy('PDF')) + group='Users', + subgroup='PDF') yield ConfigVariable( name='users_pdf_wlan_password', default_value='', - label=ugettext_lazy('WLAN password'), - help_text=ugettext_lazy('Used for WLAN QRCode in PDF of access data.'), + label='WLAN password', + help_text='Used for WLAN QRCode in PDF of access data.', weight=560, - group=ugettext_lazy('Users'), - subgroup=ugettext_lazy('PDF')) + group='Users', + subgroup='PDF') yield ConfigVariable( name='users_pdf_wlan_encryption', default_value='', input_type='choice', - label=ugettext_lazy('WLAN encryption'), - help_text=ugettext_lazy('Used for WLAN QRCode in PDF of access data.'), + label='WLAN encryption', + help_text='Used for WLAN QRCode in PDF of access data.', choices=( {'value': '', 'display_name': '---------'}, - {'value': 'WEP', 'display_name': ugettext_lazy('WEP')}, - {'value': 'WPA', 'display_name': ugettext_lazy('WPA/WPA2')}, - {'value': 'nopass', 'display_name': ugettext_lazy('No encryption')}), + {'value': 'WEP', 'display_name': 'WEP'}, + {'value': 'WPA', 'display_name': 'WPA/WPA2'}, + {'value': 'nopass', 'display_name': 'No encryption'}), weight=570, - group=ugettext_lazy('Users'), - subgroup=ugettext_lazy('PDF')) + group='Users', + subgroup='PDF') diff --git a/openslides/users/static/js/users/site.js b/openslides/users/static/js/users/site.js index 12174a41a..f42e1cfa1 100644 --- a/openslides/users/static/js/users/site.js +++ b/openslides/users/static/js/users/site.js @@ -998,6 +998,29 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users']) gettext('Can see names of users'); gettext('Can see extra data of users (e.g. present and comment)'); gettext('Can manage users'); + //mark all config strings in users/config_variables.py for translation + gettext('Welcome to OpenSlides'); + gettext('Space for your welcome text.]'); + gettext('[Place for your welcome and help text.]'); + gettext('Sort users by first name'); + gettext('Disable for sorting by last name'); + gettext('Users'); + gettext('Sorting'); + gettext('Welcome to OpenSlides!'); + gettext('Title for access data and welcome PDF'); + gettext('PDF'); + gettext('Help text for access data and welcome PDF'); + gettext('System URL'); + gettext('Used for QRCode in PDF of access data.'); + gettext('WLAN name (SSID)'); + gettext('Used for WLAN QRCode in PDF of access data.'); + gettext('WLAN password'); + gettext('Used for WLAN QRCode in PDF of access data.'); + gettext('WLAN encryption'); + gettext('Used for WLAN QRCode in PDF of access data.'); + gettext('WEP'); + gettext('WPA/WPA2'); + gettext('No encryption'); } ]);