' . "\n"; echo '' . "\n"; ?> change locale: $locale"; } public function display($locale = null) { if ($locale) { $this->setLocale($locale); } echo sprintf('Number %0.2f', 100) . "
\n"; echo 'Weekday: ' . strftime( '%A' ) . "
\n"; echo 'Date: ' . strftime( '%x' ) . "
\n"; echo 'Time: ' . strftime( '%X' ) . "
\n"; echo ''; echo $this->translate('translate me'); echo $this->translate('Chinese', 'wombat'); echo $this->translate('This field is required, please complete it.', 'patForms'); echo $this->translate('The e-mail address must contain one "@" symbol.', 'patForms'); echo $this->translate('Choose a new secret password.', 'patForms'); echo '
'; echo '
' . "\n"; } protected function translate($msg, $domain = null) { $html = '%s%s' . "\n"; $html .= ' %s' . "\n"; if ($domain) { $trans = patI18n::dgettext($domain, $msg); } else { $trans = patI18n::gettext($msg); } printf($html, $domain, $msg, $trans); } } $t = new i18nTester(); $t->display( 'de_DE' ); $t->display( 'en_US' ); $t->display( 'de_DE' ); ?>