Using translations

Date_HumanDiff ships a number of translations that provide localized messages. Version 0.4.0 comes with German (de), Greek (el) and Persian (fa) translations.

The setLocale method accepts locale names (de_AT, en_US) as well as ISO 639-1 two-letter language codes (de, fr, en). If the combination of language code + country code does not match, the language code alone is tried. If that also fails, the english variant is used.

Using the German translation

<?php
require_once 'Date/HumanDiff.php';
$dh = new Date_HumanDiff();
$dh->setLocale('de_DE');
echo 
$dh->get(time() - 60) . "\n";
//prints out "vor 5 Minuten"
?>
Basic usage: Getting a human readable time difference (Previous) Generating HTML (Next)
Last updated: Tue, 22 Apr 2014 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

There are no user contributed notes for this page.