Updated voting strings for translation

This commit is contained in:
Emanuel Schütze 2020-02-25 10:54:29 +01:00 committed by FinnStutzenstein
parent e72bcc1eaf
commit 2d13519c35
9 changed files with 61 additions and 64 deletions

View File

@ -13,7 +13,7 @@ export interface AssignmentPollTitleInformation {
} }
export const AssignmentPollMethodsVerbose = { export const AssignmentPollMethodsVerbose = {
votes: 'Fixed Amount of votes for all candidates', votes: 'Yes per candidate',
YN: 'Yes/No per candidate', YN: 'Yes/No per candidate',
YNA: 'Yes/No/Abstain per candidate' YNA: 'Yes/No/Abstain per candidate'
}; };

View File

@ -17,7 +17,7 @@
<!-- Detailview for poll --> <!-- Detailview for poll -->
<ng-template #viewTemplate> <ng-template #viewTemplate>
<ng-container *ngIf="poll"> <ng-container *ngIf="poll">
<h1>{{ poll.title }}</h1> <h1>{{ poll.title | translate }}</h1>
<div> <div>
<!-- Subtitle --> <!-- Subtitle -->
@ -25,7 +25,7 @@
<!-- State chip --> <!-- State chip -->
<span> <span>
{{ poll.stateVerbose }} {{ poll.stateVerbose | translate }}
</span> </span>
</div> </div>

View File

@ -107,7 +107,7 @@ export class MotionPollComponent extends BasePollComponent<ViewMotionPoll> {
public constructor( public constructor(
titleService: Title, titleService: Title,
matSnackBar: MatSnackBar, matSnackBar: MatSnackBar,
translate: TranslateService, protected translate: TranslateService,
dialog: MatDialog, dialog: MatDialog,
promptService: PromptService, promptService: PromptService,
public pollRepo: MotionPollRepositoryService, public pollRepo: MotionPollRepositoryService,
@ -123,10 +123,10 @@ export class MotionPollComponent extends BasePollComponent<ViewMotionPoll> {
} }
public async deletePoll(): Promise<void> { public async deletePoll(): Promise<void> {
const title = 'Delete poll'; const title = this.translate.instant('Are you sure you want to delete this vote?');
const text = 'Do you really want to delete the selected poll?'; 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); this.repo.delete(this.poll).catch(this.raiseError);
} }
} }

View File

@ -116,19 +116,15 @@ export abstract class BasePollDetailComponent<V extends ViewBasePoll> extends Ba
} }
public async deletePoll(): Promise<void> { public async deletePoll(): Promise<void> {
const title = 'Delete poll'; const title = this.translate.instant('Are you sure you want to delete this vote?');
const text = 'Do you really want to delete the selected poll?'; if (await this.promptService.open(title)) {
if (await this.promptService.open(title, text)) {
this.repo.delete(this.poll).then(() => this.onDeleted(), this.raiseError); this.repo.delete(this.poll).then(() => this.onDeleted(), this.raiseError);
} }
} }
public async pseudoanonymizePoll(): Promise<void> { public async pseudoanonymizePoll(): Promise<void> {
const title = 'Anonymize single votes'; const title = this.translate.instant('Are you sure you want to anonymize all votes? This cannot be undone.');
const text = 'Do you really want to anonymize all votes? This cannot be undone.'; if (await this.promptService.open(title)) {
if (await this.promptService.open(title, text)) {
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 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
} }
} }

View File

@ -36,7 +36,7 @@ export abstract class BasePollComponent<V extends ViewBasePoll> extends BaseView
public constructor( public constructor(
titleService: Title, titleService: Title,
matSnackBar: MatSnackBar, matSnackBar: MatSnackBar,
public translate: TranslateService, protected translate: TranslateService,
public dialog: MatDialog, public dialog: MatDialog,
protected promptService: PromptService, protected promptService: PromptService,
protected repo: BasePollRepositoryService, protected repo: BasePollRepositoryService,
@ -47,8 +47,9 @@ export abstract class BasePollComponent<V extends ViewBasePoll> extends BaseView
public async changeState(key: PollState): Promise<void> { public async changeState(key: PollState): Promise<void> {
if (key === PollState.Created) { if (key === PollState.Created) {
const title = this.translate.instant('Are you sure you want to reset this poll? All Votes will be lost.'); const title = this.translate.instant('Are you sure you want to reset this vote?');
if (await this.promptService.open(title)) { 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); this.repo.resetPoll(this._poll).catch(this.raiseError);
} }
} else { } else {
@ -64,7 +65,7 @@ export abstract class BasePollComponent<V extends ViewBasePoll> extends BaseView
* Handler for the 'delete poll' button * Handler for the 'delete poll' button
*/ */
public async onDeletePoll(): Promise<void> { public async onDeletePoll(): Promise<void> {
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)) { if (await this.promptService.open(title)) {
await this.repo.delete(this._poll).catch(this.raiseError); await this.repo.delete(this._poll).catch(this.raiseError);
} }

View File

@ -35,10 +35,10 @@ export const PollClassTypeVerbose = {
}; };
export const PollStateVerbose = { export const PollStateVerbose = {
1: 'Created', 1: 'created',
2: 'Started', 2: 'started',
3: 'Finished (unpublished)', 3: 'finished (unpublished)',
4: 'Published' 4: 'published'
}; };
export const PollStateChangeActionVerbose = { export const PollStateChangeActionVerbose = {
@ -49,21 +49,21 @@ export const PollStateChangeActionVerbose = {
}; };
export const PollTypeVerbose = { export const PollTypeVerbose = {
analog: 'Analog voting', analog: 'analog',
named: 'Named voting', named: 'nominal',
pseudoanonymous: 'Pseudoanonymous voting' pseudoanonymous: 'non-nominal'
}; };
export const PollPropertyVerbose = { export const PollPropertyVerbose = {
majority_method: 'Required majority', majority_method: 'Required majority',
onehundred_percent_base: '100% base', onehundred_percent_base: '100% base',
type: 'Poll type', type: 'Voting type',
pollmethod: 'Poll method', pollmethod: 'Voting method',
state: 'State', state: 'State',
groups: 'Entitled to vote', groups: 'Entitled to vote',
votes_amount: 'Amount of votes', votes_amount: 'Amount of votes',
global_no: 'Enable global no', global_no: 'general "No"',
global_abstain: 'Enable global abstain' global_abstain: 'general "Abstain"'
}; };
export const MajorityMethodVerbose = { export const MajorityMethodVerbose = {

View File

@ -30,10 +30,10 @@ export class PollFilterListService extends BaseFilterListService<ViewBasePoll> {
property: 'state', property: 'state',
label: this.translate.instant('State'), label: this.translate.instant('State'),
options: [ options: [
{ condition: PollState.Created, label: this.translate.instant('Created') }, { condition: PollState.Created, label: this.translate.instant('created') },
{ condition: PollState.Started, label: this.translate.instant('Started') }, { condition: PollState.Started, label: this.translate.instant('started') },
{ condition: PollState.Finished, label: this.translate.instant('Finished') }, { condition: PollState.Finished, label: this.translate.instant('finished (unpublished)') },
{ condition: PollState.Published, label: this.translate.instant('Published') } { condition: PollState.Published, label: this.translate.instant('published') }
] ]
}, },
{ {

View File

@ -11,6 +11,20 @@ def get_config_variables():
to be evaluated during app loading (see apps.py). to be evaluated during app loading (see apps.py).
""" """
# Voting # 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( yield ConfigVariable(
name="assignment_poll_default_100_percent_base", name="assignment_poll_default_100_percent_base",
default_value="YNA", default_value="YNA",
@ -20,9 +34,19 @@ def get_config_variables():
{"value": base[0], "display_name": base[1]} {"value": base[0], "display_name": base[1]}
for base in AssignmentPoll.PERCENT_BASES for base in AssignmentPoll.PERCENT_BASES
), ),
weight=400, weight=405,
group="Elections", 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( yield ConfigVariable(
@ -35,34 +59,10 @@ def get_config_variables():
), ),
label="Required majority", label="Required majority",
help_text="Default method to check whether a candidate has reached the required majority.", help_text="Default method to check whether a candidate has reached the required majority.",
weight=405, weight=415,
hidden=True, hidden=True,
group="Elections", group="Elections",
subgroup="Voting", subgroup="Ballot",
)
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",
) )
yield ConfigVariable( yield ConfigVariable(
@ -72,7 +72,7 @@ def get_config_variables():
label="Put all candidates on the list of speakers", label="Put all candidates on the list of speakers",
weight=420, weight=420,
group="Elections", group="Elections",
subgroup="Voting", subgroup="Ballot",
) )
# Ballot Paper # Ballot Paper

View File

@ -365,7 +365,7 @@ def get_config_variables():
name="motion_poll_default_groups", name="motion_poll_default_groups",
default_value=[], default_value=[],
input_type="groups", input_type="groups",
label="Default groups for named and pseudoanonymous motion polls", label="Default groups with voting rights",
weight=372, weight=372,
group="Motions", group="Motions",
subgroup="Voting and ballot papers", subgroup="Voting and ballot papers",