From 40043a0766782df7db8a64a1e3148e41a13ce38f Mon Sep 17 00:00:00 2001
From: Brandon Labuschagne <blabuschagne@gitlab.com>
Date: Tue, 30 Apr 2019 23:01:23 +0000
Subject: [PATCH] Internationalisation of protected_tags directory

This is one of many MRs opened in order to improve the overall
internationalisation of the GitLab codebase.

i18n documentation
https://docs.gitlab.com/ee/development/i18n/externalization.html
---
 .../protected_tags/protected_tag_access_dropdown.js        | 4 +++-
 .../javascripts/protected_tags/protected_tag_create.js     | 3 ++-
 .../javascripts/protected_tags/protected_tag_edit.js       | 7 ++++++-
 locale/gitlab.pot                                          | 6 ++++++
 4 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/app/assets/javascripts/protected_tags/protected_tag_access_dropdown.js b/app/assets/javascripts/protected_tags/protected_tag_access_dropdown.js
index b803da798d599..def2f091947c7 100644
--- a/app/assets/javascripts/protected_tags/protected_tag_access_dropdown.js
+++ b/app/assets/javascripts/protected_tags/protected_tag_access_dropdown.js
@@ -1,3 +1,5 @@
+import { __ } from '~/locale';
+
 export default class ProtectedTagAccessDropdown {
   constructor(options) {
     this.options = options;
@@ -15,7 +17,7 @@ export default class ProtectedTagAccessDropdown {
         if ($el.is('.is-active')) {
           return item.text;
         }
-        return 'Select';
+        return __('Select');
       },
       clicked(options) {
         options.e.preventDefault();
diff --git a/app/assets/javascripts/protected_tags/protected_tag_create.js b/app/assets/javascripts/protected_tags/protected_tag_create.js
index fddf2674cbb62..03a5fe6b3531c 100644
--- a/app/assets/javascripts/protected_tags/protected_tag_create.js
+++ b/app/assets/javascripts/protected_tags/protected_tag_create.js
@@ -1,6 +1,7 @@
 import $ from 'jquery';
 import ProtectedTagAccessDropdown from './protected_tag_access_dropdown';
 import CreateItemDropdown from '../create_item_dropdown';
+import { __ } from '~/locale';
 
 export default class ProtectedTagCreate {
   constructor() {
@@ -27,7 +28,7 @@ export default class ProtectedTagCreate {
     // Protected tag dropdown
     this.createItemDropdown = new CreateItemDropdown({
       $dropdown: this.$form.find('.js-protected-tag-select'),
-      defaultToggleLabel: 'Protected Tag',
+      defaultToggleLabel: __('Protected Tag'),
       fieldName: 'protected_tag[name]',
       onSelect: this.onSelectCallback,
       getData: ProtectedTagCreate.getProtectedTags,
diff --git a/app/assets/javascripts/protected_tags/protected_tag_edit.js b/app/assets/javascripts/protected_tags/protected_tag_edit.js
index c52497e62f26e..70bfd71abcebb 100644
--- a/app/assets/javascripts/protected_tags/protected_tag_edit.js
+++ b/app/assets/javascripts/protected_tags/protected_tag_edit.js
@@ -1,6 +1,7 @@
 import flash from '../flash';
 import axios from '../lib/utils/axios_utils';
 import ProtectedTagAccessDropdown from './protected_tag_access_dropdown';
+import { __ } from '~/locale';
 
 export default class ProtectedTagEdit {
   constructor(options) {
@@ -47,7 +48,11 @@ export default class ProtectedTagEdit {
       .catch(() => {
         this.$allowedToCreateDropdownButton.enable();
 
-        flash('Failed to update tag!', 'alert', document.querySelector('.js-protected-tags-list'));
+        flash(
+          __('Failed to update tag!'),
+          'alert',
+          document.querySelector('.js-protected-tags-list'),
+        );
       });
   }
 }
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 7b5770a607516..b97511eea7308 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -4036,6 +4036,9 @@ msgstr ""
 msgid "Failed to update issues, please try again."
 msgstr ""
 
+msgid "Failed to update tag!"
+msgstr ""
+
 msgid "Failed to update."
 msgstr ""
 
@@ -7402,6 +7405,9 @@ msgstr ""
 msgid "Protected"
 msgstr ""
 
+msgid "Protected Tag"
+msgstr ""
+
 msgid "Protip:"
 msgstr ""
 
-- 
GitLab