From 8fa94397cce4eb5107f43b1bf4bbea5f838fdc43 Mon Sep 17 00:00:00 2001 From: Thomas Randolph Date: Tue, 27 Oct 2020 10:40:50 -0600 Subject: [PATCH] Pull all translations out to the Diffs i18n file --- .../diffs/components/diff_file.vue | 23 +++++++++++-------- app/assets/javascripts/diffs/i18n.js | 13 +++++++++++ 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/diffs/components/diff_file.vue b/app/assets/javascripts/diffs/components/diff_file.vue index 0d5181d5720ee4..564d64c38c426c 100644 --- a/app/assets/javascripts/diffs/components/diff_file.vue +++ b/app/assets/javascripts/diffs/components/diff_file.vue @@ -3,7 +3,7 @@ import { mapActions, mapGetters, mapState } from 'vuex'; import { escape } from 'lodash'; import { GlLoadingIcon, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import { __, sprintf } from '~/locale'; +import { sprintf } from '~/locale'; import { deprecatedCreateFlash as createFlash } from '~/flash'; import { hasDiff } from '~/helpers/diffs_helper'; import eventHub from '../../notes/event_hub'; @@ -12,6 +12,7 @@ import DiffContent from './diff_content.vue'; import { diffViewerErrors } from '~/ide/constants'; import { collapsedType, isCollapsed } from '../diff_file'; import { DIFF_FILE_AUTOMATIC_COLLAPSE, DIFF_FILE_MANUAL_COLLAPSE } from '../constants'; +import { DIFF_FILE, GENERIC_ERROR } from '../i18n'; export default { components: { @@ -49,13 +50,17 @@ export default { isCollapsed: isCollapsed(this.file), }; }, + i18n: { + ...DIFF_FILE, + genericError: GENERIC_ERROR, + }, computed: { ...mapState('diffs', ['currentDiffFileId']), ...mapGetters(['isNotesFetched']), ...mapGetters('diffs', ['getDiffFileDiscussions']), viewBlobLink() { return sprintf( - __('You can %{linkStart}view the blob%{linkEnd} instead.'), + this.$options.i18n.blobView, { linkStart: ``, linkEnd: '', @@ -77,9 +82,7 @@ export default { }, forkMessage() { return sprintf( - __( - "You're not allowed to %{tag_start}edit%{tag_end} files in this project directly. Please fork this project, make your changes there, and submit a merge request.", - ), + this.$options.i18n.editInFork, { tag_start: '', tag_end: '', @@ -187,7 +190,7 @@ export default { }) .catch(() => { this.isLoadingCollapsedDiff = false; - createFlash(__('Something went wrong on our end. Please try again!')); + createFlash(this.$options.i18n.genericError); }); }, showForkMessage() { @@ -229,14 +232,14 @@ export default { {{ __('Fork') }}{{ $options.i18n.fork }}