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

Updated Danish localization #1810

Merged
merged 5 commits into from
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion LOCALIZATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
83 changes: 71 additions & 12 deletions packages/component/src/Localization/da-DK.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,82 @@
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}.',
Simonlfr marked this conversation as resolved.
Show resolved Hide resolved
// 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.
corinagum marked this conversation as resolved.
Show resolved Hide resolved
'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':
}
};