Commit 205eddc7 authored by Brandon Labuschagne's avatar Brandon Labuschagne Committed by Clement Ho

Internationalisation of notes 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
parent 9178ebb7
import $ from 'jquery'; import $ from 'jquery';
import Autosave from '../../autosave'; import Autosave from '../../autosave';
import { capitalizeFirstCharacter } from '../../lib/utils/text_utility'; import { capitalizeFirstCharacter } from '../../lib/utils/text_utility';
import { s__ } from '~/locale';
export default { export default {
methods: { methods: {
initAutoSave(noteable, extraKeys = []) { initAutoSave(noteable, extraKeys = []) {
let keys = [ let keys = [
'Note', s__('Autosave|Note'),
capitalizeFirstCharacter(noteable.noteable_type || noteable.noteableType), capitalizeFirstCharacter(noteable.noteable_type || noteable.noteableType),
noteable.id, noteable.id,
]; ];
......
...@@ -255,7 +255,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => { ...@@ -255,7 +255,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => {
eTagPoll.makeRequest(); eTagPoll.makeRequest();
$('.js-gfm-input').trigger('clear-commands-cache.atwho'); $('.js-gfm-input').trigger('clear-commands-cache.atwho');
Flash('Commands applied', 'notice', noteData.flashContainer); Flash(__('Commands applied'), 'notice', noteData.flashContainer);
} }
if (commandsChanges) { if (commandsChanges) {
...@@ -269,7 +269,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => { ...@@ -269,7 +269,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => {
}) })
.catch(() => { .catch(() => {
Flash( Flash(
'Something went wrong while adding your award. Please try again.', __('Something went wrong while adding your award. Please try again.'),
'alert', 'alert',
noteData.flashContainer, noteData.flashContainer,
); );
...@@ -311,7 +311,7 @@ export const poll = ({ commit, state, getters, dispatch }) => { ...@@ -311,7 +311,7 @@ export const poll = ({ commit, state, getters, dispatch }) => {
data: state, data: state,
successCallback: resp => successCallback: resp =>
resp.json().then(data => pollSuccessCallBack(data, commit, state, getters, dispatch)), resp.json().then(data => pollSuccessCallBack(data, commit, state, getters, dispatch)),
errorCallback: () => Flash('Something went wrong while fetching latest comments.'), errorCallback: () => Flash(__('Something went wrong while fetching latest comments.')),
}); });
if (!Visibility.hidden()) { if (!Visibility.hidden()) {
...@@ -347,7 +347,7 @@ export const fetchData = ({ commit, state, getters }) => { ...@@ -347,7 +347,7 @@ export const fetchData = ({ commit, state, getters }) => {
.poll(requestData) .poll(requestData)
.then(resp => resp.json) .then(resp => resp.json)
.then(data => pollSuccessCallBack(data, commit, state, getters)) .then(data => pollSuccessCallBack(data, commit, state, getters))
.catch(() => Flash('Something went wrong while fetching latest comments.')); .catch(() => Flash(__('Something went wrong while fetching latest comments.')));
}; };
export const toggleAward = ({ commit, getters }, { awardName, noteId }) => { export const toggleAward = ({ commit, getters }, { awardName, noteId }) => {
......
import AjaxCache from '~/lib/utils/ajax_cache'; import AjaxCache from '~/lib/utils/ajax_cache';
import { trimFirstCharOfLineContent } from '~/diffs/store/utils'; import { trimFirstCharOfLineContent } from '~/diffs/store/utils';
import { sprintf, __ } from '~/locale';
const REGEX_QUICK_ACTIONS = /^\/\w+.*$/gm; const REGEX_QUICK_ACTIONS = /^\/\w+.*$/gm;
export const findNoteObjectById = (notes, id) => notes.filter(n => n.id === id)[0]; export const findNoteObjectById = (notes, id) => notes.filter(n => n.id === id)[0];
export const getQuickActionText = note => { export const getQuickActionText = note => {
let text = 'Applying command'; let text = __('Applying command');
const quickActions = AjaxCache.get(gl.GfmAutoComplete.dataSources.commands) || []; const quickActions = AjaxCache.get(gl.GfmAutoComplete.dataSources.commands) || [];
const executedCommands = quickActions.filter(command => { const executedCommands = quickActions.filter(command => {
...@@ -16,10 +17,10 @@ export const getQuickActionText = note => { ...@@ -16,10 +17,10 @@ export const getQuickActionText = note => {
if (executedCommands && executedCommands.length) { if (executedCommands && executedCommands.length) {
if (executedCommands.length > 1) { if (executedCommands.length > 1) {
text = 'Applying multiple commands'; text = __('Applying multiple commands');
} else { } else {
const commandDescription = executedCommands[0].description.toLowerCase(); const commandDescription = executedCommands[0].description.toLowerCase();
text = `Applying command to ${commandDescription}`; text = sprintf(__('Applying command to %{commandDescription}', { commandDescription }));
} }
} }
......
...@@ -972,6 +972,15 @@ msgstr "" ...@@ -972,6 +972,15 @@ msgstr ""
msgid "Apply suggestion" msgid "Apply suggestion"
msgstr "" msgstr ""
msgid "Applying command"
msgstr ""
msgid "Applying command to %{commandDescription}"
msgstr ""
msgid "Applying multiple commands"
msgstr ""
msgid "Apr" msgid "Apr"
msgstr "" msgstr ""
...@@ -1197,6 +1206,9 @@ msgstr "" ...@@ -1197,6 +1206,9 @@ msgstr ""
msgid "Automatically resolved" msgid "Automatically resolved"
msgstr "" msgstr ""
msgid "Autosave|Note"
msgstr ""
msgid "Available" msgid "Available"
msgstr "" msgstr ""
...@@ -2430,6 +2442,9 @@ msgstr "" ...@@ -2430,6 +2442,9 @@ msgstr ""
msgid "Command line instructions" msgid "Command line instructions"
msgstr "" msgstr ""
msgid "Commands applied"
msgstr ""
msgid "Comment" msgid "Comment"
msgstr "" msgstr ""
...@@ -8473,6 +8488,9 @@ msgstr "" ...@@ -8473,6 +8488,9 @@ msgstr ""
msgid "Something went wrong when toggling the button" msgid "Something went wrong when toggling the button"
msgstr "" msgstr ""
msgid "Something went wrong while adding your award. Please try again."
msgstr ""
msgid "Something went wrong while applying the suggestion. Please try again." msgid "Something went wrong while applying the suggestion. Please try again."
msgstr "" msgstr ""
...@@ -8485,6 +8503,9 @@ msgstr "" ...@@ -8485,6 +8503,9 @@ msgstr ""
msgid "Something went wrong while fetching comments. Please try again." msgid "Something went wrong while fetching comments. Please try again."
msgstr "" msgstr ""
msgid "Something went wrong while fetching latest comments."
msgstr ""
msgid "Something went wrong while fetching related merge requests." msgid "Something went wrong while fetching related merge requests."
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment