Skip to content

Commit

Permalink
Merge branch 'master' into test-focus-sink
Browse files Browse the repository at this point in the history
  • Loading branch information
corinagum committed Aug 26, 2019
2 parents f234309 + 28bb2da commit 93d4ec2
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]
- Added missing Norwegian (nb-NO) translations, by [@taarskog](https://github.com/taarskog)
- Added missing Italian (it-IT) translations, by [@AntoT84](https://github.com/AntoT84)

### Breaking changes

Expand Down
2 changes: 1 addition & 1 deletion LOCALIZATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ If you want to help to translate Web Chat to different language, please submit a
| fi-fi | @jsur |
| fr-fr | @meulta, @tao1 |
| hu-hu | |
| it-it | Maurizio Moriconi, @Andrea-Orimoto |
| it-it | Maurizio Moriconi, @Andrea-Orimoto, @AntoT84 |
| ja-jp | @bigplants, @corinagum |
| ko-kr | @Eunji |
| lv-lv | |
Expand Down
83 changes: 80 additions & 3 deletions packages/component/src/Localization/it-IT.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,99 @@
/* 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 'Adesso';
} else if (deltaInMinutes === 1) {
return 'Un minuto fa';
} else if (deltaInHours < 1) {
return `${deltaInMinutes} minuti fa`;
} else if (deltaInHours === 1) {
return `Un ora fa`;
} else if (deltaInHours < 5) {
return `${deltaInHours} ore fa`;
} else if (deltaInHours <= 24) {
return `Oggi`;
} else if (deltaInHours <= 48) {
return `Ieri`;
} else if (window.Intl) {
return new Intl.DateTimeFormat('it-IT').format(date);
}

return date.toLocaleString('it-IT', {
day: '2-digit',
hour: '2-digit',
hour12: false,
minute: '2-digit',
month: '2-digit',
year: 'numeric'
});
}

function botSaidSomething(avatarInitials, text) {
return `Il Bot ${avatarInitials} ha detto, ${text}`;
}

function downloadFileWithFileSize(downloadFileText, fileName, size) {
// Full text should read: "Download file <filename> of size <filesize>"
return `${downloadFileText} ${fileName} di dimensione ${size}`;
}

function uploadFileWithFileSize(fileName, size) {
return `${fileName} di dimensione ${size}`;
}

function userSaidSomething(avatarInitials, text) {
return `L'utente ${avatarInitials} ha detto, ${text}`;
}

export default {
// FAILED_CONNECTION_NOTIFICATION: '',
CONNECTED_NOTIFICATION: 'Connesso',
FAILED_CONNECTION_NOTIFICATION: 'Impossibile connettersi.',
INITIAL_CONNECTION_NOTIFICATION: 'In connessione…',
INTERRUPTED_CONNECTION_NOTIFICATION: 'La connessione è stata interrotta. Riconnessione…',
RENDER_ERROR_NOTIFICATION: 'Errore di visualizzazione. Contatta lo sviluppatore del bot.',
// Do not localize {Retry}; it is a placeholder for "Retry". English translation should be, "Send failed. Retry."
SEND_FAILED_KEY: `Impossibile inviare, {Retry}.`,
// SLOW_CONNECTION_NOTIFICATION: '',
SLOW_CONNECTION_NOTIFICATION: 'Il Bot sta impiegando più tempo del solito per connettersi.',
'Bot said something': botSaidSomething,
'User said something': userSaidSomething,
'X minutes ago': xMinutesAgo,
'Adaptive Card parse error': 'Adaptive Card, errore di interpretazione',
'Adaptive Card render error': 'Adaptive Card, errore di visualizzazione',
BotSent: 'Il Bot ha inviato: ',
Chat: 'Chat',
'Download file': 'Download file',
DownloadFileWithFileSize: downloadFileWithFileSize,
ErrorMessage: 'Messaggio di errore',
'Microphone off': 'Microfono spento',
'Microphone on': 'Microfono acceso',
Left: 'Sinistra',
'Listening…': 'Ascoltando…',
'New messages': 'Nuovi messaggi',
Retry: 'Riprova',
Right: 'Destra',
Send: 'Invia',
Sending: 'invio',
SendStatus: 'Stato di invio: ',
SentAt: 'Inviato a: ',
Speak: 'Parla',
'Starting…': 'Inizializzando…',
Tax: 'Tasse',
Total: 'Totale',
'Type your message': 'Scrivi il tuo messaggio',
'Upload file': 'Carica un file',
UploadFileWithFileSize: uploadFileWithFileSize,
VAT: 'IVA'
// 'X minutes ago':
};

0 comments on commit 93d4ec2

Please sign in to comment.