diff --git a/CHANGELOG.md b/CHANGELOG.md index 2eb61b0634..2bab46d74e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - 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 Swedish by [@pekspro](https://github.com/pekspro) in PR [#1797](https://github.com/Microsoft/BotFramework-WebChat/pull/1797) +- Update Dutch locale by [@imicknl](https://github.com/imicknl) in PR [#1812](https://github.com/Microsoft/BotFramework-WebChat/pull/1812) ### 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) diff --git a/packages/component/src/Localization/nl-NL.js b/packages/component/src/Localization/nl-NL.js index 8bc9c52fb7..345dba4dd1 100644 --- a/packages/component/src/Localization/nl-NL.js +++ b/packages/component/src/Localization/nl-NL.js @@ -1,23 +1,71 @@ +function botSaidSomething(avatarInitials, text, timestamp) { + return `Bot ${avatarInitials} zei; ${text}, ${xMinutesAgo(timestamp)}`; +} + +function userSaidSomething(avatarInitials, text, timestamp) { + return `Gebruiker ${avatarInitials} zei; ${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 'Zojuist'; + } else if (deltaInMinutes === 1) { + return 'Een minuut geleden'; + } else if (deltaInHours < 1) { + return `${deltaInMinutes} minuten geleden`; + } else if (deltaInHours === 1) { + return `Een uur geleden`; + } else if (deltaInHours < 5) { + return `${deltaInHours} uur geleden`; + } else if (deltaInHours <= 24) { + return `Vandaag`; + } else if (deltaInHours <= 48) { + return `Gisteren`; + } else if (window.Intl) { + return new Intl.DateTimeFormat('nl-NL').format(date); + } else { + return date.toLocaleString('nl-NL', { + 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: 'versturen mislukt, {Retry}.', - // SLOW_CONNECTION_NOTIFICATION: '', + FAILED_CONNECTION_NOTIFICATION: 'Verbinding maken niet mogelijk.', + SEND_FAILED_KEY: 'Versturen mislukt, {retry}.', + SLOW_CONNECTION_NOTIFICATION: 'Verbinding maken duurt langer dan normaal…', 'Chat': 'Chat', - // 'Download file': '', - // 'Microphone off': '', - // 'Microphone on': '', + 'Download file': 'Bestand downloaden', + 'Microphone off': 'Microfoon uit', + 'Microphone on': 'Microfoon aan', 'Listening…': 'Aan het luisteren…', - 'retry': 'opnieuw', - 'Retry': '{retry}', // Please alter this value if 'Retry' at the beginning of a sentence is written differently than at the end of a sentence. + 'retry': 'probeer opnieuw', + 'Retry': 'Opnieuw proberen', 'Send': 'Verstuur', 'Sending': 'versturen', 'Speak': 'Spreek', - // 'Starting…': '', + 'Starting…': 'Starten…', 'Tax': 'BTW', 'Total': 'Totaal', 'Type your message': 'Typ je bericht', 'Upload file': 'Bestand uploaden', - 'VAT': 'VAT' - // 'X minutes ago': + 'VAT': 'VAT', + 'X minutes ago': xMinutesAgo }