From 647b9b91ca572a7488f6c1806687f05c40c7c60a Mon Sep 17 00:00:00 2001 From: Arend Peter Date: Sat, 21 Dec 2024 20:56:51 -0800 Subject: [PATCH] Add portugese override --- .../Results/components/HeadToHeadWidget.tsx | 1 + .../Results/components/VoterProfileWidget.tsx | 1 + packages/frontend/src/i18n/en.yaml | 5 +- packages/frontend/src/i18n/i18n.ts | 6 +- packages/frontend/src/i18n/pt-BR.yaml | 332 ++++++++++++++++++ 5 files changed, 342 insertions(+), 3 deletions(-) create mode 100644 packages/frontend/src/i18n/pt-BR.yaml diff --git a/packages/frontend/src/components/Election/Results/components/HeadToHeadWidget.tsx b/packages/frontend/src/components/Election/Results/components/HeadToHeadWidget.tsx index 737a5af0..47c57a74 100644 --- a/packages/frontend/src/components/Election/Results/components/HeadToHeadWidget.tsx +++ b/packages/frontend/src/components/Election/Results/components/HeadToHeadWidget.tsx @@ -38,6 +38,7 @@ export default ({candidates=[], ranked=false} : {candidates?: Candidate[], ranke }); const incIndex = (arr, index) => { + if(index < 0) return; // Quick Hack to keep the page from crashing while(index >= arr.length ){ arr.push({ name: arr.length, diff --git a/packages/frontend/src/components/Election/Results/components/VoterProfileWidget.tsx b/packages/frontend/src/components/Election/Results/components/VoterProfileWidget.tsx index 313d6352..a31a10f6 100644 --- a/packages/frontend/src/components/Election/Results/components/VoterProfileWidget.tsx +++ b/packages/frontend/src/components/Election/Results/components/VoterProfileWidget.tsx @@ -29,6 +29,7 @@ export default ({topScore, frontRunners, ranked=false, candidates=undefined} : { const equalPreferences = []; const incIndex = (arr, index) => { + if(index < 0) return; // Quick Hack to keep the page from crashing while(index >= arr.length ){ arr.push({ name: arr.length, diff --git a/packages/frontend/src/i18n/en.yaml b/packages/frontend/src/i18n/en.yaml index 01d8a41c..d2f281a4 100644 --- a/packages/frontend/src/i18n/en.yaml +++ b/packages/frontend/src/i18n/en.yaml @@ -176,6 +176,7 @@ number: rank_ordinal_few: "{{count}}rd" rank_ordinal_other: "{{count}}th" +# Results Example: bettervoting.com/tcvc7r/results results: preliminary_title: PRELIMINARY RESULTS official_title: OFFICIAL RESULTS @@ -512,7 +513,7 @@ landing_page: #### PRIORITY 3 : Extended Results #### ####################################### -# Results page +# Results page (ex. bettervoting.com/tcvc7r/results) results_ext: head_to_head_title: Head-to-Head Matchups !tip(head_to_head) @@ -606,7 +607,7 @@ tabulation_logs: # Automatic runoff automatic_runoff_start: > - Advance to automatic runoff round between {{capital_candidate_a}} and {{candidate_b}} + Advance to automatic runoff round between {{candidate_a}} and {{candidate_b}} automatic_runoff_win: > {{winner}} is preferred over {{loser}} by {{winner_votes}} votes to {{loser_votes}}, and {{equal_votes}} voters have an [equal preference](https://www.starvoting.org/equal_preference). automatic_runoff_tie: > diff --git a/packages/frontend/src/i18n/i18n.ts b/packages/frontend/src/i18n/i18n.ts index 7a805258..9be049ba 100644 --- a/packages/frontend/src/i18n/i18n.ts +++ b/packages/frontend/src/i18n/i18n.ts @@ -3,11 +3,12 @@ import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; import LanguageDetector from 'i18next-browser-languagedetector'; import en from './en.yaml'; +import ptBR from './pt-BR.yaml'; i18n // detect user language // learn more: https://github.com/i18next/i18next-browser-languageDetector - //.use(LanguageDetector) + .use(LanguageDetector) // pass the i18n instance to react-i18next. .use(initReactI18next) // init i18next @@ -26,6 +27,9 @@ i18n en: { translation: en }, + 'pt-BR': { + translation: ptBR + } } }); diff --git a/packages/frontend/src/i18n/pt-BR.yaml b/packages/frontend/src/i18n/pt-BR.yaml new file mode 100644 index 00000000..e0bdfb6d --- /dev/null +++ b/packages/frontend/src/i18n/pt-BR.yaml @@ -0,0 +1,332 @@ +####################################################### +#### PRIORITY 0 : Core Voting Path + Basic Results #### +####################################################### + +# Initial Landing page for voter (ex. https://bettervoting.com/j87vqp/) +election_home: + start_time: '{{capital_election}} begins on {{datetime, datetime}}' + end_time: '{{capital_election}} ends on {{datetime, datetime}}' + ended_time: '{{capital_election}} ended on {{datetime, datetime}}' + vote: Vote + or_view_results: or view results + ballot_submitted: '{{capital_ballot}} Submitted' + view_results: Ver Resultados + drafted: This election is still being drafted + archived: This election has been archived + +# Ballot (ex. https://bettervoting.com/j87vqp/vote) +ballot: + this_election_uses: This {{election}} will use {{voting_method}} to elect {{spelled_count}} $t(winner.winner). + instructions_checkbox: I have read the instructions + learn_more: Learn more about {{voting_method}} + previous: Previous + next: Next + submit_ballot: Submit + submitting: Submitting... + + dialog_submit_title: Submit {{capital_ballot}}? + dialog_send_receipt: Send Ballot Receipt Email? + dialog_email_placeholder: Receipt Email + dialog_cancel: Cancel + dialog_submit: Submit + warnings: + skipped_rank: Do not skip rankings. Rank candidates in order to clearly show preferences. Candidates left blank are ranked last. + duplicate_rank: Do not rank multiple candidates equally. (Ranking candidates equally can void your ballot.) + + methods: + approval: + instruction_bullets: + - Fill in the bubble next to your favorite + - You can select as many {{candidates}} as you like + footer_single_winner: The {{candidate}} with the most votes wins + footer_multi_winner: The {{n}} {{candidates}} with the most votes wins + left_title: '' + right_title: '' + heading_prefix: '' + star_pr: + instruction_bullets: + - Give your favorite(s) five stars. + - Give your last choice(s) zero stars or leave blank. + - Score other {{candidates}} as desired. + - Equal scores indicate equal preference. + footer_single_winner: '' + footer_multi_winner: > + Winners in Proportional STAR Voting are selected in rounds. Each round elects the {{candidate}} with the highest total score, + then designates that {{candidate}}'s strongest supporters as represented. Subsequent rounds include all voters who are not yet + fully represented. + # These show above the star columns + left_title: 'Worst' + right_title: 'Best' + star: + instruction_bullets: + - Give your favorite(s) five stars. + - Give your last choice(s) zero stars or leave blank. + - Score other {{candidates}} as desired. + - Equal scores indicate equal preference. + footer_single_winner: | + The two highest scoring {{candidates}} are finalists. + Your full vote goes to the finalist you prefer. + footer_multi_winner: > + This election uses STAR Voting and will elect {{n}} winners. + In STAR Voting the two highest scoring {{candidates}} are finalists and the finalist preferred by more voters wins. + # These show above the star columns + left_title: 'Worst' + right_title: 'Best' + rcv: + instruction_bullets: + - Rank the {{candidates}} in order of preference. (1st, 2nd, 3rd, etc.) + - Ranking {{candidates}} equally is not allowed. + - '{{capital_candidates}} left blank are ranked last' + footer_single_winner: > + How RCV is counted: Ballots are counted in elimination rounds. In each round, your vote goes to the candidate you ranked highest, + if possible. If no candidate has a majority of remaining votes the candidate with the fewest votes is eliminated. + If your vote is unable to transfer, it will not be counted in later rounds. If a candidate has a majority of remaining votes + in a round, they are elected. + left_title: '' + right_title: '' + ranked_robin: + instruction_bullets: + - Rank the {{candidates}} in order of preference. + - Equal ranks are allowed + - '{{capital_candidates}} left blank are ranked last' + footer_single_winner: | + {{capital_candidates}} are compared in one-on-one match-ups. + A {{candidate}} wins a match-up if they are ranked higher than the opponent by more voters + left_title: '' + right_title: '' + choose_one: + instruction_bullets: + - Fill in the bubble next to your favorite + footer_single_winner: The {{candidate}} with the most votes wins + footer_multi_winner: The {{n}} {{candidates}} with the most votes win + left_title: '' + right_title: '' + +# Displayed at the bottom of voter pages (ex. https://bettervoting.com/j87vqp/) +support_blurb: For support on this {{election}} please contact [{{email}}](mailto) + +# Share Button dropdown (ex. https://bettervoting.com/pres24/thanks) +share: + button: Share {{capital_election}} + facebook: Facebook + X: X + reddit: Reddit + copy_link: Copy Link + link_copied: Link Copied! + +# Number translations (used for {{spelled_count}}) +spelled_numbers: + 1: one + 2: two + 3: three + 4: four + 5: five + 6: six + 7: seven + 8: eight + 9: nine + 10: ten + +# Winner pluralization +winner: + winner_one: winner + winner_other: winners + +methods: + star: + full_name: STAR Voting + short_name: STAR Voting + learn_link: https://www.youtube.com/watch?v=fKg0fRL88zc + star_pr: + full_name: Proportional STAR Voting + short_name: STAR PR + learn_link: https://www.starvoting.org/star-pr + approval: + full_name: Approval Voting + short_name: Approval Voting + learn_link: https://www.youtube.com/watch?v=db6Syys2fmE + rcv: + full_name: Ranked Choice Voting + short_name: RCV + learn_link: https://www.youtube.com/watch?v=oHRPMJmzBBw + stv: + full_name: Single Transferable Vote + short_name: STV + learn_link: https://www.youtube.com/watch?v=ItywbxafCk4 + ranked_robin: + full_name: Ranked Robin + short_name: Ranked Robin + learn_link: https://www.equal.vote/ranked_robin + choose_one: + full_name: Choose One Plurality + short_name: Choose One + +# Confirmation (after you've submitted a ballot) +ballot_submitted: + title: '{{capital_ballot}} Submitted' + description: Thank you for voting! + results: Results + donate: Donate to Equal Vote to support open source voting software + end_time: '{{capital_election}} ends {{date}} at {{time}}' + +# Localisation for numbers +number: + rank_ordinal_one: "{{count}}st" + rank_ordinal_two: "{{count}}nd" + rank_ordinal_few: "{{count}}rd" + rank_ordinal_other: "{{count}}th" + +# Results Example: bettervoting.com/tcvc7r/results +results: + preliminary_title: PRELIMINARY RESULTS + official_title: OFFICIAL RESULTS + election_title: | + {{capital_election}} Name: + {{title}} + race_title: '{{capital_race}} {{n}}: {{title}}' + single_candidate_result: '{{name}} is the only {{candidate}}, and wins by default' + loading_election: Loading {{capital_election}}... + details: Race Details + additional_info: Stats for Nerds + waiting_for_results: | + Still waiting for results + No votes have been cast + single_vote: | + There's only one vote so far. + Full results will be displayed once there's more votes. + tie_title: 'Tied!' + tiebreak_subtitle: '{{names}} won after tie breaker' + win_title_postfix_one: 'Wins!' + win_title_postfix: 'Win!' + vote_count: '{{n}} voters' + method_context: 'Voting Method: {{voting_method}}' + learn_link_text: How {{voting_method}} works + + choose_one: + bar_title: Votes for each {{capital_candidate}} + table_title: Table + table_columns: + - '{{capital_candidate}}' + - Votes + - '% All Votes' + + approval: + bar_title: Candidate Approval + table_title: Table + table_columns: + - '{{capital_candidate}}' + - Votes + - '% All Votes' + + ranked_robin: + bar_title: Head-to-head wins + table_title: Table + table_columns: + - '{{capital_candidate}}' + - '# Wins' + - Win Rate + + rcv: + first_choice_title: First Choice Preferences + final_round_title: Final Runoff + table_title: Ranked Choice Tabulation Rounds + runoff_majority: majority of remaining active votes + exhausted: Exhausted + tabulation_candidate_column: '{{capital_candidate}}' + round_column: Round {{n}} + + star: + score_title: Scoring Round + score_description: + - Add the stars from all the ballots. + - The two highest scoring {{candidates}} are the finalists. + runoff_title: Automatic Runoff Round + runoff_description: + - Each vote goes to the voter's preferred finalist. + - Finalist with most votes wins. + runoff_majority: majority of voters with preference + score_table_title: Scores Table + score_table_columns: + - '{{capital_candidate}}' + - Score + runoff_table_title: Runoff Table + runoff_table_columns: + - '{{capital_candidate}}' + - Runoff Votes + - '% Runoff Votes' + - '% Between Finalists' + + detailed_steps_title: Tabulation Steps + tiebreaker_note_title: A note on Tiebreakers + tiebreaker_note_text: + - Ties are broken using the [Offical Tiebreaker Protocol](https://starvoting.org/ties) whenever possible. + - Ties are 10 times less likely to occur with STAR Voting than with Choose-One Voting and generally resolve as the number of voters increases. + equal_preferences_title: Distribution of Equal Preferences + equal_preferences: Equal Preferences + score_higher_than_runoff_title: Why is the top scoring candidate different from the winner? + score_higher_than_runoff_text: | + The top-scoring candidate often matches the runoff winner, but not always. + In the runoff, only the most preferred votes count, which can shift the outcome. + For example, a 5 vs. 4-star vote has less impact in scoring but counts fully in the runoff, + while a 5 vs. 0-star vote makes a big difference in scoring but is equal in the runoff. + The runoff winner comes out on top because more voters prefer them over the runner-up. + # Alternate Text: + # The top-scoring candidate usually matches the winner in the runoff, but not always. + # The runoff round counts only the votes for the candidate a voter most prefers, which can lead to different weightings than in the scoring round. + # For example, a slight preference (like 5 vs. 4 stars) has a small impact in scoring but counts as one full vote in the runoff. + # Conversely, a strong preference (like 5 vs. 0 stars) makes a big difference in scoring but carries the same weight in the runoff. + # Ultimately, the runoff winner becomes the final winner because they are preferred by more voters over the runner-up. + + star_pr: + chart_title: Round Results + table_title: Results Table + table_columns: + - '{{capital_candidate}}' + round_column: Round {{n}} + +keyword: + # Method Terms + star: + preferences: scores + star_pr: + preferences: scores + approval: + preferences: approvals + rcv: + preferences: ranks + stv: + preferences: ranks + ranked_robin: + preferences: ranks + choose_one: + preferences: preferences + + # Election vs Poll Terms + election: + election: election + elections: elections + candidate: candidate + candidates: candidates + race: race + ballot: ballot + vote: vote + + poll: + election: poll + elections: polls + candidate: option + candidates: options + race: question + ballot: response + vote: response + + # General Terms + yes: Yes + no: No + + save: Save + cancel: Cancel + submit: Submit + + # This is used in tables and charts + total: Total \ No newline at end of file