Internationalisation of diff_note 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
This commit is contained in:
Brandon Labuschagne 2019-05-02 13:53:44 +00:00 committed by Phil Hughes
parent 3cfac9b00d
commit 25dac80988
7 changed files with 50 additions and 14 deletions

View file

@ -3,6 +3,7 @@
import $ from 'jquery'; import $ from 'jquery';
import Vue from 'vue'; import Vue from 'vue';
import { __ } from '~/locale';
const CommentAndResolveBtn = Vue.extend({ const CommentAndResolveBtn = Vue.extend({
props: { props: {
@ -31,15 +32,15 @@ const CommentAndResolveBtn = Vue.extend({
buttonText: function() { buttonText: function() {
if (this.isDiscussionResolved) { if (this.isDiscussionResolved) {
if (this.textareaIsEmpty) { if (this.textareaIsEmpty) {
return 'Unresolve discussion'; return __('Unresolve discussion');
} else { } else {
return 'Comment & unresolve discussion'; return __('Comment & unresolve discussion');
} }
} else { } else {
if (this.textareaIsEmpty) { if (this.textareaIsEmpty) {
return 'Resolve discussion'; return __('Resolve discussion');
} else { } else {
return 'Comment & resolve discussion'; return __('Comment & resolve discussion');
} }
} }
}, },

View file

@ -5,6 +5,7 @@ import Vue from 'vue';
import collapseIcon from '../icons/collapse_icon.svg'; import collapseIcon from '../icons/collapse_icon.svg';
import Notes from '../../notes'; import Notes from '../../notes';
import userAvatarImage from '../../vue_shared/components/user_avatar/user_avatar_image.vue'; import userAvatarImage from '../../vue_shared/components/user_avatar/user_avatar_image.vue';
import { n__ } from '~/locale';
const DiffNoteAvatars = Vue.extend({ const DiffNoteAvatars = Vue.extend({
components: { components: {
@ -44,7 +45,7 @@ const DiffNoteAvatars = Vue.extend({
if (this.discussion) { if (this.discussion) {
const extra = this.discussion.notesCount() - this.shownAvatars; const extra = this.discussion.notesCount() - this.shownAvatars;
return `${extra} more comment${extra > 1 ? 's' : ''}`; return n__('%d more comment', '%d more comments', extra);
} }
return ''; return '';

View file

@ -3,6 +3,7 @@
import $ from 'jquery'; import $ from 'jquery';
import Vue from 'vue'; import Vue from 'vue';
import { __ } from '~/locale';
import DiscussionMixins from '../mixins/discussion'; import DiscussionMixins from '../mixins/discussion';
@ -23,9 +24,9 @@ const JumpToDiscussion = Vue.extend({
computed: { computed: {
buttonText: function() { buttonText: function() {
if (this.discussionId) { if (this.discussionId) {
return 'Jump to next unresolved discussion'; return __('Jump to next unresolved discussion');
} else { } else {
return 'Jump to first unresolved discussion'; return __('Jump to first unresolved discussion');
} }
}, },
allResolved: function() { allResolved: function() {

View file

@ -4,6 +4,7 @@
import $ from 'jquery'; import $ from 'jquery';
import Vue from 'vue'; import Vue from 'vue';
import Flash from '../../flash'; import Flash from '../../flash';
import { sprintf, __ } from '~/locale';
const ResolveBtn = Vue.extend({ const ResolveBtn = Vue.extend({
props: { props: {
@ -55,12 +56,14 @@ const ResolveBtn = Vue.extend({
}, },
buttonText() { buttonText() {
if (this.isResolved) { if (this.isResolved) {
return `Resolved by ${this.resolvedByName}`; return sprintf(__('Resolved by %{resolvedByName}'), {
resolvedByName: this.resolvedByName,
});
} else if (this.canResolve) { } else if (this.canResolve) {
return 'Mark as resolved'; return __('Mark as resolved');
} }
return 'Unable to resolve'; return __('Unable to resolve');
}, },
isResolved() { isResolved() {
if (this.note) { if (this.note) {
@ -132,7 +135,8 @@ const ResolveBtn = Vue.extend({
this.updateTooltip(); this.updateTooltip();
}) })
.catch( .catch(
() => new Flash('An error occurred when trying to resolve a comment. Please try again.'), () =>
new Flash(__('An error occurred when trying to resolve a comment. Please try again.')),
); );
}, },
}, },

View file

@ -3,6 +3,7 @@
/* global ResolveService */ /* global ResolveService */
import Vue from 'vue'; import Vue from 'vue';
import { __ } from '~/locale';
const ResolveDiscussionBtn = Vue.extend({ const ResolveDiscussionBtn = Vue.extend({
props: { props: {
@ -41,9 +42,9 @@ const ResolveDiscussionBtn = Vue.extend({
}, },
buttonText: function() { buttonText: function() {
if (this.isDiscussionResolved) { if (this.isDiscussionResolved) {
return 'Unresolve discussion'; return __('Unresolve discussion');
} else { } else {
return 'Resolve discussion'; return __('Resolve discussion');
} }
}, },
loading: function() { loading: function() {

View file

@ -3,6 +3,7 @@
import Vue from 'vue'; import Vue from 'vue';
import Flash from '../../flash'; import Flash from '../../flash';
import '../../vue_shared/vue_resource_interceptor'; import '../../vue_shared/vue_resource_interceptor';
import { __ } from '~/locale';
window.gl = window.gl || {}; window.gl = window.gl || {};
@ -49,7 +50,8 @@ class ResolveServiceClass {
discussion.updateHeadline(data); discussion.updateHeadline(data);
}) })
.catch( .catch(
() => new Flash('An error occurred when trying to resolve a discussion. Please try again.'), () =>
new Flash(__('An error occurred when trying to resolve a discussion. Please try again.')),
); );
} }

View file

@ -84,6 +84,11 @@ msgid_plural "%d metrics"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
msgid "%d more comment"
msgid_plural "%d more comments"
msgstr[0] ""
msgstr[1] ""
msgid "%d staged change" msgid "%d staged change"
msgid_plural "%d staged changes" msgid_plural "%d staged changes"
msgstr[0] "" msgstr[0] ""
@ -818,6 +823,12 @@ msgstr ""
msgid "An error occurred when toggling the notification subscription" msgid "An error occurred when toggling the notification subscription"
msgstr "" msgstr ""
msgid "An error occurred when trying to resolve a comment. Please try again."
msgstr ""
msgid "An error occurred when trying to resolve a discussion. Please try again."
msgstr ""
msgid "An error occurred while detecting host keys" msgid "An error occurred while detecting host keys"
msgstr "" msgstr ""
@ -5251,6 +5262,12 @@ msgstr ""
msgid "July" msgid "July"
msgstr "" msgstr ""
msgid "Jump to first unresolved discussion"
msgstr ""
msgid "Jump to next unresolved discussion"
msgstr ""
msgid "Jun" msgid "Jun"
msgstr "" msgstr ""
@ -5594,6 +5611,9 @@ msgstr ""
msgid "March" msgid "March"
msgstr "" msgstr ""
msgid "Mark as resolved"
msgstr ""
msgid "Mark this issue as a duplicate of another issue" msgid "Mark this issue as a duplicate of another issue"
msgstr "" msgstr ""
@ -7904,6 +7924,9 @@ msgstr ""
msgid "Resolved all discussions." msgid "Resolved all discussions."
msgstr "" msgstr ""
msgid "Resolved by %{resolvedByName}"
msgstr ""
msgid "Response metrics (AWS ELB)" msgid "Response metrics (AWS ELB)"
msgstr "" msgstr ""
@ -10068,6 +10091,9 @@ msgstr ""
msgid "Unable to regenerate public ssh key." msgid "Unable to regenerate public ssh key."
msgstr "" msgstr ""
msgid "Unable to resolve"
msgstr ""
msgid "Unable to schedule a pipeline to run immediately" msgid "Unable to schedule a pipeline to run immediately"
msgstr "" msgstr ""