Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/app/atp-library/preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { IDisplayPreference } from './definitions';

const arabic = new Intl.NumberFormat('ar-AE');
const persian = new Intl.NumberFormat('fa-IR');
const brazilian = new Intl.NumberFormat('pt-BR');

export const PersianPreference: IDisplayPreference = {
hour: (x) => persian.format(x),
Expand Down Expand Up @@ -60,6 +61,25 @@ export const ChinesePreference: IDisplayPreference = {
}
};

export const BrazilianPreference: IDisplayPreference = {
hour: (x) => x,
minute: (x) => {
let exp = x;
if (exp.length === 1) {
exp = brazilian.format(0) + exp;
}
return exp;
},
separator: ':',
period: (x) => x === 'AM' ? 'Manhã' : 'Tarde',
clockHour: (x) => x,
clockMinute: (x) => x,
labels: {
ok: 'Ok',
cancel: 'Cancelar'
}
};

export const Preference = (locale: string): IDisplayPreference => {
switch (locale) {
case 'fa':
Expand All @@ -68,6 +88,8 @@ export const Preference = (locale: string): IDisplayPreference => {
return ArabicPreference;
case 'zh':
return ChinesePreference;
case 'br':
return BrazilianPreference;
default:
return null;
}
Expand Down