diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2019-05-02 13:53:34 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2019-05-02 13:53:34 +0000 |
commit | 3cfac9b00da82b10e0a43141054d845782ce0f7c (patch) | |
tree | 3e55310be681a1866027cecf0d40854d92979eff /app | |
parent | 888840b6a33d6f6d80b3753a5f3ed4a3a8280dac (diff) | |
parent | f65e2119d3ce32ec52b8a0cdc603948ad0268e26 (diff) | |
download | gitlab-ce-3cfac9b00da82b10e0a43141054d845782ce0f7c.tar.gz |
Merge branch 'js-i18n-pages' into 'master'
Internationalisation of pages directory
See merge request gitlab-org/gitlab-ce!27731
Diffstat (limited to 'app')
5 files changed, 28 insertions, 22 deletions
diff --git a/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js b/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js index d5ded3f9a79..6e00e31b828 100644 --- a/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js +++ b/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js @@ -22,7 +22,7 @@ export default () => { _.debounce(function onMessageInput() { const message = $(this).val(); if (message === '') { - $('.js-broadcast-message-preview').text('Your message here'); + $('.js-broadcast-message-preview').text(__('Your message here')); } else { axios .post(previewPath, { diff --git a/app/assets/javascripts/pages/profiles/show/index.js b/app/assets/javascripts/pages/profiles/show/index.js index e726ab0e220..13cb0d6f74b 100644 --- a/app/assets/javascripts/pages/profiles/show/index.js +++ b/app/assets/javascripts/pages/profiles/show/index.js @@ -3,6 +3,7 @@ import createFlash from '~/flash'; import GfmAutoComplete from 'ee_else_ce/gfm_auto_complete'; import emojiRegex from 'emoji-regex'; import EmojiMenu from './emoji_menu'; +import { __ } from '~/locale'; const defaultStatusEmoji = 'speech_balloon'; @@ -48,7 +49,7 @@ document.addEventListener('DOMContentLoaded', () => { const EMOJI_REGEX = emojiRegex(); if (EMOJI_REGEX.test(userNameInput.value)) { // set field to invalid so it gets detected by GlFieldErrors - userNameInput.setCustomValidity('Invalid field'); + userNameInput.setCustomValidity(__('Invalid field')); } else { userNameInput.setCustomValidity(''); } @@ -81,5 +82,5 @@ document.addEventListener('DOMContentLoaded', () => { } }); }) - .catch(() => createFlash('Failed to load emoji list.')); + .catch(() => createFlash(__('Failed to load emoji list.'))); }); diff --git a/app/assets/javascripts/pages/projects/shared/permissions/constants.js b/app/assets/javascripts/pages/projects/shared/permissions/constants.js index bc5c29d12b5..ac0dca31c37 100644 --- a/app/assets/javascripts/pages/projects/shared/permissions/constants.js +++ b/app/assets/javascripts/pages/projects/shared/permissions/constants.js @@ -1,3 +1,5 @@ +import { __ } from '~/locale'; + export const visibilityOptions = { PRIVATE: 0, INTERNAL: 10, @@ -5,9 +7,11 @@ export const visibilityOptions = { }; export const visibilityLevelDescriptions = { - [visibilityOptions.PRIVATE]: + [visibilityOptions.PRIVATE]: __( 'The project is accessible only by members of the project. Access must be granted explicitly to each user.', - [visibilityOptions.INTERNAL]: 'The project can be accessed by any user who is logged in.', - [visibilityOptions.PUBLIC]: + ), + [visibilityOptions.INTERNAL]: __('The project can be accessed by any user who is logged in.'), + [visibilityOptions.PUBLIC]: __( 'The project can be accessed by anyone, regardless of authentication.', + ), }; diff --git a/app/assets/javascripts/pages/search/show/search.js b/app/assets/javascripts/pages/search/show/search.js index 0c896c8599e..d5a8e712d6b 100644 --- a/app/assets/javascripts/pages/search/show/search.js +++ b/app/assets/javascripts/pages/search/show/search.js @@ -1,6 +1,7 @@ import $ from 'jquery'; import Flash from '~/flash'; import Api from '~/api'; +import { __ } from '~/locale'; export default class Search { constructor() { @@ -24,7 +25,7 @@ export default class Search { data(term, callback) { return Api.groups(term, {}, data => { data.unshift({ - full_name: 'Any', + full_name: __('Any'), }); data.splice(1, 0, 'divider'); return callback(data); @@ -54,14 +55,14 @@ export default class Search { this.getProjectsData(term) .then(data => { data.unshift({ - name_with_namespace: 'Any', + name_with_namespace: __('Any'), }); data.splice(1, 0, 'divider'); return data; }) .then(data => callback(data)) - .catch(() => new Flash('Error fetching projects')); + .catch(() => new Flash(__('Error fetching projects'))); }, id(obj) { return obj.id; diff --git a/app/assets/javascripts/pages/users/activity_calendar.js b/app/assets/javascripts/pages/users/activity_calendar.js index 4a20753e7ae..693125f8a38 100644 --- a/app/assets/javascripts/pages/users/activity_calendar.js +++ b/app/assets/javascripts/pages/users/activity_calendar.js @@ -6,7 +6,7 @@ import dateFormat from 'dateformat'; import { getDayName, getDayDifference } from '~/lib/utils/datetime_utility'; import axios from '~/lib/utils/axios_utils'; import flash from '~/flash'; -import { __ } from '~/locale'; +import { n__, s__, __ } from '~/locale'; const d3 = { select, scaleLinear, scaleThreshold }; @@ -35,9 +35,9 @@ function formatTooltipText({ date, count }) { const dateDayName = getDayName(dateObject); const dateText = dateFormat(dateObject, 'mmm d, yyyy'); - let contribText = 'No contributions'; + let contribText = __('No contributions'); if (count > 0) { - contribText = `${count} contribution${count > 1 ? 's' : ''}`; + contribText = n__('%d contribution', '%d contributions', count); } return `${contribText}<br />${dateDayName} ${dateText}`; } @@ -199,27 +199,27 @@ export default class ActivityCalendar { renderDayTitles() { const days = [ { - text: 'M', + text: s__('DayTitle|M'), y: 29 + this.dayYPos(1), }, { - text: 'W', + text: s__('DayTitle|W'), y: 29 + this.dayYPos(3), }, { - text: 'F', + text: s__('DayTitle|F'), y: 29 + this.dayYPos(5), }, ]; if (this.firstDayOfWeek === firstDayOfWeekChoices.monday) { days.push({ - text: 'S', + text: s__('DayTitle|S'), y: 29 + this.dayYPos(7), }); } else if (this.firstDayOfWeek === firstDayOfWeekChoices.saturday) { days.push({ - text: 'S', + text: s__('DayTitle|S'), y: 29 + this.dayYPos(6), }); } @@ -253,11 +253,11 @@ export default class ActivityCalendar { renderKey() { const keyValues = [ - 'no contributions', - '1-9 contributions', - '10-19 contributions', - '20-29 contributions', - '30+ contributions', + __('no contributions'), + __('1-9 contributions'), + __('10-19 contributions'), + __('20-29 contributions'), + __('30+ contributions'), ]; const keyColors = [ '#ededed', |