public function testPoParserBasic() { QI18n::$DefaultTranslationClass = 'QTranslationPoParser'; // Force spanish $translator = QI18n::Load('es'); $this->verifyTranslation("List All", $translator->TranslateToken("List All"), "Mostrar Todos"); $this->verifyTranslation("Create a New", $translator->TranslateToken("Create a New"), "Crear uno Nuevo"); // Verify the case when there's no translation available $this->verifyTranslation("Can't translate me!", $translator->TranslateToken("Can't translate me!"), "Can't translate me!"); }
<div id="demoZone"> <h2>Translations made using the custom QSampleTranslation class</h2> <h3>French <small>(default set in <code>Form_Create()</code>)</small></h3> <ul> <li>Required -> <?php _t('Required'); ?> </li> <li>Optional -> <?php _t('Optional'); ?> </li> </ul> <h3><strong>Spanish</strong></h3> <?php $i18n = QI18n::Load('es'); ?> <ul> <li>Required -> <?php echo $i18n->TranslateToken('Required'); ?> </li> <li>Optional -> <?php echo $i18n->TranslateToken('Optional'); ?> </li> </ul> </div> <?php $this->RenderEnd();