diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-12-18 11:19:14 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-12-18 11:19:14 +0000 |
commit | c20720cf84132d7bf14763aba0570bd8882f9c6d (patch) | |
tree | 69d943464250790018b156b2d75f6ca8ba1536fd /doc | |
parent | dcc0455c4864b4251559cfc922bf7c53ae317497 (diff) | |
parent | e720e8b8fbc9c7e04e528a54cce37d18c776d2d2 (diff) | |
download | gitlab-ce-c20720cf84132d7bf14763aba0570bd8882f9c6d.tar.gz |
Merge branch 'winh-translate-contributors-page-dates' into 'master'
Translate contributors page dates
Closes #39283 and #38592
See merge request gitlab-org/gitlab-ce!15846
Diffstat (limited to 'doc')
-rw-r--r-- | doc/development/i18n/externalization.md | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/development/i18n/externalization.md b/doc/development/i18n/externalization.md index 43b996d9395..f493ad4ae66 100644 --- a/doc/development/i18n/externalization.md +++ b/doc/development/i18n/externalization.md @@ -262,6 +262,21 @@ Sometimes you need to add some context to the text that you want to translate s__('OpenedNDaysAgo|Opened') ``` +### Dates / times + +- In JavaScript: + +```js +import { createDateTimeFormat } from '.../locale'; + +const dateFormat = createDateTimeFormat({ year: 'numeric', month: 'long', day: 'numeric' }); +console.log(dateFormat.format(new Date('2063-04-05'))) // April 5, 2063 +``` + +This makes use of [`Intl.DateTimeFormat`]. + +[`Intl.DateTimeFormat`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + ## Adding a new language Let's suppose you want to add translations for a new language, let's say French. |