/** * Returns an instance of a gettext implementation depending on * the capabilities of the PHP installation. If the gettext extension * is loaded, we use the native gettext() bindings, otherwise we use * an own implementation * * @param String $directory Directory to search the mo files in * @param String $domain The current domain * @param String $locale The local * * @return Gettext An instance of a Gettext implementation */ public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new Gettext_Extension(); } return self::$instance; }
/** * Returns the Gettext singleton instance * * @return Gettext */ public static function instance() { if (!isset(Gettext::$instance)) { // Load a new instance Gettext::$instance = new Gettext(); } return Gettext::$instance; }
<?php // Load the Gettext module Gettext::instance();