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

Updates Swedish translations. #1797

Merged
merged 1 commit into from
Mar 14, 2019
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -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 Swedish by [@pekspro](https://github.com/pekspro) in PR [#1797](https://github.com/Microsoft/BotFramework-WebChat/pull/1797)

### 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)
Expand Down
2 changes: 1 addition & 1 deletion LOCALIZATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ If you want to help to translate Web Chat to different language, please submit a
| pt-br | @rcarubbi, @pedropacheco92|
| pt-pt | |
| ru-ru | @odysseus1973, @seaen |
| sv-se | |
| sv-se | @pekspro |
| tr-tr | |
| zh-hans | @Antimoney |
| zh-hant | @compulim |
Expand Down
83 changes: 71 additions & 12 deletions packages/component/src/Localization/sv-SE.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,82 @@
function botSaidSomething(avatarInitials, text, timestamp) {
return `Bot ${avatarInitials} sa, ${text}, ${xMinutesAgo(timestamp)}`;
}

function userSaidSomething(avatarInitials, text, timestamp) {
return `Användare ${avatarInitials} sa, ${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 'Alldeles nyss';
} else if (deltaInMinutes === 1) {
return 'För en minut sen';
} else if (deltaInHours < 1) {
return `${deltaInMinutes} minuter sedan`;
} else if (deltaInHours === 1) {
return `En timme sen`;
} else if (deltaInHours < 5) {
return `${deltaInHours} timmar sen`;
} else if (deltaInHours <= 24) {
return `Idag`;
} else if (deltaInHours <= 48) {
return `Igår`;
} else if (window.Intl) {
return new Intl.DateTimeFormat('sv-SE').format(date);
} else {
return date.toLocaleString('sv-SE', {
day: '2-digit',
hour: '2-digit',
hour12: false,
minute: '2-digit',
month: '2-digit',
year: 'numeric'
});
}
}

export default {
// FAILED_CONNECTION_NOTIFICATION: '',
FAILED_CONNECTION_NOTIFICATION: 'Kunde inte ansluta.',
// Do not localize {Retry}; it is a placeholder for "Retry". English translation should be, "Send failed. Retry."
SEND_FAILED_KEY: 'kunde inte skicka, {Retry}.',
// SLOW_CONNECTION_NOTIFICATION: '',
SLOW_CONNECTION_NOTIFICATION: 'Det tar längre än vanligt att ansluta.',
'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 error',
'Adaptive Card render error': 'Adaptive Card render error',
'Chat': 'Chatt',
// 'Microphone off': '',
// 'Microphone on': '',
'Download file': 'Ladda ned fil',
'Microphone off': 'Mikrofon av',
'Microphone on': 'Mikrofon på',
'Left': 'Vänster',
'Listening…': 'Lyssnar…',
// 'Download file': '',
'New messages': 'Nya meddelanden',
'Right': 'Höger',
'retry': 'försök 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.
'Send': 'Skicka',
'Sending': 'skickar',
// 'Speak': '',
// 'Starting…': '',
'Sending': 'Skickar',
'Speak': 'Läs upp',
'Starting…': 'Startar…',
'Tax': 'Skatt',
'Total': 'Totalt',
'Type your message': 'Skriv ett meddelande',
// 'Upload file': '',
'Type your message': 'Skriv ditt meddelande',
'Upload file': 'Ladd upp fil',
'VAT': 'Moms'
// 'X minutes ago':
}
};