Extension talk:Lingo/Flow

About this board

Structured Discussions boards are read-only on this wiki as of March 2025.

Resource: Custom JS script to extend Lingo

3
VersedFenrir (talkcontribs)

I made this for my own use, so it might need a bit of tweaking to work within your environment, but they work fine on ICANNWiki, tested with stock Vector 2022 and Minerva Neue.

Script:

// Custom script for Lingo that performs two distinct tasks: 1) Disables the rendering of tooltips of a given acronym within the article that defines it ("RFC" on the Request For Comments article); 2) Disables Lingo entirely in arbitrarily defined Namespaces (comes pre-set to "Template", "Category" and "Module", but tweak according to your needs)

$(function() {

   // List namespaces where Lingo should be disabled (adjust freely)

   var blockedNamespaces = ['Template', 'Category', 'Module'];

   var currentNS = mw.config.get('wgCanonicalNamespace');

   

   if (blockedNamespaces.indexOf(currentNS) !== -1) {

       // Remove any Lingo tooltip markup immediately

       $('.mw-lingo-term').each(function() {

           $(this).replaceWith($(this).text());

       });

       console.log("Lingo processing is blocked in the '" + currentNS + "' namespace.");

       return; // Stop further processing

   }

   // Decent enough solution for Lingo not to render tooltips of an acronym on the page that defines it

   var rawTitle = mw.config.get('wgTitle').replace(/_/g, ' ').trim();

   var acronym = null;

   // Case 1: Title written as "Long Form (ACRONYM)"

   var titleAcronymMatch = rawTitle.match(/^(.+?)\s+\(([A-Z]{2,})\)$/);

   if (titleAcronymMatch) {

       acronym = titleAcronymMatch[2];

       console.log("Using acronym from title parenthetical: " + acronym);

   }

   // Case 2: Title is exactly an acronym (all uppercase)

   else if (/^[A-Z]+$/.test(rawTitle)) {

       acronym = rawTitle;

       console.log("Using pure acronym from title: " + acronym);

   }

   // Otherwise, compute fallback from title’s longform and compare with extracted acronym

   else {

       // Remove any trailing parenthetical from title, e.g. "Request For Comments (foo)" becomes "Request For Comments"

       var longForm = rawTitle.replace(/\s*\(.*\)\s*$/, '');

       var fallback = longForm.split(/\s+/).map(function(word) {

           return word.charAt(0).toUpperCase();

       }).join('');

       // Attempt to extract an acronym from the first paragraph

       var firstParagraph = $('#mw-content-text p').first().text();

       var parenMatch = firstParagraph.match(/\(([A-Z]{2,})\)/);

       if (parenMatch) {

           var extracted = parenMatch[1];

           console.log("Extracted acronym from first paragraph: " + extracted);

           if (extracted === fallback) {

               acronym = extracted;

               console.log("Acronym matches fallback computed from title: " + acronym);

           } else {

               console.log("Extracted acronym (" + extracted + ") does not match computed fallback (" + fallback + "); aborting tooltip removal.");

               return;

           }

       } else {

           console.log("No acronym found in first paragraph; aborting tooltip removal.");

           return;

       }

   }

   console.log("Assuming definition page for acronym: " + acronym);

   // Remove any Lingo tooltip markup for elements whose visible text exactly matches the acronym.

   var $matching = $('.mw-lingo-term').filter(function() {

       return $(this).text().trim() === acronym;

   });

   console.log("Found " + $matching.length + " element(s) with visible text '" + acronym + "'");

   $matching.each(function() {

       $(this).replaceWith($(this).text());

   });

   console.log("Finished processing Lingo tooltips for acronym: " + acronym);

});

SlyAceZeta (talkcontribs)

Isn't the second part handled by $wgexLingoUseNamespaces?

VersedFenrir (talkcontribs)

That is a very good point, but the code was written by a frontend designer. :) So let's call the second one an alternative frontend solution to the issue.

Transclude random definitions

2
Hchmamg (talkcontribs)

I'd like to transclude a random definition onto a different page, ideally so that at each refresh it shows a different definition. Has anyone had a go at trying something like this and could recommend where to start? I am struggling to work out how exactly to go about that.

Elcapitan68 (talkcontribs)

You can consider using SemanticMediaWiki as an alternative back-end for Lingo. Semantic Glossary is to link them.

In this paradigm, each term has its own page making random display of terms as easy as:

{{#ask: [[Category:Glossary]]
|order=random
|limit=1
|searchlabel=
|format= ...
}}

SemanticMediaWiki comes with a variety of output formats, including the embedding, many more formats are available through extensions.

You can even reload terms without refreshing the page, using SRF slideshow format or an extension.

Enabling plurals for acronyms

2
VersedFenrir (talkcontribs)

In cases where you have a "Request For Comments", a "RFC", it is not uncommon for editors to write "RFCs", but this is not recognized by Lingo and there does not appear to be a way to make it do that.

I understand that one solution is to define both RFC and RFCs in Terminology and replicate this for all applicable cases, but that is hard to maintain.

I attempted to use JS in several different ways to attach Lingo to the plural version of acronyms, and while it almost works by fetching Terminology via API and attaching the link to the DOM, Lingo's CSS doesn't really apply to this JS pop-up and the inwiki links don't parse even if I replicate Lingo's characteristics 1:1 and ask it to re-render.

Has anyone ever thought up a solution for this? Maybe I am missing some more straightforward method, but I really pushed JS to its limits.

Elcapitan68 (talkcontribs)

As a glossary extension, Lingo is designed to provide definitions for terms in their glossary form, as listed on the Terminology page (or its equivalent).

It supports multiple term variants for the same definition, making it as simple as:

...
;RFC
;RFCs
:Request for Comments
...

Lingo doesn't pretend to know, recognize and process all forms of a word; it can be a nightmare in languages that are more inflected than English.

I believe a well-defined convention and contribution codex would be far more effective than a complex JavaScript solution here.

Cannot exclude File namespace

3
Summary by Elcapitan68

The patch is included starting from Lingo 3.2.4.

68.99.129.8 (talkcontribs)

Using the configuration option $wgexLingoUseNamespaces[NS_FILE] = false; does not disable Lingo in file descriptions.

The config does work for other namespaces, and adding __NOGLOSSARY__ to the file description successfully disables Lingo. Is there some other setting that I need to use to disable Lingo across all file descriptions?

MW 1.42.1

Lingo 3.2.1 (cc4a274)

Elcapitan68 (talkcontribs)

Thank you for reporting this issue. My initial testing confirmed the unexpected behavior in the File namespace. However, the extension code handles all namespaces uniformly, so the cause might be external. We'll investigate the issue further and keep you updated.

BrentLaabs (talkcontribs)

Thanks for the report. This was fixed in 04070ded4, and included in version 3.2.4.

Prior to this, $wgexLingoUseNamespaces was unreliable (and would most likely only work properly for NS_MAIN), please upgrade if you plan on using this variable.

Error: Typed property Parser::$mOutput must not be accessed before initialization

9
Summary by Elcapitan68

Proven functionality in the supported environment (Lingo REL1_39 (3.2.0) on MW REL1_39 with a compatible version of PHP).

Extension only guarantees compatibility for LTS MediaWiki versions.

Unluku (talkcontribs)

Hello everyone! I've encountered a bug using VisualEditor with Lingo installed. What happened is it wouldn't let me edit using VisualEditor throwing a following exception:

[exception] [f31f5d51fffaa701908e43c3] /mediawiki/api.php?action=visualeditor&format=json&paction=parse&page=%D0%97%D0%B0%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D0%B0%D1%8F_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0&uselang=en&editintro=&preload=&preloadparams=&formatversion=2   Error: Typed property Parser::$mOutput must not be accessed before initialization
#0 /var/lib/mediawiki/extensions/Lingo/src/LingoParser.php(393): Parser->getOutput()
#1 /var/lib/mediawiki/extensions/Lingo/src/LingoParser.php(77): Lingo\LingoParser->shouldParse()
#2 /var/lib/mediawiki/extensions/Lingo/src/Lingo.php(72): Lingo\LingoParser->parse()
#3 /var/lib/mediawiki/includes/HookContainer/HookContainer.php(161): Lingo\Lingo::Lingo\{closure}()
#4 /var/lib/mediawiki/includes/HookContainer/HookRunner.php(1179): MediaWiki\HookContainer\HookContainer->run()
#5 /var/lib/mediawiki/includes/content/ContentHandler.php(1774): MediaWiki\HookContainer\HookRunner->onContentAlterParserOutput()
#6 /var/lib/mediawiki/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput()
#7 /var/lib/mediawiki/includes/Revision/RenderedRevision.php(259): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput()
#8 /var/lib/mediawiki/includes/Revision/RenderedRevision.php(232): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached()
#9 /var/lib/mediawiki/includes/Revision/RevisionRenderer.php(223): MediaWiki\Revision\RenderedRevision->getSlotParserOutput()
#10 /var/lib/mediawiki/includes/Revision/RevisionRenderer.php(164): MediaWiki\Revision\RevisionRenderer->combineSlotOutput()
#11 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}()
#12 /var/lib/mediawiki/includes/Revision/RenderedRevision.php(199): call_user_func()
#13 /var/lib/mediawiki/includes/poolcounter/PoolWorkArticleView.php(84): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#14 /var/lib/mediawiki/includes/poolcounter/PoolWorkArticleViewCurrent.php(104): PoolWorkArticleView->renderRevision()
#15 /var/lib/mediawiki/includes/poolcounter/PoolCounterWork.php(167): PoolWorkArticleViewCurrent->doWork()
#16 /var/lib/mediawiki/includes/page/ParserOutputAccess.php(304): PoolCounterWork->execute()
#17 /var/lib/mediawiki/includes/parser/Parsoid/ParsoidOutputAccess.php(226): MediaWiki\Page\ParserOutputAccess->getParserOutput()
#18 /var/lib/mediawiki/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(764): MediaWiki\Parser\Parsoid\ParsoidOutputAccess->getParserOutput()
#19 /var/lib/mediawiki/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(577): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getParserOutputInternal()
#20 /var/lib/mediawiki/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(438): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getParserOutput()
#21 /var/lib/mediawiki/extensions/VisualEditor/includes/DirectParsoidClient.php(157): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getHtml()
#22 /var/lib/mediawiki/extensions/VisualEditor/includes/ApiParsoidTrait.php(110): MediaWiki\Extension\VisualEditor\DirectParsoidClient->getPageHtml()
#23 /var/lib/mediawiki/extensions/VisualEditor/includes/ApiVisualEditor.php(231): MediaWiki\Extension\VisualEditor\ApiVisualEditor->requestRestbasePageHtml()
#24 /var/lib/mediawiki/includes/api/ApiMain.php(1935): MediaWiki\Extension\VisualEditor\ApiVisualEditor->execute()
#25 /var/lib/mediawiki/includes/api/ApiMain.php(912): ApiMain->executeAction()
#26 /var/lib/mediawiki/includes/api/ApiMain.php(883): ApiMain->executeActionWithErrorHandling()
#27 /var/lib/mediawiki/api.php(95): ApiMain->execute()
#28 /var/lib/mediawiki/api.php(48): wfApiMain()
#29 {main}
‎

I'm running MediaWiki 1.41.1 and Lingo 3.1.1. As a temporal dirty workaround I added some lines in Lingo/src/LingoParser.php that check whether Parser::$mOutput was initialized and it seems to be working:

	/**
	 * @param Parser $parser
	 * @return bool
	 */
	private function shouldParse( $parser ) {
		global $wgexLingoUseNamespaces;

		if ( !( $parser instanceof Parser || $parser instanceof StubObject ) ) {
			return false;
		}

		$reflectionClass = new \ReflectionClass(Parser::class);

		if ( !$reflectionClass->getProperty( 'mOutput' )->isInitialized( $parser ) ) {
			return false;
		}
‎

Is there any solution to this? Thanks in advance!

GobleStL (talkcontribs)
GobleStL (talkcontribs)

Correction - this does not actually fix the issue. It DOES allow VisualEditor to open and work but the the site becomes unstable.

Further investigation revealed that (without the changes) VisualEditor opens up when you are CREATING a new page but pops an error when attempting to edit an existing page.

As a work-around, I simply open a new page and create my changes if needed then switch to Edit Source and copy pasta!

Elcapitan68 (talkcontribs)

I am unsure why do you use Lingo 3.1.1 (this tag was released in 2019).

If you use composer as required https://github.com/wikimedia/mediawiki-extensions-Lingo, it should end up with installing Lingo 3.2.

If you can't use composer for some reason, we suggest installing branch REL1_39 via git. It is targeted at work with MW 1.39 but can work with 1.41, please test.

I updated the direct download link on the extension page so that now it points to the version 3.2.0.

GobleStL (talkcontribs)

Sorry. That is a typo I missed. I am on 3.2.1 and using Composer.

SG

Elcapitan68 (talkcontribs)

I confirm the described behavior in my test environment:

  • MediaWiki 1.41
  • PHP 8.1
  • Lingo 3.2.0

Perhaps it is due to the recent changes in the MediaWiki core.

Lingo with VisualEditor in MediaWiki 1.39

In the recommended environment:

  • MediaWiki 1.39
  • PHP 8.1
  • Lingo 3.2.0

everything works correctly.

Joe Beaudoin Jr. Redux (talkcontribs)

This has not been fixed in MW 1.41 and Lingo 3.2.1. This is still an open issue for REL1_41, which I am able to unfortunately replicate.

Elcapitan68 (talkcontribs)

Thank you for testing. I confirmed the failure for MW 1.41 in the above comment.

As long as the extension compatibility policy is LTS (key: ltsrel), we expect it to work with MW 1.39 and 1.43. Tasks can be added to Phabricator issue tracker about the issues in the non-LTS versions.

Elcapitan68 (talkcontribs)

Fatal exception of type "Error"

7
Summary by X-Savitar

User confirmed that the fix now works.

GobleStL (talkcontribs)

Turning on error reporting show the below.

Product Version
MediaWiki 1.39.0
PHP 8.1.13 (apache2handler)
Lingo 3.1.1

PHP Caching

APCu Support Enabled
Version 5.1.21
APCu Debugging Disabled
MMAP Support Enabled
MMAP File Mask no value
Serialization Support php
Build Date Jun 25 2022 07:29:23

MediaViewer also has issues and has been disabled so direct viewing of images is fine. But with Lingo I get this:


[d2bd7de25bc67f629e3a1d49] /mediawiki/index.php?title=Glossary&action=submit Error: Call to undefined function Lingo\wfGetMainCache()

Backtrace:

from /var/www/html/mediawiki/extensions/Lingo/src/LingoParser.php(387)

#0 /var/www/html/mediawiki/extensions/Lingo/src/BasicBackend.php(262): Lingo\LingoParser->purgeGlossaryFromCache()

#1 /var/www/html/mediawiki/includes/HookContainer/HookContainer.php(338): Lingo\BasicBackend->purgeCache()

#2 /var/www/html/mediawiki/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook()

#3 /var/www/html/mediawiki/includes/HookContainer/HookRunner.php(2732): MediaWiki\HookContainer\HookContainer->run()

#4 /var/www/html/mediawiki/includes/Storage/PageUpdater.php(913): MediaWiki\HookContainer\HookRunner->onPageContentSave()

#5 /var/www/html/mediawiki/includes/EditPage.php(2596): MediaWiki\Storage\PageUpdater->saveRevision()

#6 /var/www/html/mediawiki/includes/EditPage.php(1904): EditPage->internalAttemptSave()

#7 /var/www/html/mediawiki/includes/EditPage.php(721): EditPage->attemptSave()

#8 /var/www/html/mediawiki/includes/actions/EditAction.php(73): EditPage->edit()

#9 /var/www/html/mediawiki/includes/actions/SubmitAction.php(38): EditAction->show()

#10 /var/www/html/mediawiki/includes/MediaWiki.php(542): SubmitAction->show()

#11 /var/www/html/mediawiki/includes/MediaWiki.php(322): MediaWiki->performAction()

#12 /var/www/html/mediawiki/includes/MediaWiki.php(904): MediaWiki->performRequest()

#13 /var/www/html/mediawiki/includes/MediaWiki.php(562): MediaWiki->main()

#14 /var/www/html/mediawiki/index.php(50): MediaWiki->run()

#15 /var/www/html/mediawiki/index.php(46): wfIndexMain()

#16 {main}


¯\_(ツ)_/¯


Everything else seems good.

This is a fresh build with the aforementioned versions.

Any ideas?


SG

Elcapitan68 (talkcontribs)

Thank you for your report, we're working on 1.39 compatibility and the issue should have an update soon.

GobleStL (talkcontribs)

THANK YOU!

X-Savitar (talkcontribs)

The lastest patch has been merged, can you test it with the patch merged (master) and let me know if you still face this issue?

GobleStL (talkcontribs)

THANKS! I will check as soon as I can.

GobleStL (talkcontribs)

This works for me. No issues.

X-Savitar (talkcontribs)

Nice! Thanks for reporting the issue. I'll go ahead and resolve this topic now.

AB-CD only shows the definition for AB

3
Summary by Elcapitan68

Proven functionality in the supported environment (Lingo REL1_39 (3.2.0) on MW REL1_39 with a compatible version of PHP).

GobleStL (talkcontribs)

I have a definition for AB and a definition for AB-CD but AB-CD only shows the definition for AB. How can I fix this??


SG

Elcapitan68 (talkcontribs)
Test environment versioning MW 1.41 / PHP 8.1
Test environment versioning MW 1.41 / PHP 8.1
A tooltip for AB
A Lingo tooltip for AB
A Lingo tooltip for AB-CD
A Lingo tooltip for AB-CD

Can't confirm. Lingo 3.2.0 installed as explained in the Composer section of the extension page, produces tooltips correctly with the default settings.

Elcapitan68 (talkcontribs)

Please note that the next official release of Lingo will be for the next MediaWiki LTS version in accordance with Lingo compatibility policy (LTSrel).

Due to the latest changes in the core, I changed the requirements on the extension page.

Use of Hooks deprecated?

12
Summary by Elcapitan68

Proven functionality in the supported environment (Lingo REL1_39 (3.2.0) on MW REL1_39 with a compatible version of PHP).

GobleStL (talkcontribs)

I have been searching and cannot figure this one out. Lingo is operational but when I run update.php I get this:

PHP Deprecated:  Use of Hooks::register was deprecated in MediaWiki 1.35. [Called from Lingo\BasicBackend::registerHooks in /var/www/mediawiki/extensions/Lingo/src/BasicBackend.php at line 58] in /var/www/mediawiki/includes/debug/MWDebug.php on line 386

Any idea?

SG

Cavila (talkcontribs)

It is just a PHP warning that gets thrown if your current version of MediaWiki is v1.35 or over but your version of Lingo lingers behind. Your best bet is to upgrade Lingo.

GobleStL (talkcontribs)

I am at the latest.

GobleStL (talkcontribs)

Tried 3.2.1 also...

Cavila (talkcontribs)
Elcapitan68 (talkcontribs)

It is fixed in REL1_39 (LTS) according to the extension compatibility policy (ltsrel): https://github.com/wikimedia/mediawiki-extensions-Lingo/blob/c88549b25caa48012b915c150115c7100ded82be/src/BasicBackend.php#L56C1-L60C3

If you are on MW 1.39, please checkout REL1_39 branch, rather than a tag.

If you are running MW < 1.39, just ignore the message, as mentioned by @Cavila, it is just a deprecation warning and will go away with the upgrade to 1.39.

As for MW 1.35, it went end-of-life on December 21, 2023.

GobleStL (talkcontribs)

It actually only pops this error when I use VisualEditor. I disable Lingo when I need to use that extension and then have no issues.

Elcapitan68 (talkcontribs)

@GobleStL Please, make sure that you have PHP error reporting off in your LocalSettings.php and repeat testing. In case of failure, please share your current MW version number + PHP version, so that we could try to reproduce the error. A link to your LocalSettings.php will also be very helpful (just wipe the sensitive info out).

GobleStL (talkcontribs)

With error reporting on: "[58a6c0d657e09eaaaf0dc77c] Exception caught: Typed property Parser::$mOutput must not be accessed before initialization"

With error reporting off: "[addf778021d79e091496ce38] Caught exception of type Error"

This only pops up when I attempt to use VisualEditor. Lingo works just fine.

If I disable Lingo extension, VisualEditor opens without an error. I believe it is related to https://phabricator.wikimedia.org/T357686

In troubleshooting this I upgraded everything. I even started using dev branches. (The error started when on stable branch). Currently I am:

Product Version
MediaWiki 1.41.1
PHP 8.3.7 (fpm-fcgi)
ICU 66.1
MariaDB 10.5.23-MariaDB-0+deb11u1
Lua 5.1.5
Pygments 2.16.1
VisualEditor 0.1.2 (6f30783) 16:34, 10 May 2024
Lingo 3.2.1


<?php

#To suppress error messages uncomment the next two lines

error_reporting( 0 );

ini_set( 'display_errors', 0);

#To turn on error reporting uncomment the next four lines

#error_reporting( -1 );

#ini_set( 'display_errors', 1 );

#$wgShowExceptionDetails = true;

#$wgShowDBErrorBacktrace = true;

# This file was automatically generated by the MediaWiki 1.41.1

# installer. If you make manual changes, please keep track in case you

# need to recreate them later.

#

# See includes/MainConfigSchema.php for all configurable settings

# and their default values, but don't forget to make changes in _this_

# file, not there.

#

# Further documentation for configuration settings may be found at:

# https://www.mediawiki.org/wiki/Manual:Configuration_settings

# Protect against web entry

if ( !defined( 'MEDIAWIKI' ) ) {

        exit;

}

## Uncomment this to disable output compression

# $wgDisableOutputCompression = true;

$wgSitename = "This_Wiki";

## The URL base path to the directory containing the wiki;

## defaults for all runtime URL paths are based off of this.

## For more information on customizing the URLs

## (like /w/index.php/Page_title to /wiki/Page_title) please see:

## https://www.mediawiki.org/wiki/Manual:Short_URL

$wgScriptPath = "/mediawiki";

## The protocol and server name to use in fully-qualified URLs

$wgServer = "https://wiki.com";

## The URL path to static resources (images, scripts, etc.)

$wgResourceBasePath = $wgScriptPath;

## The URL paths to the logo.  Make sure you change this from the default,

## or else you'll overwrite your logo when you upgrade!

$wgLogos = [

        '1x' => "$wgResourceBasePath/resources/assets/wiki.svg",

        'icon' => "$wgResourceBasePath/resources/assets/wiki.svg",

];

$wgFavicon = "$wgResourceBasePath/resources/assets/wiki_icon.svg";

## UPO means: this is also a user preference option

$wgEnableEmail = true;

$wgEnableUserEmail = true; # UPO

$wgEmergencyContact = "an.email@abc.com";

$wgPasswordSender = "an.email@abc.com";

$wgSMTP = [

    'host'      => 'ssl://smtp.email.com', // could also be an IP address. Where the SMTP server is located. If using SSL or TLS, add the prefix "ssl://" or "tls://".

    'IDHost'    => 'wiki.com',      // Generally this will be the domain name of your website (aka mywiki.org)

    'localhost' => 'wiki.com,

    'port'      => 465,                // Port to use when connecting to the SMTP server

    'auth'      => true,               // Should we use SMTP authentication (true or false)

    'username'  => 'an.email@abc.com',     // Username to use for SMTP authentication (if being used)

    'password'  => 'somethinghere'       // Password to use for SMTP authentication (if being used)

];

$wgEnotifUserTalk = true; # UPO

$wgEnotifWatchlist = true; # UPO

$wgEmailAuthentication = true;

## Database settings

$wgDBtype = "mysql";

$wgDBserver = "localhost";

$wgDBname = "this_wiki";

$wgDBuser = "wiki_dude";

$wgDBpassword = "apassword";

# MySQL specific settings

$wgDBprefix = "";

$wgDBssl = false;

# MySQL table options to use during installation or update

$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";

# Shared database table

# This has no effect unless $wgSharedDB is also set.

$wgSharedTables[] = "actor";

## Shared memory settings

$wgMainCacheType = CACHE_ACCEL;

$wgMemCachedServers = [];

## To enable image uploads, make sure the 'images' directory

## is writable, then set this to true:

$wgEnableUploads = true;

$wgUseImageMagick = true;

$wgImageMagickConvertCommand = "/usr/bin/convert";

$wgGenerateThumbnailOnParse = true;

$wgSVGConverter = 'ImageMagick';

# InstantCommons allows wiki to use images from https://commons.wikimedia.org

$wgUseInstantCommons = false;

# Periodically send a pingback to https://www.mediawiki.org/ with basic data

# about this MediaWiki instance. The Wikimedia Foundation shares this data

# with MediaWiki developers to help guide future development efforts.

$wgPingback = false;

# Site language code, should be one of the list in ./includes/languages/data/Names.php

$wgLanguageCode = "en";

# Time zone

#$wgLocaltimezone = "UTC";

$wgLocaltimezone = "America/Chicago";

## Set $wgCacheDirectory to a writable directory on the web server

## to make your wiki go slightly faster. The directory should not

## be publicly accessible from the web.

#$wgCacheDirectory = "$IP/cache";

$wgTmpDirectory = "/var/www/mediawiki/temp";

$wgSecretKey = "abc123";

# Changing this will log out all existing sessions.

$wgAuthenticationTokenVersion = "1";

# Site upgrade key. Must be set to a string (default provided) to turn on the

# web installer while LocalSettings.php is in place

$wgUpgradeKey = "1234567890";

## For attaching licensing metadata to pages, and displaying an

## appropriate copyright notice / icon. GNU Free Documentation

## License and Creative Commons licenses are supported so far.

$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright

$wgRightsUrl = "";

$wgRightsText = "";

$wgRightsIcon = "";

# Path to the GNU diff3 utility. Used for conflict resolution.

$wgDiff3 = "/usr/bin/diff3";

# The following permissions were set based on your choice in the installer

$wgGroupPermissions['*']['createaccount'] = false;

$wgGroupPermissions['*']['edit'] = false;

$wgGroupPermissions['*']['read'] = false;

## Default skin: you can change the default skin. Use the internal symbolic

## names, e.g. 'vector' or 'monobook':

$wgDefaultSkin = "monobook";

# Enabled skins.

# The following skins were automatically enabled:

wfLoadSkin( 'MinervaNeue' );

wfLoadSkin( 'MonoBook' );

wfLoadSkin( 'Timeless' );

wfLoadSkin( 'Vector' );

# Enabled extensions. Most of the extensions are enabled by adding

# wfLoadExtension( 'ExtensionName' );

# to LocalSettings.php. Check specific extension documentation for more details.

# The following extensions were automatically enabled:

wfLoadExtension( 'AccessControl' );

wfLoadExtension( 'AutoCreateCategoryPages' );

wfLoadExtension( 'CategoryTree' );

wfLoadExtension( 'Cite' );

wfLoadExtension( 'CiteThisPage' );

wfLoadExtension( 'CodeEditor' );

wfLoadExtension( 'ConfirmEdit' );

wfLoadExtension( 'DataDump' );

wfLoadExtension( 'DiscussionTools' );

wfLoadExtension( 'DumpsOnDemand' );

wfLoadExtension( 'Echo' );

wfLoadExtension( 'Gadgets' );

wfLoadExtension( 'ImageMap' );

wfLoadExtension( 'InputBox' );

wfLoadExtension( 'Interwiki' );

#wfLoadExtension( 'LinkTitles' );

wfLoadExtension( 'Linter' );

wfLoadExtension( 'LoginNotify' );

wfLoadExtension( 'Maintenance' );

wfLoadExtension( 'Math' );

wfLoadExtension( 'MultimediaViewer' );

wfLoadExtension( 'Nuke' );

wfLoadExtension( 'OATHAuth' );

wfLoadExtension( 'PageForms' );

wfLoadExtension( 'PageImages' );

wfLoadExtension( 'ParserFunctions' );

wfLoadExtension( 'PdfHandler' );

wfLoadExtension( 'Poem' );

wfLoadExtension( 'Renameuser' );

wfLoadExtension( 'ReplaceText' );

wfLoadExtension( 'Scribunto' );

wfLoadExtension( 'SecureLinkFixer' );

wfLoadExtension( 'SyntaxHighlight_GeSHi' );

wfLoadExtension( 'TemplateData' );

wfLoadExtension( 'TextExtracts' );

wfLoadExtension( 'Thanks' );

wfLoadExtension( 'TitleBlacklist' );

wfLoadExtension( 'VisualEditor' );

wfLoadExtension( 'WikiEditor' );

# End of automatically generated settings.

# Add more configuration options below.

//DataDump Configuration

$wgDataDumpDirectory = "<path>${wgDBname}/";

$wgDataDump = [

    'xml' => [

        'file_ending' => '.xml.gz',

        'generate' => [

            'type' => 'mwscript',

            'script' => "$IP/maintenance/dumpBackup.php",

            'options' => [

                '--full',

                '--output',

                "gzip:${wgDataDumpDirectory}" . '${filename}',

            ],

        ],

        'limit' => 1,

        'permissions' => [

            'view' => 'view-dump',

            'generate' => 'generate-dump',

            'delete' => 'delete-dump',

        ],

    ],

    'image' => [

        'file_ending' => '.zip',

        'generate' => [

            'type' => 'script',

            'script' => '/usr/bin/zip',

            'options' => [

                '-r',

                '<path>${filename}',

                "<path>${wgDBname}/"

            ],

        ],

        'limit' => 1,

        'permissions' => [

            'view' => 'view-dump',

            'generate' => 'view-image-dump',

            'delete' => 'delete-dump',

        ],

    ],

];

// create DataDump right

$wgAvailableRights[] = 'view-dump';

$wgAvailableRights[] = 'view-image-dump';

$wgAvailableRights[] = 'generate-dump';

$wgAvailableRights[] = 'delete-dump';

// add DataDump to the user group

$wgGroupPermissions['user']['view-image-dump'] = true;

$wgGroupPermissions['sysop']['view-image-dump'] = true;

$wgGroupPermissions['user']['generate-dump'] = true;

$wgGroupPermissions['sysop']['generate-dump'] = true;

$wgGroupPermissions['sysop']['delete-dump'] = true;

// add DataDump to the 'basic' grant so we can use our DataDump over an API request

$wgGrantPermissions['basic']['view-image-dump'] = true;

$wgGrantPermissions['basic']['generate-dump'] = true;

$wgGrantPermissions['basic']['delete-dump'] = true;

//For mobile adding extension and settings

$wgUrlProtocols[] = "file://";

$wgFileExtensions[] = 'iso';

$wgFileExtensions[] = 'pdf';

$wgFileExtensions[] = 'doc';

$wgFileExtensions[] = 'xls';

$wgMaxShellMemory = 8000000;

$wgMaxShellFileSize = 1000000;

$wgMaxShellTime = 300;

$wgAllowTitlesInSVG = true;

$wgLinkTitlesParseOnEdit = true;

$wgLinkTitlesBlackList[] = 'B6200';

// Add Lingo

wfLoadExtension( 'Lingo' );

#The following hook is needed for Lingo to function

$wgHooks['SetupAfterCache'][] = function() {

    // specify a different name for the terminology page (Default: 'Terminology' (or localised ve>

    $GLOBALS['wgexLingoPage'] = 'Glossary';

    // specify that each term should be annotated only once per page (Default: false)

    //$GLOBALS['wgexLingoDisplayOnce'] = false;

    // specify what namespaces should or should not be used (Default: Empty, i.e. use all namespa>

    //$GLOBALS['wgexLingoUseNamespaces'][NS_SPECIAL] = false;

    // set default cache type (Default: null, i.e. use main cache)

    //$GLOBALS['wgexLingoCacheType'] = CACHE_NONE;

    // use ApprovedRevs extension on the Terminology page (Default: false)

    //$GLOBALS['wgexLingoEnableApprovedRevs'] = true;

};

Tosfos (talkcontribs)

We only support LTS branches of MediaWiki. You can try the REL1_39 branch's code and it might work with 1.41. Probably unrelated, running MediaWiki with version 8.3 might cause issues.

GobleStL (talkcontribs)

Thank you. I realize this. This is why I just disable the extension when I want to use VisualEditor.

Elcapitan68 (talkcontribs)

I changed the resume to reflect the issue and solution correctly.

Warning on global variable

10
Summary by Elcapitan68

Lingo REL1_39 is free of this bug. The issue was SemanticGlossary pulling an outdated Lingo version.

Allanext2 (talkcontribs)

MW 1.39, php 8.1, Lingo extension REL1_39 and I'm getting:

Warning: Undefined global variable $wgParser in/var/www/html/extensions/Lingo/src/Lingo.php on line53

Elcapitan68 (talkcontribs)

Hi @Allanext2, please let me know what installation method did you use (cloning Git repo, composer or something else)?

Allanext2 (talkcontribs)

Hi @Elcapitan68,

I have it installed with a git submodule from the github repo, below the entry in .gitmodules:

[submodule "data/extensions/Lingo"]

path = data/extensions/Lingo

url = https://github.com/wikimedia/mediawiki-extensions-Lingo.git

branch = REL1_39

I then do:

git submodule init

git submodule update

git submodule foreach -q 'branch="$(git config -f $toplevel/.gitmodules submodule.$name.branch)"; echo "Extension $name:"; git switch $branch'

Thank you !

Elcapitan68 (talkcontribs)

Please check paths, REL1_39 of Lingo seems to be free of wgParser:

w/extensions/Lingo$ php -v
PHP 8.1.27 (cli) (built: Dec 21 2023 20:19:54) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.27, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.27, Copyright (c), by Zend Technologies

w/extensions/Lingo$ git status
On branch REL1_39
Your branch is up to date with 'origin/REL1_39'.

nothing to commit, working tree clean

w/extensions/Lingo$ grep -R wgParser ./
w/extensions/Lingo$ 

See here.

Is there a chance that you mount an outdated branch some way?

What happens if you checkout the tag?

cd extensions/Lingo

git checkout 3.2.0
Allanext2 (talkcontribs)

@Elcapitan68 You're right the REL1_39 branch in clean of wgParser.

The issue is that when Semantic Glossary is installed (dev-master branch) with `composer update --no-dev` it requires the dependency Lingo 3.1.1 which overrides files

Allanext2 (talkcontribs)
Elcapitan68 (talkcontribs)
Elcapitan68 (talkcontribs)

Please confirm understanding.

Elcapitan68 (talkcontribs)
2A01:11:9210:26B0:258E:CEB:849B:823B (talkcontribs)

How to use a Project namespace Terminology page?

3
Summary by SlyAceZeta

Sorry for the late reply! Indeed, setting $wgexLingoPage = 'Project:Terminology'; does the trick :)

SlyAceZeta (talkcontribs)

I'm trying to use Project:Terminology as the terminology page for the extension across an entire wiki, but the extension doesn't seem to recognize that page when I set it in MediaWiki:Lingo-terminologypagename, using either "Project:Terminology" or "Wiki Name:Terminology".

Elcapitan68 (talkcontribs)
Elcapitan68 (talkcontribs)

@SlyCooperFan1, did you have a chance to try setting $wgexLingoPage? Did it help?