<?php
header( 'Content-Type: text/html; charset=utf-8' );

error_reporting( E_ALL |  E_STRICT );
require '../patI18n.php';

echo "<h3>Add i18n modules</h3>";

// Internal
$moduleConf =   array();
echo 'add Module: Internal<pre>' . print_r( $moduleConf, true ) . '</pre>';
patI18n::addModule( 'Internal', $moduleConf );

// Gettext
$moduleConf    =   array(
            'domain'    =>  'patI18n',
            'dir'       =>  dirname( __FILE__ ) . '/data/gettext/mo',
            'domains'   =>  array(
                array(
                        'domain'    =>  'patForms',
                        'dir'       =>  dirname( __FILE__ ) . '/data/gettext/mo',
                    )
                )
    );
echo 'add Module: Gettext<pre>' . print_r( $moduleConf, true ) . '</pre>';
patI18n::addModule( 'Gettext', $moduleConf );

echo "<hr />";

echo "<h3>Set current locale</h3>";
// set language to de_DE
patI18n::setLocale( 'de_DE' );

echo "<hr />";
echo "<h3>Translate string of the default domain</h3>";
echo patI18n::gettext( 'This text is translated' ), '<br />';
echo patI18n::gettext( 'Sometimes there is no translation at all!' ), '<br />';
echo patI18n::ngettext( 'Translate me, please!', 'Translate us, please!', 1 ), '<br />';
echo patI18n::ngettext( 'Translate me, please!', 'Translate us, please!', 7 ), '<br />';
echo "<hr />";

echo "<h3>Translate strings of <strong>patForms</strong> domain</h3>";
echo patI18n::dgettext( 'patForms', 'patForms is translated, as well' ), '<br />';
echo patI18n::dgettext( 'patForms', 'Some text in patForms are not translated' ), '<br />';
echo patI18n::dngettext( 'patForms', 'There is one patForms validation error', 'There are some patForms validation errors', 1 ), '<br />';
echo patI18n::dngettext( 'patForms', 'There is one patForms validation error', 'There are some patForms validation errors', 7 ), '<br />';
?>
