Commit dd01f662 authored by Clement Ho's avatar Clement Ho

Merge branch 'ee-js-i18n-lib' into 'master'

Internationalisation of lib directory - EE

See merge request gitlab-org/gitlab-ee!12981
parents 7ed7adf0 3e726723
...@@ -3,7 +3,7 @@ import _ from 'underscore'; ...@@ -3,7 +3,7 @@ import _ from 'underscore';
import timeago from 'timeago.js'; import timeago from 'timeago.js';
import dateFormat from 'dateformat'; import dateFormat from 'dateformat';
import { pluralize } from './text_utility'; import { pluralize } from './text_utility';
import { languageCode, s__ } from '../../locale'; import { languageCode, s__, __ } from '../../locale';
window.timeago = timeago; window.timeago = timeago;
...@@ -63,7 +63,15 @@ export const pad = (val, len = 2) => `0${val}`.slice(-len); ...@@ -63,7 +63,15 @@ export const pad = (val, len = 2) => `0${val}`.slice(-len);
* @returns {String} * @returns {String}
*/ */
export const getDayName = date => export const getDayName = date =>
['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][date.getDay()]; [
__('Sunday'),
__('Monday'),
__('Tuesday'),
__('Wednesday'),
__('Thursday'),
__('Friday'),
__('Saturday'),
][date.getDay()];
/** /**
* @example * @example
...@@ -320,13 +328,13 @@ export const getSundays = date => { ...@@ -320,13 +328,13 @@ export const getSundays = date => {
} }
const daysToSunday = [ const daysToSunday = [
'Saturday', __('Saturday'),
'Friday', __('Friday'),
'Thursday', __('Thursday'),
'Wednesday', __('Wednesday'),
'Tuesday', __('Tuesday'),
'Monday', __('Monday'),
'Sunday', __('Sunday'),
]; ];
const month = date.getMonth(); const month = date.getMonth();
...@@ -336,7 +344,7 @@ export const getSundays = date => { ...@@ -336,7 +344,7 @@ export const getSundays = date => {
while (dateOfMonth.getMonth() === month) { while (dateOfMonth.getMonth() === month) {
const dayName = getDayName(dateOfMonth); const dayName = getDayName(dateOfMonth);
if (dayName === 'Sunday') { if (dayName === __('Sunday')) {
sundays.push(new Date(dateOfMonth.getTime())); sundays.push(new Date(dateOfMonth.getTime()));
} }
......
import { BYTES_IN_KIB } from './constants'; import { BYTES_IN_KIB } from './constants';
import { sprintf, __ } from '~/locale';
/** /**
* Function that allows a number with an X amount of decimals * Function that allows a number with an X amount of decimals
...@@ -72,13 +73,13 @@ export function bytesToGiB(number) { ...@@ -72,13 +73,13 @@ export function bytesToGiB(number) {
*/ */
export function numberToHumanSize(size) { export function numberToHumanSize(size) {
if (size < BYTES_IN_KIB) { if (size < BYTES_IN_KIB) {
return `${size} bytes`; return sprintf(__('%{size} bytes'), { size });
} else if (size < BYTES_IN_KIB * BYTES_IN_KIB) { } else if (size < BYTES_IN_KIB * BYTES_IN_KIB) {
return `${bytesToKiB(size).toFixed(2)} KiB`; return sprintf(__('%{size} KiB'), { size: bytesToKiB(size).toFixed(2) });
} else if (size < BYTES_IN_KIB * BYTES_IN_KIB * BYTES_IN_KIB) { } else if (size < BYTES_IN_KIB * BYTES_IN_KIB * BYTES_IN_KIB) {
return `${bytesToMiB(size).toFixed(2)} MiB`; return sprintf(__('%{size} MiB'), { size: bytesToMiB(size).toFixed(2) });
} }
return `${bytesToGiB(size).toFixed(2)} GiB`; return sprintf(__('%{size} GiB'), { size: bytesToGiB(size).toFixed(2) });
} }
/** /**
......
...@@ -247,6 +247,18 @@ msgstr "" ...@@ -247,6 +247,18 @@ msgstr ""
msgid "%{service_title} settings saved, but not activated." msgid "%{service_title} settings saved, but not activated."
msgstr "" msgstr ""
msgid "%{size} GiB"
msgstr ""
msgid "%{size} KiB"
msgstr ""
msgid "%{size} MiB"
msgstr ""
msgid "%{size} bytes"
msgstr ""
msgid "%{spammable_titlecase} was submitted to Akismet successfully." msgid "%{spammable_titlecase} was submitted to Akismet successfully."
msgstr "" msgstr ""
...@@ -5565,6 +5577,9 @@ msgstr "" ...@@ -5565,6 +5577,9 @@ msgstr ""
msgid "Free Trial of GitLab.com Gold" msgid "Free Trial of GitLab.com Gold"
msgstr "" msgstr ""
msgid "Friday"
msgstr ""
msgid "From %{providerTitle}" msgid "From %{providerTitle}"
msgstr "" msgstr ""
...@@ -12969,6 +12984,9 @@ msgstr "" ...@@ -12969,6 +12984,9 @@ msgstr ""
msgid "Those emails automatically become issues (with the comments becoming the email conversation) listed here." msgid "Those emails automatically become issues (with the comments becoming the email conversation) listed here."
msgstr "" msgstr ""
msgid "Thursday"
msgstr ""
msgid "Time before an issue gets scheduled" msgid "Time before an issue gets scheduled"
msgstr "" msgstr ""
...@@ -13435,6 +13453,9 @@ msgstr "" ...@@ -13435,6 +13453,9 @@ msgstr ""
msgid "Trying to communicate with your device. Plug it in (if you haven't already) and press the button on the device now." msgid "Trying to communicate with your device. Plug it in (if you haven't already) and press the button on the device now."
msgstr "" msgstr ""
msgid "Tuesday"
msgstr ""
msgid "Turn on Service Desk" msgid "Turn on Service Desk"
msgstr "" msgstr ""
...@@ -14149,6 +14170,9 @@ msgstr "" ...@@ -14149,6 +14170,9 @@ msgstr ""
msgid "Webhooks allow you to trigger a URL if, for example, new code is pushed or a new issue is created. You can configure webhooks to listen for specific events like pushes, issues or merge requests. Group webhooks will apply to all projects in a group, allowing you to standardize webhook functionality across your entire group." msgid "Webhooks allow you to trigger a URL if, for example, new code is pushed or a new issue is created. You can configure webhooks to listen for specific events like pushes, issues or merge requests. Group webhooks will apply to all projects in a group, allowing you to standardize webhook functionality across your entire group."
msgstr "" msgstr ""
msgid "Wednesday"
msgstr ""
msgid "Weeks" msgid "Weeks"
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