/** * 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; }
/** * 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(); }
/** * @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. & trans.</single> <multiple>eds. & 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')); }