-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed locale pt-br not being used and added extra suport for pt-br (#…
…1745) * fixed locale pt-br not being used and added extra suport for pt-br * translating missing values pt-br * update CHANGELOG and LOCALIZATION
- Loading branch information
1 parent
c3b2a6d
commit db34ce4
Showing
4 changed files
with
52 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,64 @@ | ||
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 'Agora a pouco'; | ||
} else if (deltaInMinutes === 1) { | ||
return 'Um minuto atrás'; | ||
} else if (deltaInHours < 1) { | ||
return `${ deltaInMinutes } minutos atrás`; | ||
} else if (deltaInHours === 1) { | ||
return `Uma hora atrás`; | ||
} else if (deltaInHours < 5) { | ||
return `${ deltaInHours } horas atrás`; | ||
} else if (deltaInHours <= 24) { | ||
return `Hoje`; | ||
} else if (deltaInHours <= 48) { | ||
return `Ontem`; | ||
} else if (window.Intl) { | ||
return new Intl.DateTimeFormat('pt-BR').format(date); | ||
} else { | ||
return date.toLocaleString('pt-BR', { | ||
day: '2-digit', | ||
hour: '2-digit', | ||
hour12: false, | ||
minute: '2-digit', | ||
month: '2-digit', | ||
year: 'numeric', | ||
}); | ||
} | ||
} | ||
|
||
export default { | ||
// FAILED_CONNECTION_NOTIFICATION: '', | ||
FAILED_CONNECTION_NOTIFICATION: 'Não foi possível conectar', | ||
// Do not localize {Retry}; it is a placeholder for "Retry". English translation should be, "Send failed. Retry." | ||
SEND_FAILED_KEY: 'não pude enviar, {Retry}.', | ||
// SLOW_CONNECTION_NOTIFICATION: '', | ||
SLOW_CONNECTION_NOTIFICATION: 'A conexão está levando mais tempo que o normal.', | ||
'Chat': 'Bate-papo', | ||
// 'Download file': '', | ||
// 'Microphone off': '', | ||
// 'Microphone on': '', | ||
'Download file': 'Baixar arquivo', | ||
'Microphone off': 'Microfone desligado', | ||
'Microphone on': 'Microfone ligado', | ||
'Listening…': 'Ouvindo…', | ||
'retry': 'repetir', | ||
'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': 'Enviar', | ||
'Sending': 'enviando', | ||
'Speak': 'Falar', | ||
// 'Starting…': '', | ||
'Starting…': 'Iniciando…', | ||
'Tax': 'Imposto', | ||
'Total': 'Total', | ||
'Type your message': 'Digite sua mensagem', | ||
'Upload file': 'Subir arquivo', | ||
'VAT': 'VAT' | ||
// 'X minutes ago': | ||
'VAT': 'VAT', | ||
'X minutes ago': xMinutesAgo | ||
} |