• Hi, this function have an issue……all words are translated on file.po, but the time is not showed. I have this worning: ” Undefinited array key “anno” in /…..helpers.php on line 208.

    This Is line 208: return sprintf( esc_html__(‘%s %s ago’, ‘brikk’), $r, $r > 1 ? $a_plural[ $str ] : $str );

    file.po: %s %s ago —– translation on loco %s %s fa’

    thi is the function:

    public function get_time_elapsed_string( $time ) { $etime = time() – $time; if ( $etime < 1 ) { return ‘0 seconds’; } $a = [ 365 * 24 * 60 * 60 => esc_html__(‘year’, ‘brikk’), 30 * 24 * 60 * 60 => esc_html__(‘month’, ‘brikk’), 24 * 60 * 60 => esc_html__(‘day’, ‘brikk’), 60 * 60 => esc_html__(‘hour’, ‘brikk’), 60 => esc_html__(‘minute’, ‘brikk’), 1 => esc_html__(‘second’, ‘brikk’) ]; $a_plural = [ ‘year’ => esc_html__(‘years’, ‘brikk’), ‘month’ => esc_html__(‘months’, ‘brikk’), ‘day’ => esc_html__(‘days’, ‘brikk’), ‘hour’ => esc_html__(‘hours’, ‘brikk’), ‘minute’ => esc_html__(‘minutes’, ‘brikk’), ‘second’ => esc_html__(‘seconds’, ‘brikk’) ]; foreach( $a as $secs => $str ) { $d = $etime / $secs; if( $d >= 1 ) { $r = round( $d ); return sprintf( esc_html__(‘%s %s ago’, ‘brikk’), $r, $r > 1 ? $a_plural[ $str ] : $str ); } } }

    Somebody can help me!

    Thanks.

    • This topic was modified 9 months, 1 week ago by angel696.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter angel696

    (@angel696)

    Hi,

    if I not translate the singolar …then it show the plurar, but in this way

    I lose the translation for the singolar.

Viewing 1 replies (of 1 total)
  • The topic ‘time passed translation function’ is closed to new replies.