Ejemplo n.º 1
0
	function fetchName() {
		global $wgLang, $wdTermDBDataSet;
		if ( $wdTermDBDataSet ) {
			$userLanguage = $wgLang->getCode() ;
			$spelling = getSpellingForLanguage( $this->dmId, $userLanguage, 'en', $wdTermDBDataSet );
			if ( $spelling ) return $spelling;
		}
		return $this->getFallbackName();
	}
	/** 
	 * Return one of the syntrans entries of this defined meaning,
	 * specified by language code. Caches the syntrans records
	 * in an array.
	 * 
	 * @param String Language code of the synonym/translation to look for
	 * @param String Fallback to use if not found
	 * @return Spelling or null if not found at all
	 *
	 * TODO make fallback optional
	 * 
	 */
	public function getSyntransByLanguageCode( $languageCode, $fallbackCode = "en" ) {

		if ( array_key_exists( $languageCode, $this->syntrans ) )
		  return $this->syntrans[$languageCode];

		$syntrans = getSpellingForLanguage( $this->getId(), $languageCode, $fallbackCode, $this->dataset );
		if ( !is_null( $syntrans ) ) {
			$this->syntrans[$languageCode] = $syntrans;
		}
		return $syntrans;
	}