From 482825309317f382cff656b6378353039da0408a Mon Sep 17 00:00:00 2001
From: syeopite <syeopite@syeopite.dev>
Date: Fri, 16 Jul 2021 13:32:56 -0700
Subject: [PATCH] Update 2fa locales to use _ instead of -

---
 locales/en-US.json                        | 25 +++++++++++------------
 src/invidious/views/user/preferences.ecr  |  2 +-
 src/invidious/views/user/remove_2fa.ecr   |  4 ++--
 src/invidious/views/user/setup_2fa.ecr    | 16 +++++++--------
 src/invidious/views/user/validate_2fa.ecr |  8 ++++----
 5 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/locales/en-US.json b/locales/en-US.json
index b3eb8d18..4f57abff 100644
--- a/locales/en-US.json
+++ b/locales/en-US.json
@@ -485,16 +485,15 @@
     "channel_tab_playlists_label": "Playlists",
     "channel_tab_community_label": "Community",
     "channel_tab_channels_label": "Channels",
-    "setup-totp-form-header": "Setup two factor authenticiation (TOTP)",
-    "setup-totp-instructions-download-auth": "Install an authenticator app (or anything that supports totp) on your device",
-    "setup-totp-instructions-enter-code": "Enter the following <strong>secret</strong> code:",
-    "setup-totp-instructions-validate-code": "Enter the 6 digit number on your screen. Be sure to do it under thirty seconds!",
-    "setup-totp-submit-button": "Setup TOTP",
-    "general-totp-empty-field": "The TOTP code is a required field",
-    "general-totp-invalid-code": "The TOTP code entered is invalid",
-    "general-totp-enter-code-field": "6 digit number",
-    "general-totp-enter-code-header": "Two-factor authentication",
-    "general-totp-verify-button": "Verify",
-    "remove-totp-header": "Remove two-factor authentication",
-    "remove-totp-confirm-message": "Are you sure you would like to remove two-factor-authentication?"
-}
+    "setup_totp_form_header": "Setup two factor authenticiation (TOTP)",
+    "setup_totp_instructions_download_auth": "Install an authenticator app (or anything that supports totp) on your device",
+    "setup_totp_instructions_enter_code": "Enter the following <strong>secret</strong> code:",
+    "setup_totp_instructions_validate_code": "Enter the 6 digit number on your screen. Be sure to do it under thirty seconds!",
+    "setup_totp_submit_button": "Setup TOTP",
+    "general_totp_empty_field": "The TOTP code is a required field",
+    "general_totp_invalid_code": "The TOTP code entered is invalid",
+    "general_totp_enter_code_field": "6 digit number",
+    "general_totp_enter_code_header": "Two-factor authentication",
+    "general_totp_verify_button": "Verify",
+    "remove_totp_header": "Remove two-factor authentication",
+    "remove_totp_confirm_message": "Are you sure you would like to remove two-factor-authentication?"}
diff --git a/src/invidious/views/user/preferences.ecr b/src/invidious/views/user/preferences.ecr
index a0f77dbf..3ad38f0e 100644
--- a/src/invidious/views/user/preferences.ecr
+++ b/src/invidious/views/user/preferences.ecr
@@ -346,7 +346,7 @@
                 </div>
 
                 <div class="pure-control-group">
-                    <a href="/setup_2fa?referer=<%= URI.encode_www_form(referer) %>"><%= translate(locale, "setup-totp-form-header") %></a>
+                    <a href="/setup_2fa?referer=<%= URI.encode_www_form(referer) %>"><%= translate(locale, "setup_totp_form_header") %></a>
                 </div>
 
                 <div class="pure-control-group">
diff --git a/src/invidious/views/user/remove_2fa.ecr b/src/invidious/views/user/remove_2fa.ecr
index 47f92263..540b99d2 100644
--- a/src/invidious/views/user/remove_2fa.ecr
+++ b/src/invidious/views/user/remove_2fa.ecr
@@ -1,10 +1,10 @@
 <% content_for "header" do %>
-<title><%= translate(locale, "remove-totp-header") %> - Invidious</title>
+<title><%= translate(locale, "remove_totp_header") %> - Invidious</title>
 <% end %>
 
 <div class="h-box">
     <form class="pure-form pure-form-aligned" action="/remove_2fa?referer=<%= URI.encode_www_form(referer) %>" method="post">
-        <legend><%= translate(locale, "remove-totp-confirm-message") %></legend>
+        <legend><%= translate(locale, "remove_totp_confirm_message") %></legend>
 
         <div class="pure-g">
             <div class="pure-u-1-2">
diff --git a/src/invidious/views/user/setup_2fa.ecr b/src/invidious/views/user/setup_2fa.ecr
index a22e5f0b..deafe7ca 100644
--- a/src/invidious/views/user/setup_2fa.ecr
+++ b/src/invidious/views/user/setup_2fa.ecr
@@ -1,5 +1,5 @@
 <% content_for "header" do %>
-<title><%= translate(locale, "setup-totp-form-header") %> - Invidious</title>
+<title><%= translate(locale, "setup_totp_form_header") %> - Invidious</title>
 <% end %>
 
 <div class="pure-g">
@@ -7,25 +7,25 @@
     <div class="pure-u-1 pure-u-lg-3-5">
         <div class="h-box">
             <form class="pure-form pure-form-aligned" action="/setup_2fa?referer=<%= URI.encode_www_form(referer) %>" method="post">
-                <legend><%= translate(locale, "setup-totp-form-header") %></legend>
+                <legend><%= translate(locale, "setup_totp_form_header") %></legend>
                 <fieldset>
 
                 <input name="db_secret" type="hidden" value="<%= HTML.escape(db_secret) %>">
 
                 <ol style="word-wrap: anywhere; white-space: break-space;">
-                    <li> <%= translate(locale, "setup-totp-instructions-download-auth") %> </li>
-                    <li> <%= translate(locale, "setup-totp-instructions-enter-code") %> 
+                    <li> <%= translate(locale, "setup_totp_instructions_download_auth") %> </li>
+                    <li> <%= translate(locale, "setup_totp_instructions_enter_code") %> 
                     <code> <%=user_secret%> </code>
                     </li>
-                    <li> <%= translate(locale, "setup-totp-instructions-validate-code") %> </li>
+                    <li> <%= translate(locale, "setup_totp_instructions_validate_code") %> </li>
                 </ol>
 
-                <input required class="pure-input-1" name="totp_code" placeholder="<%= translate(locale, "general-totp-enter-code-field") %>">
+                <input required class="pure-input-1" name="totp_code" placeholder="<%= translate(locale, "general_totp_enter_code_field") %>">
 
                 <input type="hidden" name="csrf_token" value="<%= URI.encode_www_form(csrf_token) %>">
 
-                <button type="submit" name="action" value="setup-totp-form-header" class="pure-button pure-button-primary">
-                    <%= translate(locale, "setup-totp-submit-button") %>
+                <button type="submit" name="action" value="setup_totp_form_header" class="pure-button pure-button-primary">
+                    <%= translate(locale, "setup_totp_submit_button") %>
                 </button>
 
                 </fieldset>
diff --git a/src/invidious/views/user/validate_2fa.ecr b/src/invidious/views/user/validate_2fa.ecr
index 3e477689..9d2b5d0b 100644
--- a/src/invidious/views/user/validate_2fa.ecr
+++ b/src/invidious/views/user/validate_2fa.ecr
@@ -1,5 +1,5 @@
 <% content_for "header" do %>
-<title><%= translate(locale, "setup-totp-form-header") %> - Invidious</title>
+<title><%= translate(locale, "setup_totp_form_header") %> - Invidious</title>
 <% end %>
 
 <div class="pure-g">
@@ -7,7 +7,7 @@
     <div class="pure-u-1 pure-u-lg-3-5">
         <div class="h-box">
             <form class="pure-form pure-form-aligned" action="/validate_2fa?referer=<%= URI.encode_www_form(referer) %>" method="post">
-                <legend><%= translate(locale, "general-totp-enter-code-header") %></legend>
+                <legend><%= translate(locale, "general_totp_enter_code_header") %></legend>
                 <fieldset>
                 
                 <!-- Hidden fields used for sign-in authentication-->
@@ -18,7 +18,7 @@
                     <input name="password" type="hidden" value="<%= HTML.escape(password) %>">
                 <% end %>
 
-                <input required class="pure-input-1" name="totp_code" placeholder="<%= translate(locale, "general-totp-enter-code-field") %>">
+                <input required class="pure-input-1" name="totp_code" placeholder="<%= translate(locale, "general_totp_enter_code_field") %>">
 
                 <% if csrf_token %>
                     <input type="hidden" name="csrf_token" value="<%= URI.encode_www_form(csrf_token) %>">
@@ -26,7 +26,7 @@
 
 
                 <button type="submit" name="action" class="pure-button pure-button-primary">
-                    <%= translate(locale, "general-totp-verify-button") %>
+                    <%= translate(locale, "general_totp_verify_button") %>
                 </button>
 
                 </fieldset>