diff --git a/CHANGELOG.md b/CHANGELOG.md index f3fa6c0624..bb8eb2c02b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -111,6 +111,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added missing Norwegian (nb-NO) translations, by [@taarskog](https://github.com/taarskog) - Added missing Italian (it-IT) translations, by [@AntoT84](https://github.com/AntoT84) - Resolve [#2481](https://github.com/microsoft/BotFramework-WebChat/issues/2481). Support alternative audio input source by adding `audioConfig` prop to `createCognitiveServicesSpeechServicesPonyfillFactory`, by [@corinagum](https://github.com/corinagum), in PR [#2491](https://github.com/microsoft/BotFramework-WebChat/pull/2491) +- Added missing Finnish (fi-FI) translations, by [@sk91swd](https://github.com/sk91swd), in PR [#2501](https://github.com/microsoft/BotFramework-WebChat/pull/2501) ### Samples diff --git a/LOCALIZATION.md b/LOCALIZATION.md index 3cacf4525d..fce716f71e 100644 --- a/LOCALIZATION.md +++ b/LOCALIZATION.md @@ -12,7 +12,7 @@ If you want to help to translate Web Chat to different language, please submit a | de-de | @matmuenzel | | el-gr | @qdoop | | es-es | @SantiEspada, @ckgrafico, @renrous, @axelsrz, @munozemilio | -| fi-fi | @jsur | +| fi-fi | @jsur, @sk91swd | | fr-fr | @meulta, @tao1 | | hu-hu | | | it-it | Maurizio Moriconi, @Andrea-Orimoto, @AntoT84 | diff --git a/packages/component/src/Localization/fi-FI.js b/packages/component/src/Localization/fi-FI.js index 02e44a08c7..7e841d429d 100644 --- a/packages/component/src/Localization/fi-FI.js +++ b/packages/component/src/Localization/fi-FI.js @@ -1,22 +1,103 @@ +/* eslint no-magic-numbers: ["error", { "ignore": [1, 5, 24, 48, 60000, 3600000] }] */ + +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 'Juuri nyt'; + } else if (deltaInMinutes === 1) { + return 'Minuutti sitten'; + } else if (deltaInHours < 1) { + return `${deltaInMinutes} minuuttia sitten`; + } else if (deltaInHours === 1) { + return `Tunti sitten`; + } else if (deltaInHours < 5) { + return `${deltaInHours} tuntia sitten`; + } else if (deltaInHours <= 24) { + return `Tänään`; + } else if (deltaInHours <= 48) { + return `Eilen`; + } else if (window.Intl) { + return new Intl.DateTimeFormat('fi-FI').format(date); + } + + return date.toLocaleString('fi-FI', { + day: '2-digit', + hour: '2-digit', + hour12: false, + minute: '2-digit', + month: '2-digit', + year: 'numeric' + }); +} + +function botSaidSomething(avatarInitials, text) { + return `Botti ${avatarInitials} sanoi, ${text}`; +} + +function downloadFileWithFileSize(downloadFileText, fileName, size) { + // Full text should read: "Download file of size " + return `Lataa tiedosto ${fileName}, koko: ${size}`; +} + +function uploadFileWithFileSize(fileName, size) { + return `${fileName}, koko: ${size}`; +} + +function userSaidSomething(avatarInitials, text) { + return `Käyttäjä ${avatarInitials} sanoi, ${text}`; +} + export default { - // FAILED_CONNECTION_NOTIFICATION: '', + CONNECTED_NOTIFICATION: 'Yhdistetty', + FAILED_CONNECTION_NOTIFICATION: 'Ei voitu yhdistää.', + INITIAL_CONNECTION_NOTIFICATION: 'Yhdistää…', + INTERRUPTED_CONNECTION_NOTIFICATION: 'Yhteys palvelimeen keskeytyi. Yhdistää uudelleen…', + RENDER_ERROR_NOTIFICATION: 'Renderöintivirhe. Ole hyvä ja katso konsolia tai ota yhteys botin kehittäjään.', // Do not localize {Retry}; it is a placeholder for "Retry". English translation should be, "Send failed. Retry." - SEND_FAILED_KEY: `ei voitu lähettää, {Retry}.`, - // SLOW_CONNECTION_NOTIFICATION: '', + SEND_FAILED_KEY: `Lähetys epäonnistui, {Retry}.`, + SLOW_CONNECTION_NOTIFICATION: 'Yhteyden muodostaminen kestää kauemmin kuin yleensä.', + 'Bot said something': botSaidSomething, + 'User said something': userSaidSomething, + 'X minutes ago': xMinutesAgo, + // The following two errors make more sence in English than Finnish + 'Adaptive Card parse error': 'Adaptive Card parse error', + 'Adaptive Card render error': 'Adaptive Card render error', + BotSent: 'Botti lähetti: ', Chat: 'Chat', - // 'Download file': '', - // 'Microphone off': '', - // 'Microphone on': '', + 'Download file': 'Lataa tiedosto', + DownloadFileWithFileSize: downloadFileWithFileSize, + ErrorMessage: 'Virheviesti', + 'Microphone off': 'Mikrofoni pois päältä', + 'Microphone on': 'Mikrofoni päällä', + Left: 'Vasen', 'Listening…': 'Kuuntelee…', + 'New messages': 'Uusia viestejä', Retry: 'yritä uudelleen', + Right: 'Oikea', Send: 'Lähetä', - Sending: 'lähettää', + SendBox: 'Sendbox', + Sending: 'Lähettää…', + SendStatus: 'Lähetyksen tila: ', + SentAt: 'Lähetetty: ', Speak: 'Puhu', - // 'Starting…': '', + 'Starting…': 'Aloittaa…', Tax: 'Vero', Total: 'Yhteensä', 'Type your message': 'Kirjoita viesti', + TypingIndicator: 'Kirjoitusindikaattori näkyy', 'Upload file': 'Lataa tiedosto', + UploadFileWithFileSize: uploadFileWithFileSize, + UserSent: 'Käyttäjä lähetti: ', VAT: 'ALV' - // 'X minutes ago': };