From c72f8fdaf2f51f653510fde54a1e8f2c98eeeb82 Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Fri, 8 Sep 2023 13:14:03 -0700 Subject: [PATCH] translate characters allowed and remaining --- app/views/components/forms/edit/_builder.html.erb | 10 ++++++---- .../forms/question_types/_text_field.html.erb | 3 ++- app/views/components/widget/_fba.js.erb | 4 ++-- config/locales/en.yml | 2 ++ config/locales/es.yml | 2 ++ config/locales/zh-CN.yml | 2 ++ 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/views/components/forms/edit/_builder.html.erb b/app/views/components/forms/edit/_builder.html.erb index 90cdee03b..6973fdecd 100644 --- a/app/views/components/forms/edit/_builder.html.erb +++ b/app/views/components/forms/edit/_builder.html.erb @@ -26,7 +26,8 @@ saved - <%= @instruction_text_limit %> characters allowed + <%= @instruction_text_limit %> + <%= t :characters_allowed %>
@@ -61,7 +62,8 @@ saved - <%= @disclaimer_text_limit %> characters allowed + <%= @disclaimer_text_limit %> + <%= t :characters_allowed %>
<%= form.disclaimer_text.present? ? sanitize(form.disclaimer_text) : 'Survey Disclaimer Text' %>

@@ -343,10 +345,10 @@ function textCounter(field,maxlimit) { var countfield = field.parentNode.querySelector(".counter-msg"); if ( field.value.length > maxlimit ) { field.value = field.value.substring( 0, maxlimit ); - countfield.innerText = '0 characters left'; + countfield.innerText = '0 <%= t :characters_left %>'; return false; } else { - countfield.innerText = "" + (maxlimit - field.value.length) + " characters left"; + countfield.innerText = "" + (maxlimit - field.value.length) + " <%= t :characters_left %>"; } } diff --git a/app/views/components/forms/question_types/_text_field.html.erb b/app/views/components/forms/question_types/_text_field.html.erb index f683de346..c248b0e67 100644 --- a/app/views/components/forms/question_types/_text_field.html.erb +++ b/app/views/components/forms/question_types/_text_field.html.erb @@ -24,7 +24,8 @@ end <% if question.character_limit && question.character_limit > 0 %> - <%= question.max_length %> characters allowed + <%= question.max_length %> + <%= t :characters_allowed %> <% end %> diff --git a/app/views/components/widget/_fba.js.erb b/app/views/components/widget/_fba.js.erb index f738c5069..7c061f5ef 100644 --- a/app/views/components/widget/_fba.js.erb +++ b/app/views/components/widget/_fba.js.erb @@ -362,10 +362,10 @@ function FBAform(d, N) { var countfield = field.parentNode.querySelector(".counter-msg"); if ( field.value.length > maxlimit ) { field.value = field.value.substring( 0, maxlimit ); - countfield.innerText = '0 characters left'; + countfield.innerText = '0 <%= t :characters_left %>'; return false; } else { - countfield.innerText = "" + (maxlimit - field.value.length) + " characters left"; + countfield.innerText = "" + (maxlimit - field.value.length) + " <%= t :characters_left %>"; } }, loadButton: function() diff --git a/config/locales/en.yml b/config/locales/en.yml index c93c5731d..500f93346 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -135,6 +135,8 @@ en-US: "yes": "yes" "no": "no" the_feedback_and_analytics_team: " the Feedback and Analytics Team" + characters_allowed: "characters allowed" + characters_left: "characters left" form: submit: "Submit" submit_thankyou: "Thank you. Your feedback has been received." diff --git a/config/locales/es.yml b/config/locales/es.yml index e24553a2f..04331cd21 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -23,6 +23,8 @@ es: sign_in_text: Touchpoints usa Login.gov para manejar cuentas de usuario. Una vez que se autentique con Login.gov, se iniciará sesión y se le redirigirá a Touchpoints. sign_in_with: Inicia sesión con if_github: Si tiene una cuenta de GitHub, + characters_allowed: "caracteres permitidos" + characters_left: "caracteres restantes" form: submit: "Enviar" submit_thankyou: "Gracias. Su comentario ha sido recibido." diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 28ef14495..740b29950 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -43,6 +43,8 @@ zh-CN: sign_in_text: Touchpoints 使用 Login.gov 来处理用户帐户。使用 Login.gov 进行身份验证后,您将登录并重定向回 Touchpoints。 sign_in_with: 登陆使用 if_github: 如果您有 GitHub 帐户, + characters_allowed: "允许的字符" + characters_left: "剩余字符数" form: submit: "提交" submit_thankyou: "谢谢. 已收到您的反馈."