Esempio n. 1
0
 public function testLocaleTagChain()
 {
     PropelL10n::addDependency('it-IT', 'en');
     $p = new \Product();
     $p->setTitle('bene', 'it');
     $p->setTitle('good', 'en');
     $this->assertEquals('bene', $p->getTitle('it-IT'));
 }
    public static function setUpBeforeClass()
    {
        if (!class_exists('\\Book')) {
            $schema = <<<EOF
<database name="l10n_behavior">
\t<table name="book">
\t\t<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
\t\t<column name="title" type="VARCHAR" required="true" />
\t\t<column name="author" type="VARCHAR" />
\t
\t\t<behavior name="l10n">
\t\t\t<parameter name="i18n_columns" value="title" />
\t\t</behavior>
\t</table>
</database>
EOF;
            QuickBuilder::buildSchema($schema);
        }
        PropelL10n::setLocale('en');
        // just reset, may changed in other tests
        PropelL10n::setFallback('en');
        PropelL10n::setDependencies(['de-CH' => 'de-DE', 'de-AT' => 'de-DE', 'de-DE' => 'en-US', 'ja' => 'en-US']);
    }
 public function testCurrentLocale()
 {
     $this->assertEquals('en', PropelL10n::getLocale());
     PropelL10n::setLocale('de-DE');
     $this->assertEquals('de-DE', PropelL10n::getLocale());
 }
 public function getDefaultLocale()
 {
     return PropelL10n::getLocale();
 }