From 06efe1eb3a8ebc89c60884da25bcf87962c6265f Mon Sep 17 00:00:00 2001 From: Quique Fdez Guerra Date: Mon, 25 Feb 2019 18:41:47 +0100 Subject: [PATCH 1/4] Update Spanish localization --- packages/component/src/Localization/es-ES.js | 27 +++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/packages/component/src/Localization/es-ES.js b/packages/component/src/Localization/es-ES.js index 838d2698e8..26c73058ac 100644 --- a/packages/component/src/Localization/es-ES.js +++ b/packages/component/src/Localization/es-ES.js @@ -1,8 +1,34 @@ +function xMinutesAgo(date) { + const now = Date.now(); + const deltaInMs = now - new Date(date).getTime(); + const deltaInMinutes = Math.floor(deltaInMs / 60000); + const deltaInHours = Math.floor(deltaInMs / 3600000); + + if (deltaInMinutes < 1) { + return 'Ahora'; + } else if (deltaInMinutes === 1) { + return 'Hace un minuto'; + } else if (deltaInHours < 1) { + return `Hace ${deltaInMinutes} minutos`; + } else if (deltaInHours === 1) { + return `Hace una hora`; + } else if (deltaInHours < 5) { + return `Hace ${deltaInHours} horas`; + } else if (deltaInHours <= 24) { + return `Hoy`; + } else if (deltaInHours <= 48) { + return `Ayer`; + } else { + return new Intl.DateTimeFormat('es-ES').format(date); + } +} + 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: 'No enviado. {Retry}.', // SLOW_CONNECTION_NOTIFICATION: '', + 'X minutes ago': xMinutesAgo, 'Chat': 'Chat', 'Microphone off': 'Apagar micrófono', 'Microphone on': 'Encender micrófono', @@ -20,5 +46,4 @@ export default { 'Type your message': 'Escribe tu mensaje...', 'Upload file': 'Subir archivo', 'VAT': 'IVA' - // 'X minutes ago': } From fd21f8d120813030e4e8957be2ef5f3da29f8392 Mon Sep 17 00:00:00 2001 From: Quique Fdez Guerra Date: Tue, 26 Feb 2019 09:46:40 +0100 Subject: [PATCH 2/4] Update es-ES.js --- packages/component/src/Localization/es-ES.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/component/src/Localization/es-ES.js b/packages/component/src/Localization/es-ES.js index 26c73058ac..e9d63bd140 100644 --- a/packages/component/src/Localization/es-ES.js +++ b/packages/component/src/Localization/es-ES.js @@ -24,10 +24,10 @@ function xMinutesAgo(date) { } export default { - // FAILED_CONNECTION_NOTIFICATION: '', + FAILED_CONNECTION_NOTIFICATION: 'Imposible conectar.', // Do not localize {Retry}; it is a placeholder for "Retry". English translation should be, "Send failed. Retry." SEND_FAILED_KEY: 'No enviado. {Retry}.', - // SLOW_CONNECTION_NOTIFICATION: '', + SLOW_CONNECTION_NOTIFICATION: 'Está tardando mucho en conectar.', 'X minutes ago': xMinutesAgo, 'Chat': 'Chat', 'Microphone off': 'Apagar micrófono', From bcdb1404098ecd7255602e770840d288653b1dfd Mon Sep 17 00:00:00 2001 From: Quique Fdez Guerra Date: Tue, 26 Feb 2019 09:47:48 +0100 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a28e2a7fc8..557e06200d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `component`: Bump to [`react-film@1.1.2`](https://npmjs.com/package/react-film/) and [`react-scroll-to-bottom@1.3.1`](https://npmjs.com/package/react-scroll-to-bottom/), by [@compulim](https://github.com/compulim), in PR [#1621](https://github.com/Microsoft/BotFramework-WebChat/pull/1621) and PR [#1725](https://github.com/Microsoft/BotFramework-WebChat/pull/1725) - Expand german locale by [@matmuenzel](https://github.com/matmuenzel) in PR [#1740](https://github.com/Microsoft/BotFramework-WebChat/pull/1740) - Update Russian and Japanese locale by [@corinagum](https://github.com/corinagum) in PR [#1747](https://github.com/Microsoft/BotFramework-WebChat/pull/1747) +- Update Spanish by [@ckgrafico](https://github.com/ckgrafico) in PR [#1757](https://github.com/Microsoft/BotFramework-WebChat/pull/1757) ### Fixed - Fix [#1360](https://github.com/Microsoft/BotFramework-WebChat/issues/1360). Added `roles` to components of Web Chat, by [@corinagum](https://github.com/corinagum) in PR [#1462](https://github.com/Microsoft/BotFramework-WebChat/pull/1462) From 94e4b79abc122c86571795b09772d219580736bc Mon Sep 17 00:00:00 2001 From: Quique Fdez Guerra Date: Tue, 26 Feb 2019 09:48:11 +0100 Subject: [PATCH 4/4] Update LOCALIZATION.md --- LOCALIZATION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LOCALIZATION.md b/LOCALIZATION.md index 9fe9201bc5..b09b2e7d5a 100644 --- a/LOCALIZATION.md +++ b/LOCALIZATION.md @@ -10,7 +10,7 @@ If you want to help to translate Web Chat to different language, please submit a | da-dk | Thomas Skødt Andersen | | de-de | @matmuenzel | | el-gr | @qdoop | -| es-es | @SantiEspada | +| es-es | @SantiEspada, @ckgrafico | | fi-fi | @jsur | | fr-fr | @meulta, @tao1 | | hu-hu | |