Extension talk:I18nTags
This page used the Structured Discussions extension to give structured discussions. It has since been converted to wikitext, so the content and history here are only an approximation of what was actually displayed at the time these comments were made. |
language code does not seem to work
- 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
inI18nTags_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
, betweenwfLoadExtensionMessages
. InI18nTags_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. //rotsee 12:07, 29 October 2011 (UTC) 16:35, 31 October 2011 (UTC)
- 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 [[kgh]] (talk) 00:54, 3 October 2012 (UTC)
- It's unclear what is not working. Please provide minimal example. Nikerabbit (talk) 10:32, 20 February 2016 (UTC)
Transcluding does not work. :-(
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. Dennisroczek (talk) 18:55, 4 October 2015 (UTC)
- This is expected. You can use the {{#tag:formatnum}} mechanism to work around this. Nikerabbit (talk) 10:34, 20 February 2016 (UTC)
License?
@Nikerabbit: This extension is lacking license information. It will be great if it could be specified. Thanks and cheers [[kgh]] (talk) 16:00, 30 March 2018 (UTC)
- It has GPL-2.0-or-later mentioned in two places, so you can update that to where it is missing. Nikerabbit (talk) 06:03, 3 April 2018 (UTC)
- Thanks. Ah, I only looked at the common places. Will author a change. [[kgh]] (talk) 07:08, 3 April 2018 (UTC)