コード例 #1
0
ファイル: Factory.php プロジェクト: geissler/csl
 /**
  * Creates a Locale object and injects the configuration parameters.
  *
  * @return \Geissler\CSL\Locale\Locale
  */
 public static function locale()
 {
     self::loadConfig();
     $locale = new Locale();
     $locale->setDir(self::$configuration['locale']['dir'])->setFile(self::$configuration['locale']['file'])->setPrimaryDialect(self::$configuration['locale']['dialects']);
     return $locale;
 }
コード例 #2
0
ファイル: Container.php プロジェクト: geissler/csl
 /**
  * Reset all internal properties.
  *
  * @return void
  */
 public static function clear()
 {
     self::$context = new Context();
     self::$macros = array();
     self::$citationItem = false;
     self::$context = new Context();
     self::$rendered = new Rendered();
     self::$bibliography = null;
     self::$citation = null;
     self::setLocale(Factory::locale());
     self::$locale->readFile();
 }
コード例 #3
0
ファイル: LocaleTest.php プロジェクト: geissler/csl
   /**
    * @covers Geissler\CSL\Locale\Locale::readFile
    * @covers Geissler\CSL\Locale\Locale::addXml
    * @covers Geissler\CSL\Locale\Locale::getTerms
    */
   public function testGetChangedTerms()
   {
       $locale = '<locale xml:lang="en">
   <terms>
     <term form="short" name="editortranslator">
       <single>ed. &#38; trans.</single>
       <multiple>eds. &#38; trans.</multiple>
     </term>
   </terms>
 </locale>';
       $this->assertInstanceOf('\\Geissler\\CSL\\Locale\\Locale', $this->object->readFile('en'));
       $this->assertInstanceOf('\\Geissler\\CSL\\Locale\\Locale', $this->object->addXml(new \SimpleXMLElement($locale)));
       $this->assertEquals('ed. & trans.', $this->object->getTerms('editortranslator', 'short'));
   }