Skip to content

Commit

Permalink
[locale] Cambodian Locale: Translate AM/PM, change weekdaysShort and …
Browse files Browse the repository at this point in the history
…weekdaysMin (#4392)

* translated am/pm

* change weekdaysShort, and weekdaysMin

* fix missing semi colons

* fix more missing semi colons

* fix missing spaces

* add Khmer script number and use ordinal

* fix trailing white space
  • Loading branch information
kruyvanna authored and marwahaha committed Mar 4, 2018
1 parent 391bc7d commit 35b17e3
Show file tree
Hide file tree
Showing 2 changed files with 434 additions and 130 deletions.
63 changes: 57 additions & 6 deletions src/locale/km.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,60 @@

import moment from '../moment';

var symbolMap = {
'1': '១',
'2': '២',
'3': '៣',
'4': '៤',
'5': '៥',
'6': '៦',
'7': '៧',
'8': '៨',
'9': '៩',
'0': '០'
}, numberMap = {
'១': '1',
'២': '2',
'៣': '3',
'៤': '4',
'៥': '5',
'៦': '6',
'៧': '7',
'៨': '8',
'៩': '9',
'០': '0'
};

export default moment.defineLocale('km', {
months: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split('_'),
monthsShort: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split('_'),
months: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split(
'_'
),
monthsShort: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split(
'_'
),
weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'),
weekdaysShort: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'),
weekdaysMin: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'),
weekdaysShort: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'),
weekdaysMin: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'),
weekdaysParseExact: true,
longDateFormat: {
LT: 'HH:mm',
LTS : 'HH:mm:ss',
LTS: 'HH:mm:ss',
L: 'DD/MM/YYYY',
LL: 'D MMMM YYYY',
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd, D MMMM YYYY HH:mm'
},
meridiemParse: /ព្រឹក|ល្ងាច/,
isPM: function (input) {
return input === 'ល្ងាច';
},
meridiem: function (hour, minute, isLower) {
if (hour < 12) {
return 'ព្រឹក';
} else {
return 'ល្ងាច';
}
},
calendar: {
sameDay: '[ថ្ងៃនេះ ម៉ោង] LT',
nextDay: '[ស្អែក ម៉ោង] LT',
Expand All @@ -42,9 +82,20 @@ export default moment.defineLocale('km', {
y: 'មួយឆ្នាំ',
yy: '%d ឆ្នាំ'
},
dayOfMonthOrdinalParse : /ទី\d{1,2}/,
ordinal : 'ទី%d',
preparse: function (string) {
return string.replace(/[១២៣៤៥៦៧៨៩០]/g, function (match) {
return numberMap[match];
});
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
});
},
week: {
dow: 1, // Monday is the first day of the week.
doy: 4 // The week that contains Jan 4th is the first week of the year.
}
});

0 comments on commit 35b17e3

Please sign in to comment.