Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthoriJyrki
     

    Hey again!

    Here's the problem right now. How to localize the dates (created_at, updated_at) found in tables? I've tried the following in one of my views:

    <p><%= t('%name wrote this on %date', {'%name' => questbook_entry.name, '%date' => questbook_entry.created_at}) %></p>
    

    -jyrki

    • CommentAuthorsalavert
     

    try with this

    $date_helper->locale_date($questbook_entry->created_at)
    
    • CommentAuthoriJyrki
     

    Thanks salavert!

    -jyrki

    • CommentAuthordelia
     
    hi,
    i am trying to get a localized date in the form "n Weekday", for example, 31 Wednesday (31 Miércoles). Anybody knows how to achieve this?

    i have done this:

    $timestamp = Ak::getTimestamp($iso_date);
    $format = Ak::locale('j D');
    return Ak::getDate($timestamp, $format);

    but i got an error.......
    •  
      CommentAuthorbermi
     

    delia, I think you're missusing Ak::locale('j D');

    Ak::locale looks for an index on the $locale array in your config/locales/LOCALE.php files

    As an example for i18n a date and months, you can do something like:

    On your locale file

    $locale['full_text_date'] = "%s %d of %s, year %d";
    $locale['days'] = "Sunday,Monday,Tuesday....";
    $locale['months'] = "January,February.....";
    

    In a helper

    function full_text_date(){
        $days = Ak::toArray(Ak::locale('days'));
        $months = Ak::toArray(Ak::locale('months'));
        return sprintf($locale['full_text_date'], $days[date('w')], date('j'), $months[date('n')+1], date('Y'));
    }
    

    Hope it helps

    • CommentAuthordelia
     
    thanks Bermi. it helps

    (y perdona por las preguntas estúpidas - se me nota a la legua que estoy empezando. Intento buscar información antes de preguntar, pero todavía hay muy poca documentación sobre el framework me parece)
    •  
      CommentAuthorbermi
     

    delia, I'd like the Akelos community to embrace the "There are no dumb questions culture", so don't worry … y bienvenidas sean tus preguntas :)

    • CommentAuthordpinte
     
    Hi Guys,

    Im trying to get localized dates and wondered what was the locales/localize/date/ directory for ?

    I have defined the following in config/locales/fr.php :

    $locale['long_date_format'] = 'l, d F Y';

    Then in a helper, I'm calling :

    Ak::getDate(Ak::getTimeStamp(), Ak::locale('long_date_format'))

    This gives "Thursday, 15 January 2009", so the format is ok but not the language.

    I have seen that there is translation for dates in app/locales/localize/date/en.php. So I made fr.php with translation for dates, and then made this in my helper

    Ak::t(Ak::getDate(Ak::getTimeStamp(), Ak::locale('long_date_format')), array(), 'localize/date')

    but the output is still the same.

    Any way to get it running fine ? My aim is to get "Jeudi, 15 Janvier 2009"

    Thanks