Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Multilingualism #346

Merged
merged 11 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<div class="navbar-unfixed-top text-center">
<div class="container">
<div class="hidden unfixed-top-height"></div>
<h1 ng-bind-html="election.presentation.extra_options.public_title || election.title">
<h1 ng-bind-html="(election.presentation | customI18n : 'public_title') || (election | customI18n : 'title')">
</h1>
<p class="description" ng-bind-html="election.description | addTargetBlank"></p>
<p class="description" ng-bind-html="(election | customI18n : 'description') | addTargetBlank"></p>
</div>
</div>
</div>
Expand All @@ -16,15 +16,15 @@ <h1 ng-bind-html="election.presentation.extra_options.public_title || election.t
<div class="container">
<div class="row options-row">
<div class="col-xs-12">
<h3>{{election.questions[0].title}}</h3>
<h3>{{election.questions[0] | customI18n : 'title'}}</h3>
</div>
<div class="col-xs-6">
<div class="opt" ng-click="toggleOption(0, 0)">
<span class="glyphicon"
ng-class="{'glyphicon-unchecked': election.questions[0].answers[0].selected === -1,
'glyphicon-check': election.questions[0].answers[0].selected === 0}">
</span>
{{election.questions[0].answers[0].text}}
{{election.questions[0].answers[0] | customI18n : 'text'}}
</div>
</div>
<div class="col-xs-6 left-border">
Expand All @@ -33,20 +33,20 @@ <h3>{{election.questions[0].title}}</h3>
ng-class="{'glyphicon-unchecked': election.questions[0].answers[1].selected === -1,
'glyphicon-check': election.questions[0].answers[1].selected === 0}">
</span>
{{election.questions[0].answers[1].text}}
{{election.questions[0].answers[1] | customI18n : 'text'}}
</div>
<div class="container-fluid" ng-if="election.questions.length > 1">
<div class="row">
<div class="col-xs-12">
<h3>{{election.questions[1].title}}</h3>
<h3>{{election.questions[1] | customI18n : 'title'}}</h3>
</div>
<div class="col-xs-12 col-sm-{{12/election.questions[1].answers.length}}" ng-repeat="answer in election.questions[1].answers">
<div class="opt" ng-click="toggleOption(1, $index)">
<span class="glyphicon"
ng-class="{'glyphicon-unchecked': election.questions[1].answers[$index].selected === -1,
'glyphicon-check': election.questions[1].answers[$index].selected === 0}">
</span>
{{election.questions[1].answers[$index].text}}
{{election.questions[1].answers[$index] | customI18n : 'text'}}
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
parent
ng-if="!isYoutube(option) && !!urls['Image URL']"
ng-src="{{urls['Image URL']}}"
alt="{{option.text}}" />
alt="{{option | customI18n : 'text'}}" />
</div>

<!-- texts -->
Expand All @@ -56,7 +56,7 @@
{{option.selected + 1}}.
</span>
<span>
<span class="answer-text" ng-bind-html="option.text"></span>
<span class="answer-text" ng-bind-html="option | customI18n : 'text'"></span>
<span
ng-if="showPoints && option.selected > -1"
ng-i18next="[i18next]({points: getPoints()})avBooth.showSelectedOptionPoints">
Expand Down Expand Up @@ -107,7 +107,7 @@
parent
ng-if="!isYoutube(option) && !!urls['Image URL']"
ng-src="{{urls['Image URL']}}"
alt="{{option.text}}" />
alt="{{option | customI18n : 'text'}}" />
</div>

<!-- remove action -->
Expand Down Expand Up @@ -154,15 +154,15 @@
{{option.selected + 1}}.
</span>
<span>
<span class="answer-text" ng-bind-html="option.text"></span>
<span class="answer-text" ng-bind-html="option | customI18n : 'text'"></span>
<span
ng-if="showPoints && option.selected > -1"
ng-i18next="[i18next]({points: getPoints()})avBooth.showSelectedOptionPoints">
</span>
</span>
</strong>
<p class="answer-description details visible-lg" ng-if="(dnd_disable || !selectedOptions || (!!selectedOptions && !isTouchDevice)) && option.details && option.details.length > 1" ng-bind-html="option.details">
<p class="answer-description details hidden-lg" ng-if="!selectedOptions && option.details && option.details.length > 1" ng-bind-html="option.details">
<p class="answer-description details visible-lg" ng-if="(dnd_disable || !selectedOptions || (!!selectedOptions && !isTouchDevice)) && ((option.details && option.details.length > 1) || option.details_i18n)" ng-bind-html="option | customI18n : 'details'">
<p class="answer-description details hidden-lg" ng-if="!selectedOptions && ((option.details && option.details.length > 1) || option.details_i18n)" ng-bind-html="option | customI18n : 'details'">
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ng-if="!category.hidden"
class="election-category"
>
<h2 class="category-title">{{category.title}}</h2>
<h2 class="category-title">{{category | customI18n : 'title'}}</h2>
<div class="category-elections-wrapper">
<div
ng-repeat="election in category.events"
Expand All @@ -15,8 +15,8 @@ <h2 class="category-title">{{category.title}}</h2>
ng-click="canVoteElection(election) && click(election)"
>
<div class="text-container">
<h3 class="election-title">{{election.title}}</h3>
<p class="election-description" ng-if="!!election.description">{{election.description}}</p>
<h3 class="election-title">{{election | customI18n : 'title'}}</h3>
<p class="election-description" ng-if="!!election.description">{{election | customI18n : 'description'}}</p>
<a
href="election/{{ election.event_id }}/public/home"
ng-if="checkElectionStarted(election.electionData)"
Expand Down
4 changes: 2 additions & 2 deletions avBooth/help-screen-directive/help-screen-directive.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<div class="navbar-unfixed-top text-center">
<div class="container">
<div class="hidden unfixed-top-height"></div>
<h1 ng-bind-html="election.presentation.extra_options.public_title || election.title">
<h1 ng-bind-html="(election.presentation | customI18n : 'public_title') || (election | customI18n : 'title')">
</h1>
<p class="description" ng-bind-html="election.description | addTargetBlank"></p>
<p class="description" ng-bind-html="(election | customI18n : 'description') | addTargetBlank"></p>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
<h1
class="question-title"
ng-if="!showingPreset"
ng-bind-html="stateData.question.title"
ng-bind-html="stateData.question | customI18n : 'title'"
></h1>
</div>
<p
ng-if="!showingPreset"
class="question-description"
ng-bind-html="stateData.question.description | addTargetBlank">
ng-bind-html="(stateData.question | customI18n : 'description') | addTargetBlank">
</p>

<div class="content avb-content" ng-if="!showingPreset">
Expand Down Expand Up @@ -161,7 +161,7 @@ <h4 aria-level="2" class="text-brand-success" ng-i18next="avBooth.questionAvaila
<div class="col-xs-12">
<span ng-if="showingPreset">
<h3 ng-bind-html="stateData.question.extra_options.recommended_preset__title | addTargetBlank"></h3>
<p class="description" ng-bind-html="stateData.question.description | addTargetBlank"></p>
<p class="description" ng-bind-html="(stateData.question | customI18n : 'description') | addTargetBlank"></p>
</span>
</div>
</div>
Expand Down
16 changes: 8 additions & 8 deletions avBooth/pairwise-beta-directive/pairwise-beta-directive.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class="col-md-7 text-center center-col"
>
<div class="top-navbar-title">
{{election.presentation.extra_options.public_title || election.title}}
{{(election.presentation | customI18n : 'public_title') || (election | customI18n : 'title')}}
</div>

<div
Expand Down Expand Up @@ -73,7 +73,7 @@ <h1>{{stateData.question.title}}</h1>
<div class="container">
<div class="row question-details">
<p
ng-bind-html="stateData.question.description | addTargetBlank"
ng-bind-html="stateData.question | customI18n : 'description' | addTargetBlank"
class="description">
</p>
<span class="selection-info" ng-i18next>
Expand All @@ -97,11 +97,11 @@ <h1>{{stateData.question.title}}</h1>
</iframe>
<img
ng-if="!isYoutube(one) && !!getUrls(one)['Image URL']"
alt="{{one.text}}"
alt="{{one | customI18n : 'text'}}"
ng-if="!!getUrls(one)['Image URL']"
ng-src="{{getUrls(one)['Image URL']}}" />
</div>
<h2 ng-bind-html="one.text"></h2>
<h2 ng-bind-html="one | customI18n : 'text'"></h2>
<div class="links">
<a
class="text-left"
Expand All @@ -117,7 +117,7 @@ <h2 ng-bind-html="one.text"></h2>
{{one.category}}
</div>
</div>
<p class="description" ng-bind-html="one.details"></p>
<p class="description" ng-bind-html="one | customI18n : 'details'"></p>
</div>
</div>

Expand All @@ -135,11 +135,11 @@ <h2 ng-bind-html="one.text"></h2>
</iframe>
<img
ng-if="!isYoutube(two) && !!getUrls(two)['Image URL']"
alt="{{two.text}}"
alt="{{two | customI18n : 'text'}}"
ng-if="!!getUrls(two)['Image URL']"
ng-src="{{getUrls(two)['Image URL']}}" />
</div>
<h2 ng-bind-html="two.text"></h2>
<h2 ng-bind-html="two | customI18n : 'text'"></h2>
<div class="links">
<a
class="text-left"
Expand All @@ -155,7 +155,7 @@ <h2 ng-bind-html="two.text"></h2>
{{two.category}}
</div>
</div>
<p class="description" ng-bind-html="two.details"></p>
<p class="description" ng-bind-html="two | customI18n : 'details'"></p>
</div>
</div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions avBooth/review-ballot-directive/review-ballot-directive.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
<div class="title-container">
<h3 aria-level="2" class="text-brand-success question-title">
<span>{{$index + 1}}.</span>
<span class="question-title title-text" ng-bind-html="question.title"></span>
<span class="question-title title-text" ng-bind-html="question | customI18n : 'title'"></span>
</h3>
<span class="edit-btn">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
</span>
</div>
<p
class="question-description"
ng-if="question.extra_options.review_screen__show_question_description && question.description"
ng-bind-html="question.description | addTargetBlank"
ng-if="question.extra_options.review_screen__show_question_description && (question.description || question.description_i18n)"
ng-bind-html="(question | customI18n : 'description') | addTargetBlank"
></p>

<!-- Selected items line -->
Expand All @@ -43,7 +43,7 @@ <h3 aria-level="2" class="text-brand-success question-title">
<li
ng-repeat="pair in question.selection"
class="animate-repeat selected-answer" ng-i18next>
[html:i18next]({one: pair[0].text, two: pair[1].text})avBooth.reviewScreen.pair
[html:i18next]({one: (pair[0] | customI18n : 'text'), two: (pair[1] | customI18n : 'text')})avBooth.reviewScreen.pair
</li>
</ul>
<ul
Expand All @@ -55,7 +55,7 @@ <h3 aria-level="2" class="text-brand-success question-title">
ng-class="{'striked-text': markedAsInvalid(question)}"
ng-if="!question.invalidVoteAnswer || answer.id !== question.invalidVoteAnswer.id"
class="animate-repeat selected-answer">
<span ng-bind-html="answer.text"></span>
<span ng-bind-html="answer | customI18n : 'text'"></span>
<span
ng-if="showPoints(question) && !isWriteIn(answer)"
ng-i18next="[i18next]({points: getPoints(question, answer)})avBooth.showSelectedOptionPoints">
Expand Down Expand Up @@ -89,7 +89,7 @@ <h3 aria-level="2" class="text-brand-success question-title">
ng-if="!question.invalidVoteAnswer || answer.id !== question.invalidVoteAnswer.id"
ng-class="{'striked-text': markedAsInvalid(question)}"
class="animate-repeat selected-answer">
<span ng-bind-html="answer.text"></span>
<span ng-bind-html="answer | customI18n : 'text'"></span>
<span
ng-if="showPoints(question) && !isWriteIn(answer)"
ng-i18next="[i18next]({points: getPoints(question, answer)})avBooth.showSelectedOptionPoints">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
<div class="title-container">
<h1 aria-level="2" class="text-brand-success question-title">
<span>{{$index + 1}}.</span>
<span class="question-title title-text" ng-bind-html="question.title"></span>
<span class="question-title title-text" ng-bind-html="question | customI18n : 'title'"></span>
</h1>
</div>

<p
class="question-description"
ng-if="question.extra_options.review_screen__show_question_description && question.description"
ng-bind-html="question.description | addTargetBlank"
ng-if="question.extra_options.review_screen__show_question_description && (question.description || question.description_i18n)"
ng-bind-html="(question | customI18n : 'description') | addTargetBlank"
>
</p>

Expand Down Expand Up @@ -141,7 +141,7 @@ <h1 aria-level="2" class="text-brand-success question-title">
ng-if="!question.invalidVoteAnswer || answer.id !== question.invalidVoteAnswer.id"
ng-class="{'striked-text': markedAsInvalid(question)}"
class="animate-repeat selected-answer">
<span ng-bind-html="answer.text"></span>
<span ng-bind-html="answer | customI18n : 'text'"></span>
<span
ng-if="showPoints(question) && !isWriteIn(answer)"
ng-i18next="[i18next]({points: getPoints(question, answer)})avBooth.showSelectedOptionPoints">
Expand Down
8 changes: 7 additions & 1 deletion avBooth/show-pdf-directive/show-pdf-directive.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
<div class="hidden unfixed-top-height"></div>
<h1
class="election-title"
ng-bind-html="parentElection && (parentElection.presentation.extra_options.public_title || parentElection.title) || !parentElection && (election.presentation.extra_options.public_title || election.title) || ''"
ng-if="parentElection"
ng-bind-html="(parentElection.presentation | customI18n : 'public_title') || (parentElection | customI18n : 'title') || ''"
></h1>
<h1
class="election-title"
ng-if="!parentElection"
ng-bind-html="(election.presentation | customI18n : 'public_title') || (election | customI18n : 'title') || ''"
></h1>
<p
class="pdf-text-description description"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
tabindex="0"
role="checkbox"
ng-if="!isInvalidVoteAnswer && question.tally_type === 'cumulative'"
aria-label="{{answer.text}} {{isWriteIn && 'write in ' || ''}}check {{check + 1}}"
aria-label="{{answer | customI18n : 'text'}} {{isWriteIn && 'write in ' || ''}}check {{check + 1}}"
ng-repeat="check in answer_cumulative_checks"
aria-checked="{{isCheckSelected(answer, check) ? 'true' : 'false'}}"
ng-click="!readOnly() && toggleSelectItemCumulative(question, answer, check)"
Expand All @@ -45,7 +45,7 @@
tabindex="0"
role="checkbox"
aria-checked="{{isCheckSelected(answer, 0) ? 'true' : 'false'}}"
aria-label="{{answer.text}} check invalid"
aria-label="{{answer | customI18n : 'text'}} check invalid"
ng-if="!!isInvalidVoteAnswer && question.tally_type === 'cumulative'"
ng-click="!readOnly() && toggleSelectItemCumulative(question, answer, 0)"
ng-class="{
Expand All @@ -61,7 +61,7 @@
parent
ng-if="!!answer.urlsObject['Image URL']"
ng-src="{{answer.urlsObject['Image URL']}}"
alt="{{answer.text}}"
alt="{{answer | customI18n : 'text'}}"
/>
</div>

Expand All @@ -73,12 +73,12 @@
<span
id="question_{{question.index}}_answer_{{answer.id}}"
class="answer-text"
ng-bind-html="answer.text"
ng-bind-html="answer | customI18n : 'text'"
></span>
<p
ng-if="answer.details && answer.details.length > 1"
ng-if="answer.details && answer.details.length > 1 || answer.details_i18n"
class="answer-details"
ng-bind-html="answer.details | addTargetBlank"
ng-bind-html="(answer | customI18n : 'details') | addTargetBlank"
></p>
</div>

Expand Down
Loading