Welcome Guest, Not a member yet? Register   Sign In
How to translate month?
#1

I have this date 3/2021, and I'm trying to translate March into "Marzo", so I did:

PHP Code:
<?= DateTime::createFromFormat('m-Y'$d->date)->format(lang('date.month', ['F']) . '/Y'?>

locale file:

PHP Code:
<?php

$months 
= [
    'March' => 'Marzo'
];

return [
    'month' => "{0}"
]; 

how can I show "Marzo"?
Reply
#2

I use the example below, in a help, for the Portuguese:

PHP Code:
setlocale(LC_TIME'pt''portuguese');
    date_default_timezone_set('America/Sao_Paulo');

    //short date
    return utf8_encode(strftime('%d de %B'strtotime('today')));
    
    
//returns: 29 de abril
    
    
//long date
    return utf8_encode(strftime('%d de %B de %Y'strtotime('today')));
    
    
//returns 29 de abril de 2021
    
Reply




Theme © iAndrew 2016 - Forum software by © MyBB