Extension talk:Lingo/2012
This page used the LiquidThreads 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. |
Text is only highlighted after i saved the page again
Hello,
at the moment i have the problem, that the words are only marked, when i save the pages again (nothing changed on the pages).
Situation: 1. Create a new entry in the Glossary template 2. Look on the pages, if the entry is now marked => nothing happend 3. Edit the page (article) and save it without any change again 4. Look again on this page and the entry is now marked.
Second question: Is it possible, to click on the ballon tip and get to the entry on the Glossary page?
thanks in advance Chris 193.159.161.200 14:10, 31 January 2012 (UTC)
- Hmm, odd. This sounds like a cache issue. I was sure, Lingo was applied after the cache, but now I am not sure any more. If you turn off caching, does it work?
- It is not currently possible to include links in the glossary. F.trott 14:39, 31 January 2012 (UTC)
- Hi,
- thanks for your tip. I turned off caching with $wgEnableParserCache = false; in LocalSettings.php and then it works perfectly.
- So it seems, that there is an issue with caching. But at the moment it is a solution for me :) Thank you
- Chris 193.159.161.200 14:51, 31 January 2012 (UTC)
Example of Lingo
Dear all: Could anyone please show an easy example of how to use Lingo extension? The problem now is I've installed both Lingo and Semantic Glossary, and edit the Special:Terminology, but I did not find somewhere with highlight words, so I think I do not quite know how to use this extension. Thanks in advance! Xiaowei85 (talk) 11:10, 5 March 2012 (UTC)
- Hi,
- Semantic Glossary turns off the Special:Terminology page. You have the choice of using Lingo alone and not installing Semantic Glossary, then the glossary is defined on Special:Terminology. Or you install Semantic Glossary in addition to Lingo, then you have to define the glossary using Semantic MediaWiki properties
- Edit: Wait, there is no Special:Terminology. It's just Terminology. That's a normal page in the main namespace.
- Cheers, F.trott (talk) 12:29, 5 March 2012 (UTC)
- Hi F.troot
- Thanks for your help, now I've deleted Semantic Glossary both in extensions file and LocalSetting.php, I'm trying to use Lingo. For Terminology page, yes it is just a normal page, I'm sorry I made a mistake for that!
- However the case is, I follow every step of installing Lingo, and make no configureations, edit the page Terminology with ";Mo:Mo Yanzhai" , but still in the page with "Mo", nothing happened! Did I miss some steps or what?
- Many thanks for that. We're trying to build a glossary with this great extension! Xiaowei85 (talk) 12:57, 5 March 2012 (UTC)
- Hmm, if your wiki is not in English, then the name of the page could be different. A link to the terminology page is included in the credits in Special:Version.
- (The documentation on the extension page should probably improved to mention that fact.) F.trott (talk) 13:07, 5 March 2012 (UTC)
- Many thanks for that reminding
- I re-installed English version, and re-install Lingo again, but still, nothing changed. I'll try tomorrow, but anyway, thanks!! I really hope I can use this extension!! Xiaowei85 (talk) 21:45, 5 March 2012 (UTC)
- Hello.
- I have installed also the Lingo english version and I have found that if you input the Terminology items in this way:
- FTP
- File Transfer Protocol
- It doesn't works.
- If you put every Data in the same line it works fine.
- FTP
- File Transfer Protocol
- I hope this could help you.
- Regards. 94.126.240.2 08:28, 12 March 2012 (UTC)
- Sorry. I'm the same as above.
- I didn't put the example in the correct way, so you can't see anything...
- Here you have:
- Incorrect Way
- ;FTP
- :File Transfer Protocol
- Correct Way
- ;FTP:File Transfer Protocol
- Sorry and Regards 94.126.240.2 08:34, 12 March 2012 (UTC)
Semantic Mediawiki
Hi again. I have started using Semantic Mediawiki 1.7.0.2 wit Semantic Forms 2.3.2
If I have words or phrases in Field names that are on the Terminology Page then the Lingo extension is interfering with the rendering of the "Edit with Form" page. The inserted Spans are a problem.
I will have to be careful with mu terminology! Jeremy.Osborn (talk) 20:46, 5 March 2012 (UTC)
- I'll investigate. Until then it should work to include the __NOGLOSSARY__ magic word into your form definitions. F.trott (talk) 20:56, 5 March 2012 (UTC)
- It's fixed. Try the latest SF development version, please. F.trott (talk) 22:51, 5 March 2012 (UTC)
- Hey,
- Sorry to say it is not working for me using SM Forms 2.4.2
- What I should see:
- What I see:
Jeremy.Osborn (talk) 09:24, 24 March 2012 (UTC)
- Curious. This is clearly not a JS, but a PHP issue. Somehow SF seems to not recognize what input type to use and so defaults to input type text. You are sure that the only difference between those two pictures is including Lingo in your LocalSettings.php or not, right? Is your wiki somehow publicly available? Or could you post your form's source code? F.trott (talk) 13:51, 24 March 2012 (UTC)
- hi,
- All I am doing is adding the term "Change" on the Terminology page. Lingo is included in both examples.
- I have cleared caches in IE. Is there anything I can do on the server to clear any caches? It is pretty blck an white for me however. I add the term "Change" and "Edit with Form" does not work. I remove the term and the form works. Very repeatable.
- Thanks Jeremy.Osborn (talk) 10:26, 28 March 2012 (UTC)
- To clear out server-side caches, you can go to your form (Form:Something) and refresh/purge it. But I do not think it is necessary, else there would be no difference between including "Change" in the Lingo terms or not.
- Alas I can not reproduce it, it works for me. Is your wiki somehow publicly available? Or could you post your form's source code? F.trott (talk) 10:19, 29 March 2012 (UTC)
- Curious. This is clearly not a JS, but a PHP issue. Somehow SF seems to not recognize what input type to use and so defaults to input type text. You are sure that the only difference between those two pictures is including Lingo in your LocalSettings.php or not, right? Is your wiki somehow publicly available? Or could you post your form's source code? F.trott (talk) 13:51, 24 March 2012 (UTC)
- It's fixed. Try the latest SF development version, please. F.trott (talk) 22:51, 5 March 2012 (UTC)
Font Colours
I have noticed a slight problem. When definition text is displayed it appears to use the same font-colour as the page text it is attached to. It does not, however, use the background colour that text is against. This means that where we have white text on a coloured background the definition text is not visible. Would it be possible for Lingo to always use a black text colour? I am using v0.3 on MediaWiki 1.17.0. H.Mills (talk) 09:36, 12 March 2012 (UTC)
Looking for a tips when Lingo interferes with some JavaScript (different from __NOGLOSSARY__ and class=noglossary)
Hi, Lingo (0.3) interferes with the Syntaxhighlighter extension javascript when there are glossary keywords in the "syntaxhighlighted" source code.
Of course __NOGLOSSARY__ and class=noglossary work fine, but I would like to offer a better solution for my wiki users, I mean, as Lingo is "automatic", I am looking for a tips (source code modifications, css...) to avoid my wiki users to add by themselves __NOGLOSSARY__ in case they are using a glossary keyword in their source code...
My questions:
- Any idea/tips for fixing this issue?
- LingoParser.php seems to look for the class "noglossary", I have tried to add the class "syntaxhighlighter" but without success.
- Is there any way to execute Lingo "after" Syntaxhighlight? (not sure because Syntaxhighlight seems to use ~only Javascript)
Exemple - wiki: <pre class="brush:c"> void James007(void) {} </pre>
Exemple - result:
void <span class="tooltip"><span class="tooltip_abbr">James007</span><span style="display: none;" class="tooltip_tipwrapper"><span class="tooltip_tip"><span>James007 is James Bond </span></span></span></span>(void) {}
Exemple - Html:
<div> <div id="highlighter_700962" class="syntaxhighlighter nogutter c"> <table cellspacing="0" cellpadding="0" border="0"> <tbody> <tr> <td class="code"> <div class="container"> <div class="line number1 index0 alt2"> <code class="c plain">.sync_src = <span </code> <code class="c keyword bold">class</code> <code class="c plain">=</code> <code class="c string">"tooltip"</code> <code class="c plain">><span </code> <code class="c keyword bold">class</code> <code class="c plain">=</code> <code class="c string">"tooltip_abbr"</code> <code class="c plain">>James007</span><span style=</code> <code class="c string">"display: none;"</code> <code class="c keyword bold">class</code> <code class="c plain">=</code> <code class="c string">"tooltip_tipwrapper"</code> <code class="c plain">><span </code> <code class="c keyword bold">class</code> <code class="c plain">=</code> <code class="c string">"tooltip_tip"</code> <code class="c plain">><span>James007 is James Bond</span></span></span></span>(void) {} </code> ...
Many thanks for this nice wiki extension : ) Philippe Cornucopia (talk) 12:16, 12 April 2012 (UTC)
- Hi,
- your second idea seems to be the best choice here. Did not test, but adding the syntaxhighlighter class to the XPath query should work. Try replacing the query in LingoParser.php (around line 167) with
"//*[not(ancestor-or-self::*[@class='noglossary'] or ancestor-or-self::*[@class='syntaxhighlighter'] or ancestor-or-self::a)][text()!=' ']/text()"
- Executing Lingo after SyntaxHighlight is not possible as, as you noticed, SyntaxHighlight is based on JavaScript.
- Cheers, F.trott (talk) 20:12, 16 April 2012 (UTC)
- Hi and many thanks for your quick reply : )
- Your source code example is exactly what I have tried before posting my question and unfortunately it does not work... but your reply confirms me I should dig somewhere there : ) After several tests, I found a "not-so-clean-but-acceptable" patch for my use case:
"//*[not(ancestor-or-self::*[@class='noglossary'] or ancestor-or-self::pre or ancestor-or-self::a)][text()!=' ']/text()"
- Note: I have also tried with the "brush" class instead of the "syntaxhighlighter" class as Lingo should see "brush" but not "syntaxhighlighter" (correct me if I am wrong), but with no success... so filtering on pre will be the "selected" patch even if it is far from perfection.
- Many thanks for your very good support. Philippe 13:53, 24 April 2012 (UTC)
IE bug? When .tooltip_abbr overlapped by .tooltip_tip of another .tooltip, it remain visible under it
Hello, Stephan! I am using IE 9.06, mediawiki 1.17 and Lingo 0.3. The problem is on screenshot
there is no that problem in firefox
And thanks for Lingo! Shibormot (talk) 21:58, 1 May 2012 (UTC)
- Never saw this before. Then again, I am not using IE very often. I will investigate. Thanks for the report!
- Cheers, F.trott (talk) 22:01, 1 May 2012 (UTC)
- I'm also seeing formatting problems using both IE 8 & IE 9. The tooltips spread out wide over the entire page, as if they are not correctly reading the page width. Larryc (talk) 15:35, 3 May 2012 (UTC)
- It works for me in IE9. However, there was apparently a bug in IE7 in the handling of the z-index. I checked in a patch to work around that. It could be that because of some other error your browser goes into IE7 compatibility mode. Anyway, I checked in the patch into the git repository. Would be great, if you could check it out and see, if it works now. F.trott (talk) 13:03, 11 May 2012 (UTC)
Extension displays abbreviation incorrectly
Hi there,
I hope anyone can help me. I have installed the current version of Lingo on my Mediawiki 1.16.2 but both ways:
;FTP:File Transfer Protocol
and
;FTP :File Transfer Protocol
result in this:
- FTPFile Transfer Protocol
Can anyone help me? 88.64.170.165 14:10, 7 May 2012 (UTC)
- Hi. Could be a JS or CSS error. Check the JS error console. F.trott (talk) 14:15, 7 May 2012 (UTC)
- Hi. Thanks for your quick reply. Can you tell me what I have to do exactly? 88.64.170.165 08:22, 9 May 2012 (UTC)
- If you are in FireFox, just hit Ctrl-Shift-J. You can also get at it via the menu: Tools > Web Developer > Error Console. F.trott (talk) 08:28, 9 May 2012 (UTC)
- Thanks. But there is no indication in the Error Console that refers to the Lingo extension. I have the problem in both IE and FireFox :-( 88.64.170.165 07:37, 11 May 2012 (UTC)
- That's reassuring. :) Any error would crash JavaScript, meaning Lingo is not executed anymore. I'd say, try fixing whatever errors there are. F.trott (talk) 07:41, 11 May 2012 (UTC)
- It still is frustrating to see that Lingo doesn't work on my (German) Wiki. I see that it works on the official Wikipedia.de - although on the Special-Pages I see that they don't seem to use Lingo as it is not listed there. But they seem to use it as abbreviations are marked with small dotted unterlines and when I move my mouse to the abbreviation the out-written word gets displayed. 178.7.104.182 09:18, 30 August 2012 (UTC)
- No, the official Wikipedia does certainly not use Lingo. I was not aware that they have something like Lingo in place. Do you have a link to an example?
- To solve your issue, do you have a link to your wiki? F.trott (talk) 09:42, 30 August 2012 (UTC)
- Unfortunately it's an internal wiki on our intranet. Here is a link to a page on a German Wikipedia where a Lingo-kind version is used:
- http://de.wikipedia.org/wiki/Berlin
- Check out the information box on the upper right side where the word "Höhe" (for "above see level") is used. There you see 34–115 m ü. NN. The abbreviation m ü. NN uses a Lingo-Version. 178.7.104.182 13:25, 5 September 2012 (UTC)
- It still is frustrating to see that Lingo doesn't work on my (German) Wiki. I see that it works on the official Wikipedia.de - although on the Special-Pages I see that they don't seem to use Lingo as it is not listed there. But they seem to use it as abbreviations are marked with small dotted unterlines and when I move my mouse to the abbreviation the out-written word gets displayed. 178.7.104.182 09:18, 30 August 2012 (UTC)
- That's reassuring. :) Any error would crash JavaScript, meaning Lingo is not executed anymore. I'd say, try fixing whatever errors there are. F.trott (talk) 07:41, 11 May 2012 (UTC)
- Thanks. But there is no indication in the Error Console that refers to the Lingo extension. I have the problem in both IE and FireFox :-( 88.64.170.165 07:37, 11 May 2012 (UTC)
- If you are in FireFox, just hit Ctrl-Shift-J. You can also get at it via the menu: Tools > Web Developer > Error Console. F.trott (talk) 08:28, 9 May 2012 (UTC)
- Hi. Thanks for your quick reply. Can you tell me what I have to do exactly? 88.64.170.165 08:22, 9 May 2012 (UTC)
Caching the LingoTree
I encountered some performance issues while using Lingo in combination with Semantic Glossary. The glossary does not change all that often, but it is still retrieved and rebuilt for every page view. This had severe impact on our loading times (we're talking about seconds here).
I added some caching logic to Lingo to LingoParser::buildLingo that solved this for us. The LingoTree is cached for 15 mins before it is rebuilt.
protected function buildLingo() { wfProfileIn( __METHOD__ ); global $wgMemc; // Try cache first $cachekey = wfMemcKey( 'lingo', 'lingotree' ); $cachedLingoTree = $wgMemc->get( $cachekey ); if($cachedLingoTree != '') { $this->mLingoTree = $cachedLingoTree; } else { $this->mLingoTree = new LingoTree(); $backend = &$this->mLingoBackend; // assemble the result array while ( $elementData = $backend->next() ) { $this->mLingoTree->addTerm( $elementData[LingoElement::ELEMENT_TERM], $elementData ); } $wgMemc->set($cachekey, $this->mLingoTree, 60*15); } wfProfileOut( __METHOD__ ); }
I'm planning to make the caching optional and the cache expiry time configurable, and to check this code in to Subversion. Any objections? Remco de Boer 10:32, 17 May 2012 (UTC)
- Awesome! I would love to have this in Lingo. You will have to submit it to Git, though, Lingo is already transferred. F.trott (talk) 21:44, 22 May 2012 (UTC)
- Hmm, I think this requires some more thought. Instead of caching the LingoTree for a fixed time of 15 min wouldn't it be better to cache indefinitely and purge it only on change? Have to think how to implement that. F.trott (talk) 13:04, 29 May 2012 (UTC)
- I submitted a patch to git: https://gerrit.wikimedia.org/r/#/c/9276/
- Could you have a look and see if it works for you?
- Cheers, F.trott (talk) 18:45, 29 May 2012 (UTC)
Better iPad / touch device support
The mouseenter/mouseleave events don't work too well on touch devices. I've added the following to Lingo.js to solve this
/* * Listen for mouse clicks, esp. on touch devices such as iPads. When the tooltip is visible and the mouse is clicked, * remove the tooltip. */ .mousedown( function( event ){ if( $(this).find(".tooltip_tipwrapper").is(":visible") ) { $(this).trigger('mouseleave'); } else { $(this).trigger('mouseenter'); } })
I will also submit this to Git. Remco de Boer 19:26, 23 May 2012 (UTC)
Lingo in non-English Wikis
I had some difficulties in getting Lingo to work in a German Wiki. One guess was that it might conflict with other extensions (that was not the case). I stumbled over the sentence "By default Lingo will mark up any page with the terms and definitions defined on the Terminology page of your wiki (or the respective page in the language of your wiki)" and would have believed that the German of "Terminology" is "Terminologie". I was wrong again. Only when I looked up the special page:version I saw the red link to a non-existing page, which was called "Glossar". Once I had copied the content of the page "Terminology" to the page "Glossar" Lingo started to work as intended. Ob.helm (talk) 09:02, 27 May 2012 (UTC)
Problem With IE 8
I have a problem using the Lingo on IE 8. It puts lots of space beteween two words. Word like "File Transfer Protocol" appeasrs as "File Transfer Protocol". It appears just fine on Chrome and Firefox. Any help in this matter is appreciated. Thanks a lot guys. It is really a great extension. Andy222 (talk) 14:39, 5 July 2012 (UTC)
- I think wiki removed the extra spacing. what I wanted to represent was that, IE thinks that it is a tab instead of space. Andy222 (talk) 14:41, 5 July 2012 (UTC)
- It's probably a CSS issue. I will see if I can fix it. F.trott (talk) 08:46, 6 July 2012 (UTC)
- Thanks. Please let me know once it is fixed. I appreciate it.. 192.152.183.2 19:29, 11 July 2012 (UTC)
- It's probably a CSS issue. I will see if I can fix it. F.trott (talk) 08:46, 6 July 2012 (UTC)
Internet Explorer and links
I found a weird bug when using I.E. 7&8 (untested in 9). It does not happen in Geko or Webkit browsers.
If, in the first line of a page, there is a word that from the list recognized by Lingo, then any link following in the same line will stop working. You can actually navigate with the keyboard to the link, and it will work if you hit [enter]. It's just when the mouse is over the link that it stops working.
In my case, the line is:
To request the Mac role to be added to an EPR , please use this Mac role request form
"EPR" is in Lingo's "vocabulary" If set as the first line in the page, it does not work. If I move it further down, the link works again.
I did also test with other words and links, and got the same behavior. Diego bf109 (talk) 17:18, 11 July 2012 (UTC)
Per-term CSS?
Any thoughts about making it possible to define CSS per term? For instance, MediaWiki:lingo-css contains CSS where a class .lingo-<term> defines the term's style?
I was thinking about hacking this onto Semantic Glossary for the lulz (I'm already doing a little template+CSS system for certain terms, so basically add a Glossary-Style text property or something), but I figured it would be best to start here so we don't have a functionality mismatch.
That is, unless this addition would put an unreasonable extra burden on processing, etc. 76.107.76.96 19:44, 28 August 2012 (UTC)
- There is no manipulation of the search tree or string lookups or anything of that kind involved, so I think the additional load should be no problem. If you want to work on this it would be great if you could get a Gerrit account and submit a patch to the Lingo extension. F.trott (talk) 20:53, 28 August 2012 (UTC)
DOMDocument error in LingoParser? a bug?
I got a error, [error] "[client 127.0.0.1]PHP Strict Standards: Non-static method DOMDocument::loadHTML() should not be called statically, assuming $this from incompatible context in /data/www/html/wiki/extensions/Lingo/LingoParser.php on line 156" my software: Fedora 17 MediaWiki 1.20.0 PHP 5.4.8 (apache2handler) MySQL 5.5.28
is it a bug? P.swiki (talk) 14:53, 14 November 2012 (UTC)
- Depends on your point of view. This method may be called statically, but as you experienced will issue an E_STRICT error. It should work anyway. I will change the call to make it non-static. Until then I propose to switch E_STRICT off. F.trott (talk) 15:14, 14 November 2012 (UTC)
- thanks!
- what can i do? P.swiki (talk) 15:44, 14 November 2012 (UTC)
Glossary by namespace
Is there a way to restrict glossary terms to a namespace? I know you can restrict namespaces that use the glossary, but that is not what I want to do.
For example:
if I have three namespaces and the glossary term NEA:
- In NameSpace 1, it is National Endowment for the Arts.
- In NameSpace 2, it is National Education Association.
- In NameSpace 3, it is someone's name. But there are many other glossary terms I want to use in this namespace.
I would not want the definition for NameSpace1 to show up as the definition in NameSpace2. As it stands now, both definitions would show in both namespaces.
I know I could use _NoGlossary_ every time the name shows up in NameSpace 3, but it would be a PIA to write.
I have looked over the code in this extension, and do not see a simple way to do this, other than an overhaul of code, another idea is to mame three wikis, which I do not want to do. So, what do you all think? Thanks Tsakshaug (talk) 15:04, 29 November 2012 (UTC)
- I was actually thinking of somehow introducing context-dependent terms, e.g. terms only shown if the page is of a specific category or namespace. It is however not easy to denote this on the terminology page, so I was rather thinking of doing something in that direction for the Semantic Glossary.
- In your case, however, if you do not mind turning off the Lingo cache, you could easily use a different Terminology page for each namespace. In LocalSettings.php you can already set $wgexLingoPage to whatever your terminology page is. There is nothing saying, that this has to be a constant value. You could as well set a different page depending on the namespace of the current page. The only problem is, that the title of the current page is not yet available at the time LocalSettings is run, so you need to register a hook. You could for example append the following code to the end of your LocalSettings.php to get a Terminology page in every namespace:
- F.trott (talk) 16:25, 29 November 2012 (UTC)
$wgHooks['BeforeInitialize'][] = 'setLingoPage'; function setLingoPage(Title &$title, &$unused, &$output, &$user, $request, $wiki) { global $wgexLingoPage; $wgexLingoPage = $title->getNsText() . ':Terminology'; return true; }