Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added more translations to Finnish localization #2501

Merged
merged 7 commits into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion LOCALIZATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
99 changes: 90 additions & 9 deletions packages/component/src/Localization/fi-FI.js
Original file line number Diff line number Diff line change
@@ -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 <filename> of size <filesize>"
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':
};