From 78dc6ae909c3e18208509ce2267fff05c391bacb Mon Sep 17 00:00:00 2001 From: Ana Paula Date: Sun, 29 Jul 2018 22:53:33 -0300 Subject: [PATCH] Change files to enable Portuguese support --- package.json | 2 +- src/calendar/calendar.js | 2 ++ src/calendar/calendar.ts | 2 ++ src/calendar/pipes/month-name.js | 4 ++++ src/calendar/pipes/month-name.ts | 8 +++++++- 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b4ead83..de7ac99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic3-calendar-en", - "version": "1.1.3", + "version": "1.1.4", "description": "An event calendar component for the Ionic hybrid mobile development platform", "main": "index.js", "scripts": { diff --git a/src/calendar/calendar.js b/src/calendar/calendar.js index 3483959..83aa105 100644 --- a/src/calendar/calendar.js +++ b/src/calendar/calendar.js @@ -38,6 +38,8 @@ var Calendar = (function () { } if (this.lang === 'es') { this.weekHead = ['Dom', 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab']; + } else if (this.lang === 'pt') { + this.weekHead = ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab'] } }; // Jump to today diff --git a/src/calendar/calendar.ts b/src/calendar/calendar.ts index 043b15d..0747714 100644 --- a/src/calendar/calendar.ts +++ b/src/calendar/calendar.ts @@ -69,6 +69,8 @@ export class Calendar { if (!this.lang) { this.lang = 'en'; } if (this.lang === 'es') { this.weekHead = ['Dom', 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab']; + } else if (this.lang === 'pt') { + this.weekHead = ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab'] } } diff --git a/src/calendar/pipes/month-name.js b/src/calendar/pipes/month-name.js index 2fd758c..f287282 100644 --- a/src/calendar/pipes/month-name.js +++ b/src/calendar/pipes/month-name.js @@ -11,10 +11,14 @@ var monthName = (function () { monthName.prototype.transform = function (value, args) { if (args === 'es') { this.lang = 'es'; + } else if (args === 'pt') { + this.lang = 'pt'; } var monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; if (this.lang === 'es') { monthNames = ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre']; + } else if (this.lang === 'pt') { + monthNames = [ 'Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro' ]; } return monthNames[value - 1]; }; diff --git a/src/calendar/pipes/month-name.ts b/src/calendar/pipes/month-name.ts index 9ec1e25..eb65917 100644 --- a/src/calendar/pipes/month-name.ts +++ b/src/calendar/pipes/month-name.ts @@ -6,10 +6,16 @@ import {Pipe} from '@angular/core'; export class monthName { private lang: string; // (es or en) transform(value, args) { - if (args === 'es') { this.lang = 'es'; } + if (args === 'es') { + this.lang = 'es'; + } else if (args === 'pt') { + this.lang = 'pt'; + } let monthNames = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ]; if (this.lang === 'es') { monthNames = [ 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre' ]; + } else if (this.lang === 'pt') { + monthNames = [ 'Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro' ]; } return monthNames[value - 1]; }