Topic on Extension talk:UniversalLanguageSelector

Newly registered languages are not searchable

6
Sophivorus (talkcontribs)

If I add a language from my LocalSettings.php using:

$wgExtraLanguageNames['wy'] = 'Wayuunaiki';

Then the language is properly registered in MediaWiki (it can be selected from my preferences) but it's not searchable through the ULS (for example in the dropdown list of the Translate extension, when selecting the language I want to translate to). I tried running the script:

php extensions/UniversalLanguageSelector/data/LanguageNameIndexer.php

but still nothing. Is this normal behavior? Is it a bug? What do I need to do to make my newly registered language searchable? Thanks!!

Nikerabbit (talkcontribs)

Ugh I forgot this part. You would need to add the language name to the language database in ULS too. "wy" is not a valid language code by the way. You should follow the standards when creating codes that don't exist instead of choosing unused codes randomly: https://en.wikipedia.org/wiki/IETF_language_tag

Sophivorus (talkcontribs)

Thanks! ULS seems to create no table in the database, so when you speak of the "language database in ULS" I assume you mean the file extensions/UniversalLanguageSelector/data/LanguageNameSearchData.php correct? If so, then I'm afraid I'm a bit lost as to how to add a language there (it's quite a scary file) but it seems to be generated by a script, so maybe there's a script designed to add a new language? Me and any future inquirers would be very grateful if you could give me/us just a little more help. Thanks again!

Nikerabbit (talkcontribs)
Sophivorus (talkcontribs)

Thanks again! I checked my file extensions/UniversalLanguageSelector/lib/jquery.uls/src/jquery.uls.data.js and indeed it seems to have the language data I was looking for. However, the language I wanted to add, "Wayuunaiki" (aka "Wayuu") was already there, and not searchable! I did some tweaks to other languages to verify that the file is actually connected to the Translate search engine, and it is, but for some reason "Wayuu" can't be found. Could this actually be a bug? Are you able to find "Wayuu", or happen to notice what the issue may be?

I also tried adding a totally new language to the file with:

"gua": [
    "Latn",
    [
        "AM",
    ],
    "Guambiano"
],

(yes, I made up the language code) but no luck. What could be missing?

Nikerabbit (talkcontribs)

This combo should do it (yes it is horribly complicated and should be made simpler):

Add this to LocalSettings.php

$wgExtraLanguageNames['qqk'] = 'Quack';

Comment out the following line in UniversalLanguageSelector/data/LanguageNameIndexer.php

// $wgExtraLanguageNames = [];

Run the script (make sure you have cldr extension installed).

Add this to MediaWiki:Common.js:

mw.loader.using( [ 'ext.uls.mediawiki' ] ).done( function () {
	// These three lines are needed if languages/i18n/qqk.json doesn't exist
	var x = $.extend( {}, mw.config.get( 'wgULSLanguages' ), { qqk: 'Quack' } ); 
	mw.config.set( 'wgULSLanguages', x );
	$.fn.uls.defaults.languages = x;
	// This is needed if langauge isn't yet in the ULS language database
	$.uls.data.addLanguage( 'qqk', { script: 'Latn', regions: [ 'EU' ], autonym: 'Quack' } );
} );
Reply to "Newly registered languages are not searchable"