From 2d13519c35b012474e5917c1740afcf44fb8a36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Sch=C3=BCtze?= Date: Tue, 25 Feb 2020 10:54:29 +0100 Subject: [PATCH] Updated voting strings for translation --- .../models/view-assignment-poll.ts | 2 +- .../motion-poll-detail.component.html | 4 +- .../motion-poll/motion-poll.component.ts | 8 +-- .../components/base-poll-detail.component.ts | 12 ++-- .../polls/components/base-poll.component.ts | 9 +-- .../app/site/polls/models/view-base-poll.ts | 22 +++---- .../services/poll-filter-list.service.ts | 8 +-- openslides/assignments/config_variables.py | 58 +++++++++---------- openslides/motions/config_variables.py | 2 +- 9 files changed, 61 insertions(+), 64 deletions(-) diff --git a/client/src/app/site/assignments/models/view-assignment-poll.ts b/client/src/app/site/assignments/models/view-assignment-poll.ts index 105e188f1..ba1d90f41 100644 --- a/client/src/app/site/assignments/models/view-assignment-poll.ts +++ b/client/src/app/site/assignments/models/view-assignment-poll.ts @@ -13,7 +13,7 @@ export interface AssignmentPollTitleInformation { } export const AssignmentPollMethodsVerbose = { - votes: 'Fixed Amount of votes for all candidates', + votes: 'Yes per candidate', YN: 'Yes/No per candidate', YNA: 'Yes/No/Abstain per candidate' }; diff --git a/client/src/app/site/motions/modules/motion-poll/motion-poll-detail/motion-poll-detail.component.html b/client/src/app/site/motions/modules/motion-poll/motion-poll-detail/motion-poll-detail.component.html index 460028802..11321386d 100644 --- a/client/src/app/site/motions/modules/motion-poll/motion-poll-detail/motion-poll-detail.component.html +++ b/client/src/app/site/motions/modules/motion-poll/motion-poll-detail/motion-poll-detail.component.html @@ -17,7 +17,7 @@ -

{{ poll.title }}

+

{{ poll.title | translate }}

@@ -25,7 +25,7 @@ - {{ poll.stateVerbose }} + {{ poll.stateVerbose | translate }}
diff --git a/client/src/app/site/motions/modules/motion-poll/motion-poll/motion-poll.component.ts b/client/src/app/site/motions/modules/motion-poll/motion-poll/motion-poll.component.ts index c47c6bd20..6faceabaf 100644 --- a/client/src/app/site/motions/modules/motion-poll/motion-poll/motion-poll.component.ts +++ b/client/src/app/site/motions/modules/motion-poll/motion-poll/motion-poll.component.ts @@ -107,7 +107,7 @@ export class MotionPollComponent extends BasePollComponent { public constructor( titleService: Title, matSnackBar: MatSnackBar, - translate: TranslateService, + protected translate: TranslateService, dialog: MatDialog, promptService: PromptService, public pollRepo: MotionPollRepositoryService, @@ -123,10 +123,10 @@ export class MotionPollComponent extends BasePollComponent { } public async deletePoll(): Promise { - const title = 'Delete poll'; - const text = 'Do you really want to delete the selected poll?'; + const title = this.translate.instant('Are you sure you want to delete this vote?'); + const content = this.poll.getTitle(); - if (await this.promptService.open(title, text)) { + if (await this.promptService.open(title, content)) { this.repo.delete(this.poll).catch(this.raiseError); } } diff --git a/client/src/app/site/polls/components/base-poll-detail.component.ts b/client/src/app/site/polls/components/base-poll-detail.component.ts index f0af24139..fb70853ae 100644 --- a/client/src/app/site/polls/components/base-poll-detail.component.ts +++ b/client/src/app/site/polls/components/base-poll-detail.component.ts @@ -116,19 +116,15 @@ export abstract class BasePollDetailComponent extends Ba } public async deletePoll(): Promise { - const title = 'Delete poll'; - const text = 'Do you really want to delete the selected poll?'; - - if (await this.promptService.open(title, text)) { + const title = this.translate.instant('Are you sure you want to delete this vote?'); + if (await this.promptService.open(title)) { this.repo.delete(this.poll).then(() => this.onDeleted(), this.raiseError); } } public async pseudoanonymizePoll(): Promise { - const title = 'Anonymize single votes'; - const text = 'Do you really want to anonymize all votes? This cannot be undone.'; - - if (await this.promptService.open(title, text)) { + const title = this.translate.instant('Are you sure you want to anonymize all votes? This cannot be undone.'); + if (await this.promptService.open(title)) { this.repo.pseudoanonymize(this.poll).then(() => this.onPollLoaded(), this.raiseError); // votes have changed, but not the poll, so the components have to be informed about the update } } diff --git a/client/src/app/site/polls/components/base-poll.component.ts b/client/src/app/site/polls/components/base-poll.component.ts index 8259df3c7..e52711a23 100644 --- a/client/src/app/site/polls/components/base-poll.component.ts +++ b/client/src/app/site/polls/components/base-poll.component.ts @@ -36,7 +36,7 @@ export abstract class BasePollComponent extends BaseView public constructor( titleService: Title, matSnackBar: MatSnackBar, - public translate: TranslateService, + protected translate: TranslateService, public dialog: MatDialog, protected promptService: PromptService, protected repo: BasePollRepositoryService, @@ -47,8 +47,9 @@ export abstract class BasePollComponent extends BaseView public async changeState(key: PollState): Promise { if (key === PollState.Created) { - const title = this.translate.instant('Are you sure you want to reset this poll? All Votes will be lost.'); - if (await this.promptService.open(title)) { + const title = this.translate.instant('Are you sure you want to reset this vote?'); + const content = this.translate.instant('All votes will be lost.'); + if (await this.promptService.open(title, content)) { this.repo.resetPoll(this._poll).catch(this.raiseError); } } else { @@ -64,7 +65,7 @@ export abstract class BasePollComponent extends BaseView * Handler for the 'delete poll' button */ public async onDeletePoll(): Promise { - const title = this.translate.instant('Are you sure you want to delete this poll?'); + const title = this.translate.instant('Are you sure you want to delete this vote?'); if (await this.promptService.open(title)) { await this.repo.delete(this._poll).catch(this.raiseError); } diff --git a/client/src/app/site/polls/models/view-base-poll.ts b/client/src/app/site/polls/models/view-base-poll.ts index 26a0eb119..3ec74629f 100644 --- a/client/src/app/site/polls/models/view-base-poll.ts +++ b/client/src/app/site/polls/models/view-base-poll.ts @@ -35,10 +35,10 @@ export const PollClassTypeVerbose = { }; export const PollStateVerbose = { - 1: 'Created', - 2: 'Started', - 3: 'Finished (unpublished)', - 4: 'Published' + 1: 'created', + 2: 'started', + 3: 'finished (unpublished)', + 4: 'published' }; export const PollStateChangeActionVerbose = { @@ -49,21 +49,21 @@ export const PollStateChangeActionVerbose = { }; export const PollTypeVerbose = { - analog: 'Analog voting', - named: 'Named voting', - pseudoanonymous: 'Pseudoanonymous voting' + analog: 'analog', + named: 'nominal', + pseudoanonymous: 'non-nominal' }; export const PollPropertyVerbose = { majority_method: 'Required majority', onehundred_percent_base: '100% base', - type: 'Poll type', - pollmethod: 'Poll method', + type: 'Voting type', + pollmethod: 'Voting method', state: 'State', groups: 'Entitled to vote', votes_amount: 'Amount of votes', - global_no: 'Enable global no', - global_abstain: 'Enable global abstain' + global_no: 'general "No"', + global_abstain: 'general "Abstain"' }; export const MajorityMethodVerbose = { diff --git a/client/src/app/site/polls/services/poll-filter-list.service.ts b/client/src/app/site/polls/services/poll-filter-list.service.ts index cf113db14..db47afe63 100644 --- a/client/src/app/site/polls/services/poll-filter-list.service.ts +++ b/client/src/app/site/polls/services/poll-filter-list.service.ts @@ -30,10 +30,10 @@ export class PollFilterListService extends BaseFilterListService { property: 'state', label: this.translate.instant('State'), options: [ - { condition: PollState.Created, label: this.translate.instant('Created') }, - { condition: PollState.Started, label: this.translate.instant('Started') }, - { condition: PollState.Finished, label: this.translate.instant('Finished') }, - { condition: PollState.Published, label: this.translate.instant('Published') } + { condition: PollState.Created, label: this.translate.instant('created') }, + { condition: PollState.Started, label: this.translate.instant('started') }, + { condition: PollState.Finished, label: this.translate.instant('finished (unpublished)') }, + { condition: PollState.Published, label: this.translate.instant('published') } ] }, { diff --git a/openslides/assignments/config_variables.py b/openslides/assignments/config_variables.py index af4ce28d1..56d5e66dd 100644 --- a/openslides/assignments/config_variables.py +++ b/openslides/assignments/config_variables.py @@ -11,6 +11,20 @@ def get_config_variables(): to be evaluated during app loading (see apps.py). """ # Voting + yield ConfigVariable( + name="assignment_poll_method", + default_value="votes", + input_type="choice", + label="Preselected election method", + choices=tuple( + {"value": method[0], "display_name": method[1]} + for method in AssignmentPoll.POLLMETHODS + ), + weight=400, + group="Elections", + subgroup="Ballot", + ) + yield ConfigVariable( name="assignment_poll_default_100_percent_base", default_value="YNA", @@ -20,9 +34,19 @@ def get_config_variables(): {"value": base[0], "display_name": base[1]} for base in AssignmentPoll.PERCENT_BASES ), - weight=400, + weight=405, group="Elections", - subgroup="Voting", + subgroup="Ballot", + ) + + yield ConfigVariable( + name="assignment_poll_default_groups", + default_value=[], + input_type="groups", + label="Default groups with voting rights", + weight=410, + group="Elections", + subgroup="Ballot", ) yield ConfigVariable( @@ -35,34 +59,10 @@ def get_config_variables(): ), label="Required majority", help_text="Default method to check whether a candidate has reached the required majority.", - weight=405, + weight=415, hidden=True, group="Elections", - subgroup="Voting", - ) - - yield ConfigVariable( - name="assignment_poll_default_groups", - default_value=[], - input_type="groups", - label="Default groups for named and pseudoanonymous assignment polls", - weight=410, - group="Elections", - subgroup="Voting", - ) - - yield ConfigVariable( - name="assignment_poll_method", - default_value="votes", - input_type="choice", - label="Preselected poll method", - choices=tuple( - {"value": method[0], "display_name": method[1]} - for method in AssignmentPoll.POLLMETHODS - ), - weight=415, - group="Elections", - subgroup="Voting", + subgroup="Ballot", ) yield ConfigVariable( @@ -72,7 +72,7 @@ def get_config_variables(): label="Put all candidates on the list of speakers", weight=420, group="Elections", - subgroup="Voting", + subgroup="Ballot", ) # Ballot Paper diff --git a/openslides/motions/config_variables.py b/openslides/motions/config_variables.py index c20abb303..d73137b59 100644 --- a/openslides/motions/config_variables.py +++ b/openslides/motions/config_variables.py @@ -365,7 +365,7 @@ def get_config_variables(): name="motion_poll_default_groups", default_value=[], input_type="groups", - label="Default groups for named and pseudoanonymous motion polls", + label="Default groups with voting rights", weight=372, group="Motions", subgroup="Voting and ballot papers",