Extension talk:I18nTags

About this board

Kghbln (talkcontribs)

@Nikerabbit: This extension is lacking license information. It will be great if it could be specified. Thanks and cheers

Nikerabbit (talkcontribs)

It has GPL-2.0-or-later mentioned in two places, so you can update that to where it is missing.

Kghbln (talkcontribs)

Thanks. Ah, I only looked at the common places. Will author a change.

Reply to "License?"

Transcluding does not work. :-(

2
Dennisroczek (talkcontribs)

We have installed the extension, but sadly it doesn't fit to our needs. it is neither possible to use

<formatnum lang="fa">{{some template}}</formatnum> nor {{some template | lang=fa}} with the formatnum code within the template. The whole text in the template is a simple number!

We quickly deinstalled the extension again.
Nikerabbit (talkcontribs)

This is expected. You can use the {{#tag:formatnum}} mechanism to work around this.

Reply to "Transcluding does not work. :-("

language code does not seem to work

5
Kghbln (talkcontribs)

Using a language code as the second parameter to languagename, as described on this page, do not seem to work anymore. To add that option again, replace the function languageName in I18nTags_body.php with this code:

	public static function languageName( &$parser, $code = '', $code2 = '' ) {
		global $wgLang;
		if ( !$code ) return '';
		$native = $code2 === 'native';
		$cldr   = is_callable(array( 'LanguageNames', 'getNames' ));
		if ( !$native && $cldr ) {
			$code2 = $code2 ? $code2 : $wgLang->getCode();
			$languages = LanguageNames::getNames( $code2,
				LanguageNames::FALLBACK_NORMAL,
				LanguageNames::LIST_MW_AND_CLDR
			);
		} else {
			$languages = Language::getLanguageNames( false );
		}

		return isset($languages[$code]) ? $languages[$code] : $code;
	}

To add the possibility to convert in the other direction (i.e. from a language name in some language to an ISO code, you need to edit three files: In I18nTags.php, add

	$parser->setFunctionHook( 'languagecode',  array($class, 'languageCode' ) );

in the function efI18nTagsInit, between wfLoadExtensionMessages. In I18nTags_body.php, add a new function like this:

	public static function languageCode( &$parser, $name = '', $lang = '' ) {
		global $wgLang;
		if ( !$name ) return '';
		$native = $lang === 'native';
		$cldr   = is_callable(array( 'LanguageNames', 'getNames' ));
		if ( !$native && $cldr ) {
			$lang = $lang ? $lang : $wgLang->getCode();
			$languages = LanguageNames::getNames( $lang,
				LanguageNames::FALLBACK_NORMAL,
				LanguageNames::LIST_MW_AND_CLDR
			);
		} else {
			$languages = Language::getLanguageNames( false );
		}

		$key = array_search($name, $languages);
		return $key ? $key : $name;
	}

and finally, in I18nTags.magic.php, add the line

	'languagecode' => array( 0, 'languagecode' ),

to the array with aliases of all languages used on your wiki, e.g. like this:

/** English (English) */
$magicWords['en'] = array(
	'languagename' => array( 0, 'languagename' ),
	'languagecode' => array( 0, 'languagecode' ),
);

This is how we use this extension at Säsongsmat.nu.

This post was posted by Kghbln, but signed as Rotsee.

Kghbln (talkcontribs)

Hmm, by judging from the amount of replies you received, I am not sure whether this extension is still maintained. Did you file a bug on bugzilla for this? You may as well provide your amendments as a patch. Cheers

Rotsee (talkcontribs)

No, I didn't yet, but I guess I should file a bug and submit a patch! rotsee (talk) 07:59, 4 October 2012 (UTC)

Kghbln (talkcontribs)

Probably you have developer access, too. In this case you could even commit the patch directly and have it reviewed and merged. I think this would even be the faster solution. I could have thought about this earlier. :( Cheers

Nikerabbit (talkcontribs)

It's unclear what is not working. Please provide minimal example.

Reply to "language code does not seem to work"
There are no older topics
Return to "I18nTags" page.