-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
201 additions
and
201 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/** | ||
* Translates a time ago message from English to Brazilian Portuguese. | ||
* | ||
* @param {string} textValue The text message to be translated. | ||
* @param {number} numberValue The number value to be used in the message. | ||
* @returns The message translated. | ||
*/ | ||
function translateTimeAgoPtBr(textValue: string, numberValue: number): string { | ||
if (textValue.includes('year')) { | ||
return textValue.includes('s ') | ||
? `${numberValue} anos atrás` | ||
: `${numberValue} ano atrás`; | ||
} | ||
else if (textValue.includes('month')) { | ||
return textValue.includes('s ') | ||
? `${numberValue} meses atrás` | ||
: `${numberValue} mês atrás`; | ||
} | ||
else if (textValue.includes('days')) { | ||
return textValue.includes('s ') | ||
? `${numberValue} dias atrás` | ||
: `${numberValue} dia atrás`; | ||
} | ||
else if (textValue.includes('hour')) { | ||
return textValue.includes('s ') | ||
? `${numberValue} horas atrás` | ||
: `${numberValue} hora atrás`; | ||
} | ||
else if (textValue.includes('minutes')) { | ||
return textValue.includes('s ') | ||
? `${numberValue} minutos atrás` | ||
: `${numberValue} minuto atrás`; | ||
} | ||
else if (textValue.includes('seconds')) { | ||
return textValue.includes('s ') | ||
? `${numberValue} segundos atrás` | ||
: `${numberValue} segundo atrás`; | ||
} | ||
|
||
return 'Momentos atrás'; | ||
} | ||
|
||
/** | ||
* Translates a time left message from English to Brazilian Portuguese. | ||
* | ||
* @param {string} textValue The text message to be translated. | ||
* @param {number} numberValue The number value to be used in the message. | ||
* @returns The message translated. | ||
*/ | ||
function translateTimeLeftPtBr(textValue: string, numberValue: number): string { | ||
if (textValue.includes('year')) { | ||
return textValue.includes('s ') | ||
? `${numberValue} anos restantes` | ||
: `${numberValue} ano restante`; | ||
} | ||
else if (textValue.includes('month')) { | ||
return textValue.includes('s ') | ||
? `${numberValue} meses restantes` | ||
: `${numberValue} mês restante`; | ||
} | ||
else if (textValue.includes('day')) { | ||
return textValue.includes('s ') | ||
? `${numberValue} dias restantes` | ||
: `${numberValue} dia restante`; | ||
} | ||
return textValue; | ||
} | ||
|
||
export { translateTimeAgoPtBr, translateTimeLeftPtBr }; |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
function translateTimeAgoRu(textValue: string, numberValue: number): string { | ||
if (textValue.includes('year')) { | ||
return textValue.includes('s ') | ||
? `${numberValue} года назад` | ||
: `${numberValue} год назад`; | ||
} | ||
else if (textValue.includes('month')) { | ||
return textValue.includes('s ') | ||
? `${numberValue} месяца назад` | ||
: `${numberValue} месяц назад`; | ||
} | ||
else if (textValue.includes('days')) { | ||
return textValue.includes('s ') | ||
? `${numberValue} дня назад` | ||
: `${numberValue} день назад`; | ||
} | ||
else if (textValue.includes('hour')) { | ||
return textValue.includes('s ') | ||
? `${numberValue} часа назад` | ||
: `${numberValue} час назад`; | ||
} | ||
else if (textValue.includes('minutes')) { | ||
return textValue.includes('s ') | ||
? `${numberValue} минуты назад` | ||
: `${numberValue} минуту назад`; | ||
} | ||
else if (textValue.includes('seconds')) { | ||
return textValue.includes('s ') | ||
? `${numberValue} секунд назад` | ||
: `${numberValue} секунду назад`; | ||
} | ||
|
||
return 'Несколько минут назад'; | ||
} | ||
|
||
export { translateTimeAgoRu }; |
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/** | ||
* Translates a time ago message from English to Spanish. | ||
* | ||
* @param {string} textValue The text message to be translated. | ||
* @param {number} numberValue The number value to be used in the message. | ||
* @returns The message translated. | ||
*/ | ||
function translateTimeAgoEs(textValue: string, numberValue: number): string { | ||
if (textValue.includes('year')) { | ||
return textValue.includes('s ') | ||
? `Hace ${numberValue} años` | ||
: `Hace ${numberValue} año`; | ||
} | ||
else if (textValue.includes('month')) { | ||
return textValue.includes('s ') | ||
? `Hace ${numberValue} meses` | ||
: `Hace ${numberValue} mes`; | ||
} | ||
else if (textValue.includes('days')) { | ||
return textValue.includes('s ') | ||
? `Hace ${numberValue} días` | ||
: `Hace ${numberValue} día`; | ||
} | ||
else if (textValue.includes('hour')) { | ||
return textValue.includes('s ') | ||
? `Hace ${numberValue} horas` | ||
: `Hace ${numberValue} hora`; | ||
} | ||
else if (textValue.includes('minutes')) { | ||
return textValue.includes('s ') | ||
? `Hace ${numberValue} minutos` | ||
: `Hace ${numberValue} minuto`; | ||
} | ||
else if (textValue.includes('seconds')) { | ||
return textValue.includes('s ') | ||
? `Hace ${numberValue} segundos` | ||
: `Hace ${numberValue} segundo`; | ||
} | ||
|
||
return 'Hace momentos'; | ||
} | ||
|
||
/** | ||
* Translates a time left message from English to Spanish. | ||
* | ||
* @param {string} textValue The text message to be translated. | ||
* @param {number} numberValue The number value to be used in the message. | ||
* @returns The message translated. | ||
*/ | ||
function translateTimeLeftEs(textValue: string, numberValue: number): string { | ||
if (textValue.includes('year')) { | ||
return textValue.includes('s ') | ||
? `Faltan ${numberValue} años` | ||
: `Falta ${numberValue} año`; | ||
} | ||
else if (textValue.includes('month')) { | ||
return textValue.includes('s ') | ||
? `Faltan ${numberValue} meses` | ||
: `Falta ${numberValue} mes`; | ||
} | ||
else if (textValue.includes('day')) { | ||
return textValue.includes('s ') | ||
? `Faltan ${numberValue} días` | ||
: `Falta ${numberValue} día`; | ||
} | ||
return textValue; | ||
} | ||
|
||
export { translateTimeAgoEs, translateTimeLeftEs }; |
Oops, something went wrong.