From 383ef62603c88fcccd6fc0d8e462e6766492594d Mon Sep 17 00:00:00 2001
From: Andreas Nedbal <git@pixelde.su>
Date: Thu, 27 Jan 2022 20:19:06 +0100
Subject: [PATCH] Translate `ServicesController` views

---
 app/views/services/index.haml      |  6 +++---
 app/views/settings/_services.haml  | 18 +++++++-----------
 config/locales/activerecord.en.yml |  5 +++++
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/app/views/services/index.haml b/app/views/services/index.haml
index e10a1a56..4bc25a21 100644
--- a/app/views/services/index.haml
+++ b/app/views/services/index.haml
@@ -1,4 +1,4 @@
-= render 'settings/services'
+= render "settings/services"
 
-- provide(:title, generate_title('Service Settings'))
-- parent_layout 'user/settings'
+- provide(:title, generate_title(t(".title")))
+- parent_layout "user/settings"
diff --git a/app/views/settings/_services.haml b/app/views/settings/_services.haml
index 9ae17427..726e9da4 100644
--- a/app/views/settings/_services.haml
+++ b/app/views/settings/_services.haml
@@ -1,13 +1,10 @@
 .card
   .card-body
-    - if @services.count.positive?
-      = t 'views.settings.service.enabled'
-    - else
-      = t 'views.settings.service.none'
+    = t(".services", count: @services.count)
 
     - APP_CONFIG['sharing'].each do |service, service_options|
       - if service_options['enabled'] && @services.none? { |x| x.provider == service.to_s }
-        %p= button_to t('views.settings.service.connect', service: service.capitalize), "/auth/#{service}", method: :post, class: 'btn btn-info'
+        %p= button_to t(".connect", service: service.capitalize), "/auth/#{service}", method: :post, class: 'btn btn-info'
 
   - if @services.count.positive?
     %ul.list-group
@@ -16,15 +13,14 @@
           %i{ class: "fa fa-#{service.provider}" }
           %strong= service.provider.capitalize
           (#{service.nickname})
-          = button_to t('views.settings.service.disconnect'),
+          = button_to t(".disconnect"),
             service_path(service),
-            data: { confirm: t('views.settings.service.confirm', service: service.provider.capitalize) },
+            data: { confirm: t(".confirm", service: service.provider.capitalize) },
             method: :delete,
             class: 'btn btn-link',
             form: { class: 'd-inline' }
 
           .col-md-6.mt-2
-            = bootstrap_form_for(service, as: 'service', url: update_service_path(service)) do |f|
-              = f.text_field :post_tag, class: 'form-control', label: 'tag', label_as_placeholder: true,
-                append: f.submit('Update', class: 'btn btn-primary'), maxlength: 20, pattern: '^[^@]*$',
-                help: "Automatically append a tag to your shared answers. #{'A # symbol is not automatically prepended.' if service.provider == 'twitter'}"
+            = bootstrap_form_for(service, url: update_service_path(service)) do |f|
+              = f.text_field :post_tag, label_as_placeholder: true,
+                append: f.submit(t("voc.update"), class: 'btn btn-primary'), maxlength: 20, pattern: "^[^@]*$"
diff --git a/config/locales/activerecord.en.yml b/config/locales/activerecord.en.yml
index c4f19a83..2de74dc6 100644
--- a/config/locales/activerecord.en.yml
+++ b/config/locales/activerecord.en.yml
@@ -11,3 +11,8 @@ en:
         link_text: "Link text"
         starts_at: "Start time"
         ends_at: "End time"
+      service:
+        post_tag: "Tag"
+    help:
+      services/twitter:
+        post_tag: "Automatically append a tag to your shared answers. A # symbol is not automatically prepended."