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

require_once 'Date/HumanDiff.php';
$dh = new Date_HumanDiff();
$dh->get(time() - 60) . "\n";
//prints out "vor 5 Minuten"
Basic usage: Getting a human readable time difference (Previous) Generating HTML (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.