diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2019-05-23 20:08:18 +0000 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2019-05-23 20:08:18 +0000 |
commit | d20df54e40e2190c7d70024bd8432f1f6c8c8ab0 (patch) | |
tree | df4769867a9c8a7ead09a66d3e141746506199d6 | |
parent | d5074b1d356431f451772113e82ac0fcdb8c5fbc (diff) | |
parent | b95183fb33cf589a6475051e7bf047f648bc8e7c (diff) | |
download | gitlab-ce-d20df54e40e2190c7d70024bd8432f1f6c8c8ab0.tar.gz |
Merge branch 'js-i18n-lib' into 'master'
Internationalisation of lib directory
See merge request gitlab-org/gitlab-ce!27711
-rw-r--r-- | app/assets/javascripts/lib/utils/datetime_utility.js | 28 | ||||
-rw-r--r-- | app/assets/javascripts/lib/utils/number_utils.js | 9 | ||||
-rw-r--r-- | locale/gitlab.pot | 24 |
3 files changed, 47 insertions, 14 deletions
diff --git a/app/assets/javascripts/lib/utils/datetime_utility.js b/app/assets/javascripts/lib/utils/datetime_utility.js index 4d6327840db..624878cb5d7 100644 --- a/app/assets/javascripts/lib/utils/datetime_utility.js +++ b/app/assets/javascripts/lib/utils/datetime_utility.js @@ -3,7 +3,7 @@ import _ from 'underscore'; import timeago from 'timeago.js'; import dateFormat from 'dateformat'; import { pluralize } from './text_utility'; -import { languageCode, s__ } from '../../locale'; +import { languageCode, s__, __ } from '../../locale'; window.timeago = timeago; @@ -63,7 +63,15 @@ export const pad = (val, len = 2) => `0${val}`.slice(-len); * @returns {String} */ export const getDayName = date => - ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][date.getDay()]; + [ + __('Sunday'), + __('Monday'), + __('Tuesday'), + __('Wednesday'), + __('Thursday'), + __('Friday'), + __('Saturday'), + ][date.getDay()]; /** * @example @@ -320,13 +328,13 @@ export const getSundays = date => { } const daysToSunday = [ - 'Saturday', - 'Friday', - 'Thursday', - 'Wednesday', - 'Tuesday', - 'Monday', - 'Sunday', + __('Saturday'), + __('Friday'), + __('Thursday'), + __('Wednesday'), + __('Tuesday'), + __('Monday'), + __('Sunday'), ]; const month = date.getMonth(); @@ -336,7 +344,7 @@ export const getSundays = date => { while (dateOfMonth.getMonth() === month) { const dayName = getDayName(dateOfMonth); - if (dayName === 'Sunday') { + if (dayName === __('Sunday')) { sundays.push(new Date(dateOfMonth.getTime())); } diff --git a/app/assets/javascripts/lib/utils/number_utils.js b/app/assets/javascripts/lib/utils/number_utils.js index 19c4de6083d..9ddfb4bca11 100644 --- a/app/assets/javascripts/lib/utils/number_utils.js +++ b/app/assets/javascripts/lib/utils/number_utils.js @@ -1,4 +1,5 @@ import { BYTES_IN_KIB } from './constants'; +import { sprintf, __ } from '~/locale'; /** * Function that allows a number with an X amount of decimals @@ -72,13 +73,13 @@ export function bytesToGiB(number) { */ export function numberToHumanSize(size) { if (size < BYTES_IN_KIB) { - return `${size} bytes`; + return sprintf(__('%{size} bytes'), { size }); } 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) { - 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) }); } /** diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 6209530deab..cc81e3b2e44 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -193,6 +193,18 @@ msgstr "" msgid "%{service_title} settings saved, but not activated." 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." msgstr "" @@ -4482,6 +4494,9 @@ msgstr "" msgid "Found errors in your .gitlab-ci.yml:" msgstr "" +msgid "Friday" +msgstr "" + msgid "From %{providerTitle}" msgstr "" @@ -9984,6 +9999,9 @@ msgstr "" msgid "This will remove the fork relationship to source project" msgstr "" +msgid "Thursday" +msgstr "" + msgid "Time before an issue gets scheduled" msgstr "" @@ -10387,6 +10405,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." msgstr "" +msgid "Tuesday" +msgstr "" + msgid "Twitter" msgstr "" @@ -10879,6 +10900,9 @@ msgstr "" msgid "Webhooks Help" msgstr "" +msgid "Wednesday" +msgstr "" + msgid "Welcome to your Issue Board!" msgstr "" |