|
| 1 | +function botSaidSomething(avatarInitials, text, timestamp) { |
| 2 | + return `Bot ${ avatarInitials } sagde, ${ text }, ${ xMinutesAgo(timestamp) }`; |
| 3 | +} |
| 4 | + |
| 5 | +function userSaidSomething(avatarInitials, text, timestamp) { |
| 6 | + return `Bruger ${ avatarInitials } sagde, ${ text }, ${ xMinutesAgo(timestamp) }`; |
| 7 | +} |
| 8 | + |
| 9 | +function xMinutesAgo(dateStr) { |
| 10 | + const date = new Date(dateStr); |
| 11 | + const dateTime = date.getTime(); |
| 12 | + |
| 13 | + if (isNaN(dateTime)) { |
| 14 | + return dateStr; |
| 15 | + } |
| 16 | + |
| 17 | + const now = Date.now(); |
| 18 | + const deltaInMs = now - dateTime; |
| 19 | + const deltaInMinutes = Math.floor(deltaInMs / 60000); |
| 20 | + const deltaInHours = Math.floor(deltaInMs / 3600000); |
| 21 | + |
| 22 | + if (deltaInMinutes < 1) { |
| 23 | + return 'Lige nu'; |
| 24 | + } else if (deltaInMinutes === 1) { |
| 25 | + return 'Et minut siden'; |
| 26 | + } else if (deltaInHours < 1) { |
| 27 | + return `${ deltaInMinutes } minutter siden`; |
| 28 | + } else if (deltaInHours === 1) { |
| 29 | + return `En time siden`; |
| 30 | + } else if (deltaInHours < 5) { |
| 31 | + return `${ deltaInHours } timer siden`; |
| 32 | + } else if (deltaInHours <= 24) { |
| 33 | + return `Idag`; |
| 34 | + } else if (deltaInHours <= 48) { |
| 35 | + return `Igår`; |
| 36 | + } else if (window.Intl) { |
| 37 | + return new Intl.DateTimeFormat('da-DK').format(date); |
| 38 | + } else { |
| 39 | + return date.toLocaleString('da-DK', { |
| 40 | + day: '2-digit', |
| 41 | + hour: '2-digit', |
| 42 | + hour12: false, |
| 43 | + minute: '2-digit', |
| 44 | + month: '2-digit', |
| 45 | + year: 'numeric', |
| 46 | + }); |
| 47 | + } |
| 48 | +} |
| 49 | + |
| 50 | + |
1 | 51 | export default { |
2 | | - // FAILED_CONNECTION_NOTIFICATION: '', |
| 52 | + FAILED_CONNECTION_NOTIFICATION: 'Kunne ikke tilslutte', |
3 | 53 | // Do not localize {Retry}; it is a placeholder for "Retry". English translation should be, "Send failed. Retry." |
4 | 54 | SEND_FAILED_KEY: 'ikke sendt, {Retry}.', |
5 | | - // SLOW_CONNECTION_NOTIFICATION: '', |
| 55 | + SLOW_CONNECTION_NOTIFICATION: 'Det tager længere tid at tilslutte end forventet', |
| 56 | + 'Bot said something': botSaidSomething, |
| 57 | + 'User said something': userSaidSomething, |
| 58 | + 'X minutes ago': xMinutesAgo, |
| 59 | + // '[File of type '%1']': '[File of type '%1']", |
| 60 | + // '[Unknown Card '%1']': '[Unknown Card '%1']', |
| 61 | + 'Adaptive Card parse error' : 'Adaptive Card parse fejl', |
| 62 | + 'Adaptive Card render error': 'Adaptive Card renderings-fejl', |
6 | 63 | 'Chat': 'Chat', |
7 | | - // 'Download file': '', |
8 | | - // 'Microphone off': '', |
9 | | - // 'Microphone on': '', |
| 64 | + 'Download file': 'Hent fil', |
| 65 | + 'Microphone off': 'Mikrofon slukket', |
| 66 | + 'Microphone on': 'Mikrofon tændt', |
10 | 67 | 'Listening…': 'Lytter…', |
| 68 | + 'Left': 'Venstre', |
| 69 | + 'New messages': 'Ny besked', |
| 70 | + 'Right': 'Højre', |
11 | 71 | 'retry': 'prøv igen', |
12 | 72 | 'Retry': '{retry}', // Please alter this value if 'Retry' at the beginning of a sentence is written differently than at the end of a sentence. |
13 | | - 'Sending': 'sender', |
14 | | - // 'Starting…': '', |
| 73 | + 'Sending': 'Sender', |
| 74 | + 'Starting…': 'Starter...', |
15 | 75 | 'Tax': 'Skat', |
16 | 76 | 'Total': 'Total', |
17 | 77 | 'VAT': 'Moms', |
18 | 78 | 'Send': 'Send', |
19 | | - // 'Speak': '', |
20 | | - // 'Upload file': '', |
| 79 | + 'Speak': 'Tal', |
| 80 | + 'Upload file': 'Upload fil', |
21 | 81 | 'Type your message': 'Skriv din besked' |
22 | | - // 'X minutes ago': |
23 | | -} |
| 82 | +}; |
0 commit comments