From caee0a499fcc5841ecd57eaa423114923fc751ba Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 14 Mar 2019 14:23:52 +0100 Subject: [PATCH 1/4] Updated Danish localization --- LOCALIZATION.md | 2 +- packages/component/src/Localization/da-DK.js | 82 +++++++++++++++++--- 2 files changed, 72 insertions(+), 12 deletions(-) diff --git a/LOCALIZATION.md b/LOCALIZATION.md index b09b2e7d5a..56163c3a74 100644 --- a/LOCALIZATION.md +++ b/LOCALIZATION.md @@ -7,7 +7,7 @@ If you want to help to translate Web Chat to different language, please submit a | Language code | Translator | | -------------- | --------------------- | | cs-cz | @msimecek | -| da-dk | Thomas Skødt Andersen | +| da-dk | @Simon_lfr, Thomas Skødt Andersen | | de-de | @matmuenzel | | el-gr | @qdoop | | es-es | @SantiEspada, @ckgrafico | diff --git a/packages/component/src/Localization/da-DK.js b/packages/component/src/Localization/da-DK.js index a3c04f1476..69ef7e3e6b 100644 --- a/packages/component/src/Localization/da-DK.js +++ b/packages/component/src/Localization/da-DK.js @@ -1,23 +1,83 @@ +function botSaidSomething(avatarInitials, text, timestamp) { + return `Bot ${ avatarInitials } sagde, ${ text }, ${ xMinutesAgo(timestamp) }`; +} + +function userSaidSomething(avatarInitials, text, timestamp) { + return `Bruger ${ avatarInitials } sagde, ${ text }, ${ xMinutesAgo(timestamp) }`; +} + +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 'Lige nu'; + } else if (deltaInMinutes === 1) { + return 'Et minut siden'; + } else if (deltaInHours < 1) { + return `${ deltaInMinutes } minutter siden`; + } else if (deltaInHours === 1) { + return `En time siden`; + } else if (deltaInHours < 5) { + return `${ deltaInHours } timer siden`; + } else if (deltaInHours <= 24) { + return `Idag`; + } else if (deltaInHours <= 48) { + return `Igår`; + } else if (window.Intl) { + return new Intl.DateTimeFormat('da-DK').format(date); + } else { + return date.toLocaleString('da-DK', { + day: '2-digit', + hour: '2-digit', + hour12: false, + minute: '2-digit', + month: '2-digit', + year: 'numeric', + }); + } +} + + export default { - // FAILED_CONNECTION_NOTIFICATION: '', + FAILED_CONNECTION_NOTIFICATION: 'Kunne ikke tilslutte', // Do not localize {Retry}; it is a placeholder for "Retry". English translation should be, "Send failed. Retry." SEND_FAILED_KEY: 'ikke sendt, {Retry}.', - // SLOW_CONNECTION_NOTIFICATION: '', + SLOW_CONNECTION_NOTIFICATION: 'Det tager længere tid at tilslutte end forventet', + 'Bot said something': botSaidSomething, + 'User said something': userSaidSomething, + 'X minutes ago': xMinutesAgo, + // '[File of type '%1']': '[File of type '%1']", + // '[Unknown Card '%1']': '[Unknown Card '%1']', + 'Adaptive Card parse error' : 'Adaptive Card parse fejl', + 'Adaptive Card render error': 'Adaptive Card renderings-fejl', 'Chat': 'Chat', - // 'Download file': '', - // 'Microphone off': '', - // 'Microphone on': '', + 'Download file': 'Hent fil', + 'Microphone off': 'Mikrofon slukket', + 'Microphone on': 'Mikrofon tændt', 'Listening…': 'Lytter…', + 'Left': 'Venstre', + 'New messages': 'Ny besked', + 'Right': 'Højre', 'retry': 'prøv igen', - 'Retry': '{retry}', // Please alter this value if 'Retry' at the beginning of a sentence is written differently than at the end of a sentence. - 'Sending': 'sender', - // 'Starting…': '', + 'Retry': '{prøv igen}', // Please alter this value if 'Retry' at the beginning of a sentence is written differently than at the end of a sentence. + 'Sending': 'Sender', + 'Starting…': 'Starter...', 'Tax': 'Skat', 'Total': 'Total', 'VAT': 'Moms', 'Send': 'Send', - // 'Speak': '', - // 'Upload file': '', + 'Speak': 'Tal', + 'Upload file': 'Upload fil', 'Type your message': 'Skriv din besked' // 'X minutes ago': -} +}; From 6c75a1707e0867cf1500787cec942c99309f5423 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 15 Mar 2019 12:31:17 +0100 Subject: [PATCH 2/4] Review changes Deleted redundant line 'X minutes ago'. Deleted { and } on retry line. --- packages/component/src/Localization/da-DK.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/component/src/Localization/da-DK.js b/packages/component/src/Localization/da-DK.js index 69ef7e3e6b..2774bbc48f 100644 --- a/packages/component/src/Localization/da-DK.js +++ b/packages/component/src/Localization/da-DK.js @@ -69,7 +69,7 @@ export default { 'New messages': 'Ny besked', 'Right': 'Højre', 'retry': 'prøv igen', - 'Retry': '{prøv igen}', // Please alter this value if 'Retry' at the beginning of a sentence is written differently than at the end of a sentence. + 'Retry': 'prøv igen', // Please alter this value if 'Retry' at the beginning of a sentence is written differently than at the end of a sentence. 'Sending': 'Sender', 'Starting…': 'Starter...', 'Tax': 'Skat', @@ -79,5 +79,4 @@ export default { 'Speak': 'Tal', 'Upload file': 'Upload fil', 'Type your message': 'Skriv din besked' - // 'X minutes ago': }; From cea56d0178309bf29d418284db66b7caf3657c34 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 16 Mar 2019 00:54:12 +0100 Subject: [PATCH 3/4] updated changelog.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d78daa3ac..63920129a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - 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) +- Update Danish by [@simon_lfr](https://github.com/LTank) in PR [#1810](https://github.com/Microsoft/BotFramework-WebChat/pull/1810) ### 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 a797ee5cf500daf94f847272ee836d327ef2bc0f Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 19 Mar 2019 09:54:49 +0100 Subject: [PATCH 4/4] Changed the Retry value back to {retry} --- packages/component/src/Localization/da-DK.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/component/src/Localization/da-DK.js b/packages/component/src/Localization/da-DK.js index 2774bbc48f..e72c289629 100644 --- a/packages/component/src/Localization/da-DK.js +++ b/packages/component/src/Localization/da-DK.js @@ -69,7 +69,7 @@ export default { 'New messages': 'Ny besked', 'Right': 'Højre', 'retry': 'prøv igen', - 'Retry': 'prøv igen', // Please alter this value if 'Retry' at the beginning of a sentence is written differently than at the end of a sentence. + 'Retry': '{retry}', // Please alter this value if 'Retry' at the beginning of a sentence is written differently than at the end of a sentence. 'Sending': 'Sender', 'Starting…': 'Starter...', 'Tax': 'Skat',