From b69a6886d762288b819966723696ac3b51f6525f Mon Sep 17 00:00:00 2001 From: Vemund Santi Date: Wed, 9 Aug 2017 14:36:01 +0200 Subject: [PATCH] Locale/nb-NO (#7122) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * locale: Add Norwegian Bokmål locales to Ant Design * Add Vemund Santi to authors. * docs: add Norwegian to list of i18n language examples * test: add tests for Norwegian Bokmål * Update dependencies. Use locales from rc-pagination. --- AUTHORS.txt | 1 + components/calendar/locale/nb_NO.tsx | 2 + components/date-picker/locale/nb_NO.tsx | 19 ++++++++ .../locale-provider/__tests__/index.test.js | 3 +- components/locale-provider/nb_NO.tsx | 47 +++++++++++++++++++ components/time-picker/locale/nb_NO.tsx | 5 ++ docs/react/i18n.en-US.md | 1 + docs/react/i18n.zh-CN.md | 1 + package.json | 2 +- 9 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 components/calendar/locale/nb_NO.tsx create mode 100644 components/date-picker/locale/nb_NO.tsx create mode 100644 components/locale-provider/nb_NO.tsx create mode 100644 components/time-picker/locale/nb_NO.tsx diff --git a/AUTHORS.txt b/AUTHORS.txt index 492bcdfbc8..a7bffd0528 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -141,6 +141,7 @@ Tino D Tyler Vadim Macagon Valentin Vichnal +Vemund Santi Vincent Zhang Walter Barbagallo Warren Seymour diff --git a/components/calendar/locale/nb_NO.tsx b/components/calendar/locale/nb_NO.tsx new file mode 100644 index 0000000000..f7417e06d5 --- /dev/null +++ b/components/calendar/locale/nb_NO.tsx @@ -0,0 +1,2 @@ +import nb_NO from '../../date-picker/locale/nb_NO'; +export default nb_NO; diff --git a/components/date-picker/locale/nb_NO.tsx b/components/date-picker/locale/nb_NO.tsx new file mode 100644 index 0000000000..4fda0792c8 --- /dev/null +++ b/components/date-picker/locale/nb_NO.tsx @@ -0,0 +1,19 @@ +import CalendarLocale from 'rc-calendar/lib/locale/nb_NO'; +import TimePickerLocale from '../../time-picker/locale/nb_NO'; + +// Merge into a locale object +const locale = { + lang: { + placeholder: 'Velg dato', + rangePlaceholder: ['Startdato', 'Sluttdato'], + ...CalendarLocale, + }, + timePickerLocale: { + ...TimePickerLocale, + }, +}; + +// All settings at: +// https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json + +export default locale; diff --git a/components/locale-provider/__tests__/index.test.js b/components/locale-provider/__tests__/index.test.js index 7252ad0374..a93ee1f47a 100644 --- a/components/locale-provider/__tests__/index.test.js +++ b/components/locale-provider/__tests__/index.test.js @@ -30,8 +30,9 @@ import viVN from '../vi_VN'; import thTH from '../th_TH'; import faIR from '../fa_IR'; import elGR from '../el_GR'; +import nbNO from '../nb_NO'; -const locales = [enUS, ptBR, ruRU, esES, svSE, frBE, deDE, nlNL, caES, csCZ, koKR, etEE, skSK, jaJP, trTR, zhTW, fiFI, plPL, bgBG, enGB, frFR, nlBE, itIT, viVN, thTH, faIR, elGR]; +const locales = [enUS, ptBR, ruRU, esES, svSE, frBE, deDE, nlNL, caES, csCZ, koKR, etEE, skSK, jaJP, trTR, zhTW, fiFI, plPL, bgBG, enGB, frFR, nlBE, itIT, viVN, thTH, faIR, elGR, nbNO]; const Option = Select.Option; const RangePicker = DatePicker.RangePicker; diff --git a/components/locale-provider/nb_NO.tsx b/components/locale-provider/nb_NO.tsx new file mode 100644 index 0000000000..aeec301d40 --- /dev/null +++ b/components/locale-provider/nb_NO.tsx @@ -0,0 +1,47 @@ +import moment from 'moment'; +moment.locale('nb'); + +import Pagination from 'rc-pagination/lib/locale/nb_NO'; +import DatePicker from '../date-picker/locale/nb_NO'; +import TimePicker from '../time-picker/locale/nb_NO'; +import Calendar from '../calendar/locale/nb_NO'; + +export default { + locale: 'nb', + DatePicker, + TimePicker, + Calendar, + Pagination, + Table: { + filterTitle: 'Filtermeny', + filterConfirm: 'OK', + filterReset: 'Nullstill', + emptyText: 'Ingen data', + selectAll: 'Velg alle', + selectInvert: 'Inverter valg', + }, + Modal: { + okText: 'OK', + cancelText: 'Avbryt', + justOkText: 'OK', + }, + Popconfirm: { + okText: 'OK', + cancelText: 'Avbryt', + }, + Transfer: { + notFoundContent: 'Ingen treff', + searchPlaceholder: 'Søk her', + itemUnit: 'element', + itemsUnit: 'elementer', + }, + Select: { + notFoundContent: 'Ingen treff', + }, + Upload: { + uploading: 'Laster opp...', + removeFile: 'Fjern fil', + uploadError: 'Feil ved opplastning', + previewFile: 'Forhåndsvisning', + }, +}; diff --git a/components/time-picker/locale/nb_NO.tsx b/components/time-picker/locale/nb_NO.tsx new file mode 100644 index 0000000000..dfc0d96e92 --- /dev/null +++ b/components/time-picker/locale/nb_NO.tsx @@ -0,0 +1,5 @@ +const locale = { + placeholder: 'Velg tid', +}; + +export default locale; diff --git a/docs/react/i18n.en-US.md b/docs/react/i18n.en-US.md index f35daa1e80..cf71a5ce39 100644 --- a/docs/react/i18n.en-US.md +++ b/docs/react/i18n.en-US.md @@ -43,6 +43,7 @@ Supported languages: |Italian|it_IT| |Japanese|ja_JP| |Korean|ko_KR| +|Norwegian|nb_NO| |Persian|fa_IR| |Polish|pl_PL| |Portuguese (Brazil)|pt_BR| diff --git a/docs/react/i18n.zh-CN.md b/docs/react/i18n.zh-CN.md index db709b06e3..21576a4859 100644 --- a/docs/react/i18n.zh-CN.md +++ b/docs/react/i18n.zh-CN.md @@ -41,6 +41,7 @@ return ( |意大利语|it_IT| |日语|ja_JP| |韩语/朝鲜语|ko_KR| +|挪威|nb_NO| |波斯语|fa_IR| |波兰语|pl_PL| |葡萄牙语|pt_BR| diff --git a/package.json b/package.json index f94b6cd4ce..1dff926002 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "rc-input-number": "~3.6.0", "rc-menu": "~5.0.10", "rc-notification": "~2.0.0", - "rc-pagination": "~1.10.0", + "rc-pagination": "~1.10.6", "rc-progress": "~2.1.2", "rc-rate": "~2.1.1", "rc-select": "~6.8.6",