Ejemplo n.º 1
0
 /**
  * @param $locale
  */
 public function setLocale($locale)
 {
     $this->hyphenator = Hyphenator::factory(null, $this->fixLocale($locale));
     $this->setOptions();
 }
 public function testHyphenatorInvocationSimple()
 {
     $h = h\Hyphenator::factory(__DIR__ . '/share/test2', 'de_DE');
     $this->assertInstanceof('\\Org\\Heigl\\Hyphenator\\Tokenizer\\TokenizerRegistry', $h->getTokenizers());
     $t = $h->getTokenizers();
     $this->assertAttributeEquals(array(new h\Tokenizer\WhitespaceTokenizer(), new h\Tokenizer\PunctuationTokenizer()), '_registry', $t);
     $this->assertEquals('Do-nau-dampf-schiff-fahrt', $h->hyphenate('Donaudampfschifffahrt'));
     $this->assertEquals('Gü-ter-mäd-chen', $h->hyphenate('Gütermädchen'));
 }
Ejemplo n.º 3
0
echo '8' === $_REQUEST['wordMin'] ? 'selected="selected"' : '';
?>
value="8">8</option>

                </select>
                <label for="customHyphen">Custom Hyphen-String</label>
                <input type="text" name="customHyphen" value="<?php 
echo $_REQUEST['customHyphen'];
?>
" />
            </fieldset>
            <fieldset class="buttons">
                <input type="submit" name="submit" value="Submit" />
                <input type="reset" name="reset" value="Reset" />
            </fieldset>
        </form>
        <div class="result">
            <?php 
$hyphenator = \Org\Heigl\Hyphenator\Hyphenator::factory(null, $_REQUEST['language']);
$hyphenator->getOptions()->setHyphen($_REQUEST['customHyphen'])->setLeftMin($_REQUEST['leftMin'])->setRightMin($_REQUEST['rightMin'])->setWordMin($_REQUEST['wordMin'])->setQuality($_REQUEST['quality']);
$hyphenated = $hyphenator->hyphenate($_REQUEST['text']);
echo '<span>' . $hyphenated . '</span>';
?>
        </div>
        <div class="result">
        	<?php 
echo $_REQUEST['text'];
?>
        </div>
    </body>
</html>