Skip to content

Commit

Permalink
feat: Add Maori support (#125)
Browse files Browse the repository at this point in the history
* Add Maori support

* Add minimal lists

* Clean up comments

* Re-use supportedLocales

* Remove frauConfig to let that repo import what what it needs and build this object instead
  • Loading branch information
bearfriend authored Oct 24, 2023
1 parent 69219b6 commit 24fcc45
Show file tree
Hide file tree
Showing 5 changed files with 11,119 additions and 3 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
node_modules
package-lock.json
4 changes: 3 additions & 1 deletion lib/common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const defaultLocale = 'en';
export const supportedBaseLocales = ['ar', 'cy', 'da', 'de', 'en', 'es', 'fr', 'hi', 'ja', 'ko', 'nl', 'pt', 'sv', 'tr', 'zh'];
export const supportedBaseLocales = ['ar', 'cy', 'da', 'de', 'en', 'es', 'fr', 'hi', 'ja', 'ko', 'mi', 'nl', 'pt', 'sv', 'tr', 'zh'];
export const supportedLangpacks = ['ar', 'cy', 'da', 'de', 'en', 'en-gb', 'es', 'es-es', 'fr', 'fr-fr', 'fr-on', 'hi', 'ja', 'ko', 'mi', 'nl', 'pt', 'sv', 'tr', 'zh-cn', 'zh-tw'];
export const supportedLocalesDetails = [
{ code: 'ar-sa', name: 'العربية' },
{ code: 'cy-gb', name: 'Cymraeg (Y Deyrnas Unedig)' },
Expand All @@ -16,6 +17,7 @@ export const supportedLocalesDetails = [
{ code: 'hi-in', name: 'हिन्दी Hindi (India)' },
{ code: 'ja-jp', name: '日本語 (日本)' },
{ code: 'ko-kr', name: '한국어 (대한민국)' },
{ code: 'mi-nz', name: 'Māori (Aotearoa)' },
{ code: 'nl-nl', name: 'Nederlands (Nederland)' },
{ code: 'pt-br', name: 'Português (Brasil)' },
{ code: 'sv-se', name: 'Svenska (Sverige)' },
Expand Down
15 changes: 14 additions & 1 deletion lib/dateTime.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { getDocumentLocaleSettings, getLanguage, merge } from './common.js';

// to-do: These should be based on region, not language
const hour24locales = ['cy', 'da', 'de', 'es', 'fr', 'nl', 'pt', 'sv', 'tr', 'zh'];
const mondayFirstDayLocales = ['cy', 'da', 'de', 'fr', 'hi', 'nl', 'sv', 'tr'];
const mondayFirstDayLocales = ['cy', 'da', 'de', 'fr', 'hi', 'mi', 'nl', 'sv', 'tr'];

// timezone abbreviations and offsets from https://www.timeanddate.com/time/zones/
const timezoneOffsetMap = {
Expand Down Expand Up @@ -825,6 +826,18 @@ export function getDateTimeDescriptor() {
days[0] = ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'];
days[1] = days[2] = ['일', '월', '화', '수', '목', '금', '토'];
break;
case 'mi':
dateFormats = ['dddd, d MMMM y', 'd MMMM y', 'dd-MM-y', 'MMMM yyyy', 'd MMMM', 'd MMM'];
months = [
['Kohitātea', 'Huitanguru', 'Poutūterangi', 'Paengawhāwhā', 'Haratua', 'Pipiri', 'Hōngongoi', 'Hereturikōkā', 'Mahuru', 'Whiringa-ā-nuku', 'Whiringa-ā-rangi', 'Hakihea'],
['Kohi', 'Hui', 'Pou', 'Pae', 'Hara', 'Pipi', 'Hōngo', 'Here', 'Mahu', 'Nuku', 'Rangi', 'Haki']
];
days = [
['Rātapu', 'Rāhina', 'Rātū', 'Rāapa', 'Rāpare', 'Rāmere', 'Rāhoroi'],
['Tap', 'Hin', 'Tū', 'Apa', 'Par', 'Mer', 'Hor'],
['T', 'H', 'T', 'A', 'P', 'M', 'H']
];
break;
case 'nl':
dateFormats = ['dddd d MMMM yyyy', 'd MMMM yyyy', 'dd-MM-yyyy', 'MMMM yyyy', 'd MMMM', 'd MMM'];
dayPeriods = ['a.m.', 'p.m.'];
Expand Down
1 change: 1 addition & 0 deletions lib/number.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export function getNumberDescriptor() {
case 'es':
case 'hi':
case 'ja':
case 'mi':
case 'pt':
case 'zh':
percentPattern = '{number}%';
Expand Down
Loading

0 comments on commit 24fcc45

Please sign in to comment.