Skip to content

Commit

Permalink
feat(datepicker): add hungarian localization
Browse files Browse the repository at this point in the history
  • Loading branch information
fegyi001 authored and valorkin committed Nov 21, 2017
1 parent f2d5156 commit 5370c6a
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 6 deletions.
9 changes: 4 additions & 5 deletions demo/src/app/components/+datepicker/demo-datepicker.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ import { DatepickerSectionComponent } from './datepicker-section.component';
import { DEMO_COMPONENTS } from './demos';
import { routes } from './demo-datepicker.routes';

import { defineLocale } from 'ngx-bootstrap/bs-moment';
import { defineLocale, LocaleData } from 'ngx-bootstrap/bs-moment';
import {
ar, cs, de, enGb, es, esDo, esUs, fr, hi, it, ja, ko, nl, nlBe, pl, ptBr, sv, ru, zhCn, tr, he
ar, cs, de, enGb, es, esDo, esUs, fr, hi, it, ja, ko, nl, nlBe, pl, ptBr, sv, ru, zhCn, tr
} from 'ngx-bootstrap/locale';

const locales = [ar, cs, de, enGb, es, esDo, esUs, fr, hi, it, ja, ko, nl, nlBe, pl, ptBr, sv, ru, zhCn, tr, he];

locales.forEach(locale => defineLocale(locale.abbr, locale));
const locales = [ar, cs, de, enGb, es, esDo, esUs, fr, hi, hu, it, ja, ko, nl, nlBe, pl, ptBr, sv, ru, zhCn, tr, he];
locales.forEach((locale: LocaleData) => defineLocale(locale.abbr, locale));

@NgModule({
declarations: [
Expand Down
51 changes: 51 additions & 0 deletions src/bs-moment/i18n/hu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// moment.js locale configuration
// locale : Hungarian [hu]
// author : Gergely Padányi-Gulyás : https://github.com/fegyi001

import { LocaleData } from '../locale/locale.class';

export const hu = {
abbr: 'hu',
months: 'Január_Február_Március_Április_Május_Június_Július_Augusztus_Szeptember_Október_November_December'.split('_'),
monthsShort: 'Jan_Feb_Márc_Ápr_Máj_Jún_Júl_Aug_Szept_Okt_Nov_Dec'.split('_'),
weekdays: 'Vasárnap_Hétfő_Kedd_Szerda_Csütörtök_Péntek_Szombat'.split('_'),
weekdaysShort: 'Vas_Hét_Kedd_Sze_Csüt_Pén_Szo'.split('_'),
weekdaysMin: 'V_H_K_Sze_Cs_P_Szo'.split('_'),
longDateFormat: {
LT: 'H:mm',
LTS: 'H:mm:ss',
L: 'YYYY.MM.DD.',
LL: 'YYYY. MMMM D.',
LLL: 'YYYY. MMMM D. H:mm',
LLLL: 'YYYY. MMMM D., dddd H:mm'
},
calendar: {
sameDay: '[Ma] LT[-kor]',
nextDay: '[Holnap] LT[-kor]',
nextWeek: 'dddd [] LT',
lastDay: '[Tegnap] LT',
lastWeek: '[Múlt] dddd [] LT',
sameElse: 'L'
},
relativeTime: {
future: '%s múlva',
past: '%s',
s: 'néhány másodperce',
m: 'egy perce',
mm: '%d perce',
h: 'egy órája',
hh: '%d órája',
d: 'egy napja',
dd: '%d napja',
M: 'egy hónapja',
MM: '%d hónapja',
y: 'egy éve',
yy: '%d éve'
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal: '%d.',
week: {
dow: 1,
doy: 4 // The week that contains Jan 4th is the first week of the year.
}
};
1 change: 1 addition & 0 deletions src/bs-moment/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export {
getSetGlobalLocale,
listLocales
} from './locale/locales.service';
export { LocaleData } from './locale/locale.class';
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export {
positionElements
} from './positioning';

export { defineLocale, getSetGlobalLocale } from './bs-moment';
export { defineLocale, getSetGlobalLocale, LocaleData } from './bs-moment';

export {
ar,
Expand All @@ -166,6 +166,7 @@ export {
esUs,
fr,
hi,
hu,
it,
ja,
ko,
Expand Down
1 change: 1 addition & 0 deletions src/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export { esDo } from './bs-moment/i18n/es-do';
export { esUs } from './bs-moment/i18n/es-us';
export { fr } from './bs-moment/i18n/fr';
export { hi } from './bs-moment/i18n/hi';
export { hu } from './bs-moment/i18n/hu';
export { it } from './bs-moment/i18n/it';
export { ja } from './bs-moment/i18n/ja';
export { ko } from './bs-moment/i18n/ko';
Expand Down

0 comments on commit 5370c6a

Please sign in to comment.