include words for relativetime

This commit is contained in:
Diego Najar 2021-10-06 18:15:02 +02:00
parent 696d6ca828
commit fc4d8ed7b2
3 changed files with 43 additions and 12 deletions

View file

@ -652,6 +652,8 @@ class Page {
*/
public function relativeTime(bool $complete=false): string
{
global $language;
$current = new DateTime;
$past = new DateTime($this->getValue('dateRaw'));
$elapsed = $current->diff($past);
@ -660,13 +662,13 @@ class Page {
$elapsed->d -= $elapsed->w * 7;
$string = array(
'y' => 'year',
'm' => 'month',
'w' => 'week',
'd' => 'day',
'h' => 'hour',
'i' => 'minute',
's' => 'second',
'y' => $language->g('year'),
'm' => $language->g('month'),
'w' => $language->g('week'),
'd' => $language->g('day'),
'h' => $language->g('hour'),
'i' => $language->g('minute'),
's' => $language->g('second')
);
foreach ($string as $key => &$value) {
@ -681,7 +683,7 @@ class Page {
$string = array_slice($string, 0 , 1);
}
return $string ? implode(', ', $string) . ' ago' : 'Just now';
return $string ? implode(', ', $string) . ' '.$language->g('ago') : $language->g('Just now');
}
}

View file

@ -398,5 +398,11 @@
"insert-file": "Insert file",
"insert-original-size": "Insert original size",
"insert-small-size": "Insert small size",
"insert-medium-size": "Insert medium size"
"insert-medium-size": "Insert medium size",
"year": "year",
"month": "month",
"week": "week",
"day": "day",
"hour": "hour",
"second": "second"
}

View file

@ -291,7 +291,6 @@
"extreme-friendly-url": "URL amistosas",
"title-formats": "Formatos de los títulos",
"delete-content": "Eliminar contenido",
"are-you-sure-you-want-to-delete-this-page": "¿Confirma que desea eliminar esta página?",
"sticky": "Sticky",
"actions": "Acciones",
"edit": "Editar",
@ -314,7 +313,6 @@
"uncategorized": "Sin categoría",
"done": "Hecho",
"delete-category": "Eliminar categoría",
"are-you-sure-you-want-to-delete-this-category?": "¿Confirma que desea eliminar esta categoría?",
"confirm-new-password": "Confirmar nueva contraseña",
"the-nickname-is-almost-used-in-the-themes-to-display-the-author-of-the-content": "El apodo casi siempre es utilizado en los temas para mostrar el autor del contenido.",
"allow-unicode": "Permitir Unicode",
@ -376,5 +374,30 @@
"custom-fields": "Campos personalizados",
"define-custom-fields-for-the-content": "Defina campos personalizados para el contenido. Obtenga más información acerca de los campos personalizados en la <a href='https:\/\/docs.bludit.com\/en\/content\/custom-fields'>documentación<\/a>.",
"start-typing-to-see-a-list-of-suggestions": "Comience a escribir para ver una lista de sugerencias.",
"view": "Ver"
"view": "Ver",
"confirm": "Confirm",
"current-password": "Current password",
"are-you-sure-you-want-to-disable-this-user": "Are you sure you want to disable this user?",
"are-you-sure-you-want-to-delete-the-profile-picture": "Are you sure you want to delete the profile picture?",
"are-you-sure-you-want-to-delete-the-site-logo": "Are you sure you want to delete the site logo?",
"are-you-sure-you-want-to-delete-this-user": "Are you sure you want to delete this user?",
"are-you-sure-you-want-to-delete-this-page": "¿Confirma que desea eliminar esta página?",
"are-you-sure-you-want-to-delete-this-category": "¿Confirma que desea eliminar esta categoría?",
"are-you-sure-you-want-to-change-the-password": "Are you sure you want to change the password?",
"website-plugins": "Website plugins",
"dashboard-plugins": "Dashboard plugins",
"powered-by-bludit": "Powered by <a href='https:\/\/www.bludit.com'>Bludit</a>",
"build-number": "Build Number",
"disk-usage": "Disk usage",
"standard": "Standard",
"insert-file": "Insert file",
"insert-original-size": "Insert original size",
"insert-small-size": "Insert small size",
"insert-medium-size": "Insert medium size",
"year": "año",
"month": "mes",
"week": "semana",
"day": "dia",
"hour": "horas",
"second": "segundos"
}