Skip to content

Commit

Permalink
Update pt-PT.js (#2005)
Browse files Browse the repository at this point in the history
* Update pt-PT.js

Added portuguese localization texts

* Update CHANGELOG.md

* Update LOCALIZATION.md
  • Loading branch information
bodyzatva authored and corinagum committed May 21, 2019
1 parent b06f367 commit 19e7470
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 11 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
-->

### Added
- `*`: Added [`eslint`](https://npmjs.com/package/eslint/) to static code analysis, by [@compulim](https://github.com/compulim), in PR [#1970](https://github.com/microsoft/BotFramework-WebChat/pull/1970) and PR [#1999](https://github.com/microsoft/BotFramework-WebChat/pull/1999)
- `*`: Added [`eslint`](https://npmjs.com/package/eslint/) to static code analysis, by [@compulim](https://github.com/compulim), in PR [#1970](https://github.com/microsoft/BotFramework-WebChat/pull/1970)
- Added pt-PT language, by [@bodyzatva](https://github.com/bodyzatva) in PR [#2005](https://github.com/microsoft/BotFramework-WebChat/pull/2005)

### Changed
- `*`: Bumps to [`[email protected]`](https://npmjs.com/package/lerna/), by [@corinagum](https://github.com/corinagum), in PR [#1989](https://github.com/Microsoft/BotFramework-WebChat/pull/1989)
Expand Down
2 changes: 1 addition & 1 deletion LOCALIZATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ If you want to help to translate Web Chat to different language, please submit a
| nl-nl | @iMicknl |
| pl-pl | @peterblazejewicz |
| pt-br | @rcarubbi, @pedropacheco92|
| pt-pt | |
| pt-pt | @bodyzatva |
| ru-ru | @odysseus1973, @seaen |
| sv-se | @pekspro |
| tr-tr | |
Expand Down
59 changes: 50 additions & 9 deletions packages/component/src/Localization/pt-PT.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,64 @@
function xMinutesAgo(dateStr) {
const date = new Date(dateStr);
const dateTime = date.getTime();

if (isNaN(dateTime)) {
return dateStr;
}

const now = Date.now();
const deltaInMs = now - dateTime;
const deltaInMinutes = Math.floor(deltaInMs / 60000);
const deltaInHours = Math.floor(deltaInMs / 3600000);

if (deltaInMinutes < 1) {
return 'Agora mesmo';
} else if (deltaInMinutes === 1) {
return 'Um minuto atrás';
} else if (deltaInHours < 1) {
return `${ deltaInMinutes } minutos atrás`;
} else if (deltaInHours === 1) {
return `Uma hora atrás`;
} else if (deltaInHours < 5) {
return `${ deltaInHours } horas atrás`;
} else if (deltaInHours <= 24) {
return `Hoje`;
} else if (deltaInHours <= 48) {
return `Ontem`;
} else if (window.Intl) {
return new Intl.DateTimeFormat('pt-PT').format(date);
} else {
return date.toLocaleString('pt-PT', {
day: '2-digit',
hour: '2-digit',
hour12: false,
minute: '2-digit',
month: '2-digit',
year: 'numeric',
});
}
}

export default {
// FAILED_CONNECTION_NOTIFICATION: '',
// Do not localize {Retry}; it is a placeholder for "Retry". English translation should be, "Send failed. Retry."
SEND_FAILED_KEY: 'não foi possível enviar, {Retry}.',
// SLOW_CONNECTION_NOTIFICATION: '',
SLOW_CONNECTION_NOTIFICATION: 'A ligação está a demorar mais tempo que o normal.',
'Chat': 'Chat',
// 'Download file': '',
// 'Microphone off': '',
// 'Microphone on': '',
'Download file': 'Download ficheiro',
'Microphone off': 'Microfone desligado',
'Microphone on': 'Microfone ligado',
'Listening…': 'A Escutar…',
'retry': 'repetir',
'Retry': '{retry}', // Please alter this value if 'Retry' at the beginning of a sentence is written differently than at the end of a sentence.
'Send': 'Enviar',
'Sending': 'a enviar',
// 'Speak': '',
// 'Starting…': '開始中…',
'Speak': 'Falar',
'Starting…': 'A iniciar…',
'Tax': 'Imposto',
'Total': 'Total',
'Type your message': 'Escreva a sua mensagem',
// 'Upload file': '',
'VAT': 'IVA'
// 'X minutes ago':
'Upload file': 'Upload de ficheiro',
'VAT': 'IVA',
'X minutes ago': xMinutesAgo
}

0 comments on commit 19e7470

Please sign in to comment.