MediaWiki talk:Gadget-TranslationAdder.js

Definition from Wiktionary, the free dictionary
(Redirected from Wiktionary:EDIT)
Jump to: navigation, search
If you are a programmer, you may find things of interest at User:Conrad.Irwin/editor_docs
Old discussion is at /old, please feel free to copy it back to this page if it still needs attention.




After you have made an edit with one of the installed tools (instructions for which are listed below) a blue box appears in the top left corner containing:

  • Save page
  • Undo
  • Redo

No changes made to the page are recorded until you press Save.

Editing translations[edit]

You should see a line at the end of the table something like

  • Help         :                       Preview translation More
    ◻ masc. ◻ fem. ◻ neuter ◻ common gender ◻ plural
  • The first box is the ISO 639-1 or ISO 639-3 language code (for common languages you can put in the language name, and it will give you the code).
  • The second box is the translation to add. This should normally be one word, if you attempt to add many separated by commas you will get a warning. If you want to request a translation set the word to {{trreq}}.
  • The gender tick-boxes are normally only needed for nouns, "common gender" tends to be used for languages where male and female have combined into one class, whereas "neuter" is a separate gender that is neither male or female.
  • Clicking Preview will try to make the edit, and display the Save page button in the top left.
  • Clicking more opens the extra options (really intended only for advanced users)
  • The second line contains gender check boxes, normally only one should be ticked. Though occasionally more are needed.
    • Transliteration: (tr=) The word as it might be transliterated into the Latin alphabet.
    • Qualifier: This is used if the translation only applies in a certain specific context, or under specific conditions. Fox example: (informally) and (literally).
    • Page name: (alt=) the name of the page when the word includes diacritics that are only normally found in a dictionary. This box may be automatically filled in for some languages (even when it is hidden).
    • Script template: (sc=) this only needs to be specified if you want something different from what it suggests.
    • Nesting: For languages that aren't already present in the translation table, the new language line may be nested under a language family heading. Or you may add translations with orthographic nesting. The syntax for this box is either: "Family Heading", "Family Heading/Language name" or "/Alphabet name".

Balancing translations[edit]

After adding a translation, two buttons will appear in the middle of the table:

  • Clicking "←" moves the first translation on the right to the end of the left list.
  • Clicking "→" moves the last translation on the left to the start of the right list.

Table Labelling[edit]

If you enable this feature, each translation table has a ± in the corner.

  • Clicking on this brings up an edit box for the table's header.
  • Type what you want in, normally the first few words in the definition (without linking or formatting)
  • Click "Preview" - if you are not happy with the result, click ± again - otherwise click "Save" in the top corner

WARNING: This feature has not been well tested in all browsers yet. Please notify me on this talk page if you have any problems.

You don't have the current version of the translation table gloss editor.


Logged in users
Go to Special:Preferences and the Gadgets tab, then check "Disable translation table editor buttons"
Logged out users
You don't have the current version of the editor.
NB. Logged in users can disable it here temporarily, using the first method is recommended.

Adding definitions[edit]

The "Toolbox" section of the sidebar on the left includes a button labelled "Add definition". Clicking this will cause a "Definition" box to follow the mouse. Type in a definition and click on an area of a definition list to add the new definition to that list. Clicking anywhere outside of a definition list while the "Definition" box is following the mouse will cause the box to disappear.

Adding rhymes[edit]

You should see a line at the bottom of each "syllables" section of each rhymes page that looks something like this:

Add new rhyme:                   Add

Typing in a rhyme and clicking "Add" will preview the addition of the new rhyme to the rhymes page. Clicking the "Save page" button in the blue box that appears in the top left corner will then save the change to the rhymes page, and update the entry of the newly added rhyme(s) to link back to the rhymes list in their pronunciation section(s). The rhymes adder can be disabled by going to the "Gadgets" tab of Special:Preferences and selecting "Disable the rhymes editor".


I can't do an entire project like this on my own, and so I've tried to make the architecture reasonably well-interfaced so that new modules can be added without having to know what else is going on; while none of this is trivial, the complexity is in trying to maintain a correspondence between the HTML on the page and the WikiText.

At the basic level, edits can be made by passing an edit object to the editor. Edit objects consist of a "redo" function which modifies the page HTML to reflect the edit, an "undo" function which does exactly the opposite of "redo", an "edit" function which performs the edit, and a "summary" string to be added to the edit summary. There is another framework for creating edit-forms, which is slightly more complicated - but should be easy enough to copy.


This is a list of things that need to be done. I will get round to them as and when I have the chance. If you want to add to this list, just a brief sentence describing the exact change; if you want something complicated add a section in discussion. If you want to implement these changes, please, please, please do.

  • Enable context sensitive disabling of buttons (particularly save form, also trans-balancers, and preview)
  • Work out nested translation sections.
  • Handle API errors.
  • Check revision of page from API matches wgCurRevision
  • A field for additional edit summary
  • Allow adding checktrans translations.
  • Add translation table button.
  • Edit existing translations.
  • (Add example sentence/quotations buttons)
  • (Change the trans-top color when there are no translations).
  • Add translation gloss.
  • Add error checking or warnings for nonexistant language codes.


Possible trreq related bug[edit]

Check out this edit, it seems when adding two terms (or more) terms to replace {{trreq}} it lists them on separate lines for no reason I can understand. Mglovesfun (talk) 13:44, 29 January 2011 (UTC)

Now fixed. It was caused by the : after {{trreq}} 20:06, 2 April 2011 (UTC)

added translations starting with a capital letter[edit]

I see in recentchanges a bunch of translations added using this script which start with a capital letter even though, it seems (not that I know the languages in question, usually), they should not. Is there a way for the script to test for this and either issue a warning to the editor or tag the translation (with some to-be-devised tag specific for this purpose or with {{ttbc}})? I'm thinking specifically of a test for: Is the word a proper noun or capitalized in English, or both a translation into German and a noun? (Any languages besides German capitalize all nouns, or any other part of speech?)​—msh210 (talk) 17:55, 15 February 2011 (UTC)

There's a similar test for translations separated by commas — I'll see what I can do. Conrad.Irwin 07:40, 2 April 2011 (UTC)
Ok. So "iff the page title starts with a lowercase letter, and the language is not german, and the translation starts with an uppercase letter" warn the user. It's hard to tell which part of speech is currently being edited (though I want to add that at some point so I can hide the genders and numbers). This is obviously not a very precise check, but I think it covers the majority of cases, albeit slightly conservatively. Conrad.Irwin 08:40, 2 April 2011 (UTC)
To Msh210 (Any languages besides German capitalize all nouns, or any other part of speech?) - no, only German (and Luxembourgish). Worth noting that capitalisation rules from language to language, like pronouns can be capitalised in a polite writing, etc. Conrad, I see have you covered Cyrillic based languages, Greek and Armenian as well. Thanks for that! Sometimes words are obviously copied from Wikipedia where articles titles are capitalised. --Anatoli 11:44, 2 April 2011 (UTC)
Thanks. I've added lb to the list of languages exempt from the check. As it's possible to override the warning (though maybe scary) I hope people will still be able to add pronouns correctly. Conrad.Irwin 19:27, 2 April 2011 (UTC)

Accelerated adding of usage examples[edit]

What do think about employing the {{usex}} template for adding of usage examples? Using a template to tag and standardize syntactic elements of the data-base might IMHO greatly help future bot-operated maintenance of the project. Matthias Buchmeier 12:04, 1 April 2011 (UTC)

As I now figured out added usex is a feature of User:Yair rand/editor.js and not yours, so never mind my post. Matthias Buchmeier 12:32, 1 April 2011 (UTC)


This edit done at my request should now either be undone or changed. nb should no longer be changed into no, as per WT:Grease pit#nb=no. Njardarlogar 13:57, 2 April 2011 (UTC)

Done. Conrad.Irwin 18:52, 2 April 2011 (UTC)
I think wikt_lang needs a fix? Njardarlogar 19:32, 2 April 2011 (UTC)
Thanks... Coding with no caffeine is still fail. 20:04, 2 April 2011 (UTC)

Problem at sniper[edit]

I am unable to add Norwegian translations to the second meaning of sniper. Get the error message Could not find translation entry for 'nn:asdasd'. Please reformat. The other meanings give no such error. Njardarlogar 12:49, 9 April 2011 (UTC)

When playing around, I seem to be able to replicate the error consistently when the languages already in the list are *not* in alphabetical order, and I try to add a new language. Editing the entry and rearranging the translations seem to make the error go away. \Mike 01:59, 18 June 2011 (UTC)

Red outline for AdderWrapper errors?[edit]

There's an interesting point in mw:Style guide/Error handling and validation#Field Local Error Notification, suggesting that input fields be given a red outline when there's a problem with the input. It might make sense to have that as the default behavior when an error is passed through the AdderWrapper. --Yair rand 19:39, 25 May 2011 (UTC)

Language names support for all languages, autocompleting language[edit]

Inputting language names instead of ISO codes is only supported for languages in ISO 639-1, but I think it would be helpful to allow users to give just the language name for all languages, making use of the {{langrev}} subtemplates. Having the form autocomplete the language names would probably also be helpful, so what do you think of adding this above the bit above where langInput.onchange is set:

var langNameToCode={}
function langAutoFill(e){
        e = (e || event).keyCode;if((e >= 33 && e <= 40) || e == 8 || e == 46 || e == 27 || e == 16){
        var t = this, v = t.value;
        if(v.substr(0,1) != v.substr(0,1).toUpperCase()){
                if(r.query && r.query.pages && t.value == v){
                        var l={}, ll={}
                        for(var i in r.query.pages){
                                var rqp = r.query.pages[i];ll = rqp.title < ll.title?ll:rqp;l = rqp.title > l.title?l:rqp;
                        if(!r['query-continue'] && ll.title.indexOf(l.title) == 0){
                                if(l.title != "Template:langrev/"+v){
                                        if (t.setSelectionRange){
                                                t.setSelectionRange([t.value.length, t.value = l.title.substr(17)][0], t.value.length);
                                        } else if (t.createTextRange) {
                                                var z = t.createTextRange();
                                                z.moveEnd('character', 0 - z.move('character', [t.value.length, t.value = l.title.substr(17)][0]) + t.value.length);
langInput.onkeyup = langAutoFill;

and replacing the langInput.onchange line with

langInput.onblur = function(){

? --Yair rand 14:15, 17 July 2011 (UTC)


In this edit, (diff), why does it use lang=Old French not lang=fro? Mglovesfun (talk) 16:38, 8 September 2011 (UTC)

The problem was that Old French doesn't have an ISO 639-1 code, so the script couldn't just grab the language code from the list of codes built in to editor.js. I've changed the script so that it pulls the language code out of the {{langrev}} subtemplates when the language doesn't have an easily available code. --Yair rand 20:32, 8 September 2011 (UTC)

trreq problem[edit]

It seems the sorting mechanism bugs out when it would sort a language right before a {{trreq}}, and will refuse to add the translation. Cf. machete, where I had to remove the Latvian trreq before I could add the translation. -- Liliana 16:24, 23 December 2011 (UTC)


I thought the editor barred stuff with parentheses and whatnot? I see too many of these with qualifiers in the damned page names. — [Ric Laurent] — 01:06, 16 January 2012 (UTC)

Problem when adding Cyrillic and Latin variants of sh terms[edit]

These diffs: diff, diff, diff, as well as these diff, diff, diff, classify the terms in the wrong drawer/language. There were prior instances of this problem, but I'm lazy to find them right not. If it is needed, I will. Cheers, --BiblbroX дискашн 18:34, 16 February 2012 (UTC)


Hi Conrad, I have noticed that the recent behavior of accelerated translations is not to add spaces between the , and the {{t}}-template anymore, when new translation are appended. Is this change intentional? Matthias Buchmeier (talk) 16:52, 14 March 2012 (UTC)

Nevermind, I've seen that the missing spaces feature is not active anymore. Matthias Buchmeier (talk) 16:57, 14 March 2012 (UTC)

Page name tooltip[edit]

The tooltip for the "Page name" input box is "The word with all of the dictionary-only diacritics". Isn't that box supposed to be the translation with all of the diacritics and such removed? --Yair rand (talk) 11:48, 4 September 2012 (UTC)


Regarding this diff: didn't it supersede Macedonian with Serbo-Croatian? Because they aren't the same nor does anyone knowledgeable that I know treat them so. --biblbroksдискашн 10:36, 23 October 2012 (UTC)

Oops! I keep getting Macedonian and Montenegrin confused! Sorry about that. —CodeCat 12:14, 23 October 2012 (UTC)
No problem. Cheers, --biblbroksдискашн 15:18, 24 October 2012 (UTC)

Possible useless code[edit]

Hello. I'm trying to adapt this great script to Catalan Wiktionary and I've come up with a possible useless code that could bring a bug in future:

for (var i=0; i < cb.length; i++)
thiz.elements[fields[i]].checked = values[fields[i]];

As I'm using 1 less input fields than checkbox fields, I've found a undefined error when looping last check field (I think that values[fields[i]] never has any meaningful content for thiz.elements[fields[i]].checked). Do you think those 4 lines can be deleted? -Aleator (talk) 00:18, 11 January 2013 (UTC)

need help for[edit]

In the we want also to have, that the users can input a translation without using the edit- (ännern-) button, like it is in the englisch Wiktionary possible. I have copy all translate templates, but it does not run. I think, it has something to do with the editor.js, that I could not found in the English wiktionary. Can you help me please?

I have renamed the templates: Översetten-Start (trans-top), Ö-Afstand (trans-mid), Översetten-Enn (trans-bottom) and Ö... (t...), but the changes are only translations of the name of templates, categories etc., but not in the codes itself. Can you please give me your answer on my userdiscussion page in the nds.wiktionary (: --Joachim Mos (talk) 14:00, 23 March 2013 (UTC)

A while ago, I tried to adapt en.Wikt's translation-adder to de.Wikt (see de:Benutzer:-sche/uebersetzung.js). I eventually got it to work, but it was a lot slower here than there (so AFAICT it was never deployed). I, too, would be interested in more info. - -sche (discuss) 18:58, 23 March 2013 (UTC)

Edit request[edit]

Please add the following code:

if (txt == 'no')
					return error("Please use the codes nb for Bokmål and nn for Nynorsk");

near the bit where it says "Please choose a foreign language". The language code "no" should not be supported for translations. --Njardarlogar (talk) 07:31, 27 March 2013 (UTC)

I've made the change, but will explicitly note that I do not intend it to prejudice any decision by the community to combine the Norwegian lects at some later time back into no. - -sche (discuss) 01:36, 30 May 2013 (UTC)

Minor edits?[edit]

I noticed that when I use the editor, my changes are marked as minor edits. That is probably because I have it set to default to minor in my preferences. But I don't think it's very desirable, adding a translation should always count as a major edit. Could this be changed? —CodeCat 23:18, 12 May 2013 (UTC)

trreq language[edit]

I noticed that the editor adds {{trreq}} with the language name instead of the language code. While both are officially valid, language codes are normally preferred. Can this be changed? —CodeCat 14:26, 23 May 2013 (UTC)

I've been irked by this a few times lately too. Often when I'm requesting translations I get an error message that it can't find the entry but it's very random and when I edit manually and find the mix of codes and language names for other trreq's I wonder if that's the cause. I wish I could read this callback spaghetti magic code and I would fix it myself (-; — hippietrail (talk) 05:30, 24 May 2013 (UTC)
Hopefully the autosorting bot won't muck it up again and won't sort by the code, rather than by the name (lower case language code names appearing at the end of the table, obviously "fa" precedes "he", etc.). I think that was the reason why the code was changed for the name. --Anatoli (обсудить/вклад) 05:38, 24 May 2013 (UTC)
I've reported a bug a long time ago. The problem exists with adding a translation where a neighboring language (alphabetically) has {{trreq}}, e.g. adding Macedonian (mk) when there is a Malayalam {{trreq}} (ml). I had to edit manually in such a case. --Anatoli (обсудить/вклад) 05:41, 24 May 2013 (UTC)
Why don't we put the language name before {{trreq}}? That would solve the problem. —CodeCat 12:50, 24 May 2013 (UTC)
Yes, it would probably solve the sorting problem (the new translation should replace {{trreq}}). Not the bug with {{trreq}} interfering with other languages though. --Anatoli (обсудить/вклад) 13:08, 24 May 2013 (UTC)

,language utilities|lookup_language|BLAH|names}}:[edit]

What's the deal with this long string attached to each translation? --Anatoli (обсудить/вклад) 23:56, 29 May 2013 (UTC)

It's a problem that has been reverted now, trying to find out why it happens. —CodeCat 00:01, 30 May 2013 (UTC)
Thank you. --Anatoli (обсудить/вклад) 00:05, 30 May 2013 (UTC)

Warnings for translation in the wrong script?[edit]

Can we give warnings to contributors using a wrong script (like Hindi in Roman letters, etc.), similar to the way when translations are capitalised (exception: German, Luxembourgian and proper nouns)? --Anatoli (обсудить/вклад) 00:56, 3 June 2013 (UTC)

This is a great idea. It will be handy for the quite common mixing of Cyrillic and Latin letters in exotic languages such as Avar, Chechen, and Ossetian. The first two often have I, l, or 1 for the palochka and the latter often has the Latin æ for the Cyrillic letter of identical appearance. I believe some Latin letters are used amongst Cyrillic for a few Bosnian or Montenegrin words too. — hippietrail (talk) 07:05, 3 June 2013 (UTC)
We would have to keep things in line with Module:languages though. —CodeCat 11:57, 3 June 2013 (UTC)
It's just a feature request. Not sure about the implementation. We need a working script detection modules/template and language-specific rules. As Hippietrail suggested, the script could probably suggest to use "better" letters when some letters don't seem appropriate for a given language like it suggests to replace language code "no" for "nb" or "nn". --Anatoli (обсудить/вклад) 13:23, 3 June 2013 (UTC)
I've written code to do this before in JavaScript though I've sadly lost it. First you need to split up the term into characters, being sure not to break surrogate pairs in two. Then you need an array with the start and end of each run of the same script for the entirety of Unicode. It sounds big but it's really not. Then to find the script for a character you do a binary search on this array. Binary search is very easy to program and very very fast. To create the array you need to process the Scripts.txt file provided on the Unicode site.
There are two script types that should be ignored, "Common" and "Inherited" though possibly you might be able to use even those when there are no other scripts in the term - this would indicate the term is not a word but some kind of symbol.
editor.js already includes a mapping of scripts to languages so given the language of the term and the scripts valid for it (sometimes more than one) you can find any mismatch. As a bonus it's also trivial to find any term using more than one script. I once had some Perl code that found all such terms in the dump file and I used to put them in a category.
Good luck! — hippietrail (talk) 06:48, 4 June 2013 (UTC)

impf/pf parameters[edit]

Can the tool have the ability to add impf and pf parameters (or both), similar to how genders are added, please? It would benefit all Slavic and Georgian verbs, AFIAK. Example, a Russian translation of gnaw#Translations: грызть (ru) impf (gryztʹ). --Anatoli (обсудить/вклад) 00:16, 25 June 2013 (UTC)

It can be done, but I think the way genders are specified might need some more thorough changes. It doesn't really make sense to use checkboxes because what you really want is to select individual genders, not any random combination of genders, numbers, imperfectivity and so on. So a radio button or a dropdown box would probably be better so that it's clear that the options are mutually exclusive. —CodeCat 01:01, 25 June 2013 (UTC)
Well, one can mess up genders as well or put a wrong gender or two many genders, add gender to genderless languages or PoS's using the tool. One can add transliteration where it's not needed or write a translation in a wrong script. That's why we check and correct other people's translations. Or will it cause an error to a module, if there are errors? By putting impf/pf on a separate line with a short note (or better to wikilink to perfective/imperfective description) would probably notify the user that this is for verbs in some languages only. Adding validations is important but there are many more possible invalid possibilities the tool doesn't check for. (BTW, my edit toolbar has disappeared, signing manually). --Anatoli (обсудить/вклад) 01:27, 25 June 2013 (UTC)
Of course, but that doesn't mean it isn't useful for the user interface to be logical. Using checkboxes when there is really only a limited number of sensible possibilities isn't good practice. What I would suggest is to have text boxes to enter the gender in "advanced" mode, but dropdown boxes or radio buttons that show only the genders that are valid for the language in "simple" mode. —CodeCat 01:31, 25 June 2013 (UTC)
If you could make it happen, it would be great. Script validation and warnings (a topic above) would be another great enhancement to this tool, admittedly harder. --Anatoli (обсудить/вклад) 02:06, 25 June 2013 (UTC)
Can these options be added, if there are no objections? E.g. Verb aspect (Slavic and Georgian verbs). imperfective (tick) perfective (tick). (According to Dixtosa (talkcontribs)'s categorisation, Georgian verbs also have this distinction, I'm not sure myself.) --Anatoli (обсудить/вклад) 00:08, 25 October 2013 (UTC)
A while ago I tried to make some changes to the way genders are specified, but I ended up breaking the script a few times before I got it sort-of right. I'd rather avoid doing that again. I think Ruakh is a bit more comfortable editing it, but I think we also need to look at better ways to specify the genders. Radio buttons and checkboxes are inconvenient when a huge number of genders is involved, like say for Slovene (where there are over 10 possibilities). Maybe we should switch to using dropdown boxes? —CodeCat 00:13, 25 October 2013 (UTC)
For me it's better than nothing but I prefer tickboxes, whatever is agreeable - better than having to add manually, especially if I want to add multiple translations into Slavic languages with both aspects. There are more/less buttons, so it shouldn't be a problem for those who hate too many options. Do the current options cover all Slovene possibilities? (Animate/inanimate are not really genders). BTW, what are Noun class:/ Plural class: options? --Anatoli (обсудить/вклад) 00:26, 25 October 2013 (UTC)
The noun class is for languages that have numbered or named "genders" like the Bantu languages. Animacy isn't a gender, but it's specified as part of one and triggers agreement the same way, so I do think we should include it among the translations. —CodeCat 00:32, 25 October 2013 (UTC)
As a design suggestion, we could use expandable sections, which could be hidden if not required. Like hiding verb aspects for non-Slavic translations and by default. No idea how hard it is.
With animacy, all Slavic gender possibilities would be big, not only Slovene. I'm neutral on adding this option to translations but I suspect there could be strong objections from others. Simply animate/inanimate tickboxes would allow multiple combinations, though. --Anatoli (обсудить/вклад) 00:43, 25 October 2013 (UTC)
A tickbox wouldn't always work right. In Slovene, for example, only masculine nouns have animacy, so ticking it for a feminine or neuter noun wouldn't make sense. A dropdown box could just list all possibilities as mutually exclusive: m-an, m-in, f, n, m-d, f-d, n-d, m-p, f-p, n-p, pf, impf. —CodeCat 00:50, 25 October 2013 (UTC)

Marking of Esperanto verbs as transitive or intransitive or both[edit]

All verbs in Esperanto should be marked as either transitive (tr) or intransitive (ntr) or both (ussualy marked with "X"). Could you add the possibility of specifying this to the script? Also, if the user is unable to provide with such a marking this should be considered an error in my view and followed up accordingly.--Liberumia (talk) 07:34, 23 August 2013 (UTC)

I wonder if this should rather be in the {{qualifier}}. Transitive (tr) or intransitive (intr) are not currently part of verb headers but are used as context, as far as I know. --Anatoli (обсудить/вклад) 00:29, 25 October 2013 (UTC)

Language codes should be checked for validity[edit]

And they are not. Resulting in things like this.

My recent additions to Module:JSON data may help in addressing this and another problem along the way… Keφr 18:05, 12 November 2013 (UTC)

alt= gets added again when translations have stress marks/diacritics[edit]

I don't know what did it but see diff. Note that Ruakh's edit allowed to check for entries in FL wikis and +. --Anatoli (обсудить/вклад) 06:16, 12 January 2014 (UTC)

When this script asked the MediaWiki API to parse {{#invoke:links|remove_diacritics|лесовик|ru}} {{#invoke:links|remove_diacritics|лесови́к|ru}}, it got back a script error (because Module:links no longer has a remove_diacritics function; see this edit). So this script couldn't verify that лесовик and лесови́к were equivalent, so it erred in the direction of assuming they're different (since that's the safer assumption). —RuakhTALK 07:17, 12 January 2014 (UTC)
I've reverted the above-linked edit for now, though we probably don't want to keep that function there permanently if this is the only thing using it. —RuakhTALK 07:24, 12 January 2014 (UTC)
I've put a note in Module:links that this script is using it so it won't be removed. Could someone make an inventory of all the module functions and templates that our scripts use, and add notes to each of them? Scripts don't create transclusions, so there's no way to find out when they use something. —CodeCat 14:00, 12 January 2014 (UTC)

Performance with some languages[edit]

Adding translations for some language takes for ever or times out, e.g. Cantonese, Amharic. --Anatoli (обсудить/вклад) 08:13, 21 January 2014 (UTC)

Fixing getVanillaIndexOf()[edit]

Currently getVanillaIndexOf() doesn't support nested templates, which is also marked with FIXME. The solution is really simple:

getVanillaIndexOf: function getVanillaIndexOf(str, text, pos)
else if (pos == tpos)
	pos = getVanillaIndexOf('}}', text, pos + 2) + 2;

Let me know if you have any questions. Skalman (talk) 18:28, 8 February 2014 (UTC)

Old East Slavic (orv)[edit]

I can't add translations into Old East Slavic (orv). Is anything wrong with orv:{g:["m","f","n","m-p","f-p","n-p","impf","pf"],sc:"Cyrl"},? It's identical to other languages with the same structure, e.g. Rusyn (rue). --Anatoli (обсудить/вклад) 01:13, 18 March 2014 (UTC)

Missing space[edit]

A very minor complaint, but "(e.g. Cyrl for Cyrillic, Latn for Latin)" should be " (e.g. Cyrl for Cyrillic, Latn for Latin)" like the other examples. Otherwise it gets squished up against the text input. Kaldari (talk) 07:49, 14 June 2014 (UTC)

Wrong order Icelandic/Catalan[edit]

This edit has inserted Catalan after Icelandic. --Vriullop (talk) 15:18, 14 June 2014 (UTC)

It inserted it in the right place. It's Icelandic that was misplaced. —CodeCat 15:19, 14 June 2014 (UTC)
Oh, of course, I did not notice Icelandic was before French. --Vriullop (talk) 15:33, 14 June 2014 (UTC)


That last edit broke this. I can't enter translations anymore. —Stephen (Talk) 13:50, 22 June 2014 (UTC)
I’m not having any problem. Have you tried refreshing your browser? — Ungoliant (falai) 17:25, 22 June 2014 (UTC)
Well, four more edits were made after that, and it started working again. —Stephen (Talk) 18:08, 22 June 2014 (UTC)

This stopped working for me few days ago. It works when I'm logged out. --Vahag (talk) 16:56, 30 July 2014 (UTC)

What do you mean by "stopped working"? Keφr 17:17, 30 July 2014 (UTC)
It's as if the gadget is disabled. These are the errors I get in JavaScript Console of Chrome. --Vahag (talk) 18:26, 30 July 2014 (UTC)
Everything else works? Also, have you got the "Enable legacy global scripts (disable at your own risk)" gadget enabled? Keφr 18:46, 30 July 2014 (UTC)
Yes, I have that gadget enabled. Orange links and green links are working. Targeted translations and this tool are not working. Sometimes, when I refresh a page, they appear. Here is the JavaScript Console for when they worked and this is for when they didn't. --Vahag (talk) 19:24, 30 July 2014 (UTC)
I think I know the nature the error, but its location reported in your screenshot does not make sense. Try again now. Keφr 19:40, 30 July 2014 (UTC)
It's working again, thanks. --Vahag (talk) 20:03, 30 July 2014 (UTC)
Wonderfool. Now I have no idea how I actually fixed it. Or whether I did. Keφr 20:08, 30 July 2014 (UTC)

Capitalized language codes[edit]

Some platforms (iOS) automatically capitalize text-field entry. So if I enter “uk” it turns to “Uk”, and the script returns a not-too-helpful, and technically inaccurate, “invalid language code” error message. This could confuse users, and requires extra steps. It would be better if the script automatically neutered all caps in the entry. Thanks. Michael Z. 2014-06-30 15:01 z

ERROR:TypeError: undefined is not a function[edit]

I tried to add a translation to board up. I used 'nl' as language code and 'dichttimmeren' as translation. I pressed the 'preview translation' button. I saw briefly a green dialog in the top left corner that changed to blue with the error message 'ERROR:TypeError: undefined is not a function'. Difool (talk) 21:49, 8 October 2014 (UTC)

{{ttbc}} messes up this script. It worked after that template was removed. — Ungoliant (falai) 22:00, 8 October 2014 (UTC)

Feature request: Add a warning akin to "You are editing while not logged in. Are you sure?"[edit]

Because I accidentally contributed a translation while I was not logged in and now that edit will forever belong to an IP instead of me. If I manually edited the page I'd have seen this reminder at the top of the page: You are not logged in. If you save your edits to this page, your IP address will be recorded in the page's history. For that and other reasons, you should create an account. But as I was using the Add translation tool, I saw no such warning. (Also; After I logged in, the Add translation tool disappeared from the page. It only returned just now, after what must have been more than a couple refreshes.) 3ICE (talk) 09:22, 8 November 2014 (UTC)

Malay (ms) need to install this feature[edit]

I try to implement the code in my /vector.js but it's like not displaying the funtions. Gotta help me! Thanks... SNN95 (talk) 16:41, 21 January 2015 (UTC)

Automatic addition of script templates[edit]

Can we disable the automatic addition of the sc= template, as in this? They are not needed anymore. User:Benwing removed all redundant sc=Armn, sc=Geor, sc=polytonic's, but they are being readded by this tool. --Vahag (talk) 11:50, 20 July 2015 (UTC)

I can't edit this file, but you can remove the addition of sc= for particular languages by editing the metadata starting on line 2213 and e.g. removing sc:"Grek" from el, sc:"Armn" from hy, sc:"Arab" from ar, etc. Looks like this was already done by User:ObsequiousNewt for sc=polytonic. Alternatively, if you think it's safe to never add sc= for any language, remove the code ( ? '|sc=' + : '') + from line 1548. Benwing (talk) 11:15, 21 July 2015 (UTC)
Thanks. I am almost sure it is safe to never add sc= for any language, but I will let more technically-experienced users decide that. PS You should be able to edit protected pages. @Atitarev, please nominate Benwing for adminship, if he agrees. I would do it myself, but my brand is toxic :) --Vahag (talk) 14:21, 21 July 2015 (UTC)
@Vahagn Petrosyan, Benwing Yes, I will nominate as soon as I have a bit more time. I'd prefer to ask someone else right as I am very busy these days :). If no-one does, I will, Benwing definitely qualifies. --Anatoli T. (обсудить/вклад) 14:30, 21 July 2015 (UTC)

Could not find translation table for ' '. Glosses should be unique[edit]

Hi, is it possible to use this gadget on other wikis? I try to use this in hywiktionary but it always says "Could not find translation table for 'es:hola'. Glosses should be unique". Please help us --ԱշոտՏՆՂ (talk) 11:53, 8 December 2015 (UTC)


Rhyme editor bug[edit]

Hello. I found a small bug with the rhyme editor: when adding multiple rhymes and some of them fail, the failed rhymes will still be listed in the edit summary. Example edit: diff. Redboywild (talk) 17:09, 27 February 2016 (UTC)

Feature request for rhyme editor[edit]

I would like to make the rhyme editor use {{l}} instead of plain wikilinks. I have already been using {{l}} in Icelandic rhyme pages (e.g. Rhymes:Icelandic/œht) for a long time, and the current rhyme editor will not order new words on these pages correctly. This will mean that {{l}} would be standard in rhyme pages, at least for languages other than English; I suppose we'll have to discuss whether we want it on English rhyme pages as well. – Krun (talk) 12:13, 14 March 2016 (UTC)

Consistency is pretty important here. If there's going to be a switchover from plain links to {{l}}, a bot should fix all the pages in the namespace before the script is modified, in my opinion. --Yair rand (talk) 22:04, 14 March 2016 (UTC)
Yes, that would probably be best. – Krun (talk) 22:06, 14 March 2016 (UTC)


Hi, Your translation editor has a bug: every time a user types "hr" into the language field, your software changes it to "sh". The languages may be similar in a lot of respects, but are essentially different. Please see that you correct that. Thanks! Ivi104 (talk) 13:38, 16 July 2016 (UTC)

That's not a bug, it's a feature. Serbian and Croatian (as well as Bosnian and Montenegrin) are considered one language here, following linguistic consensus. —Μετάknowledgediscuss/deeds 16:24, 16 July 2016 (UTC)

Bug when adding a translation after editing table header[edit]

Hello, in case someone is able to struggle with this script, I noticed that, if you try to add a translation after editing a table header, it will raise an error (ERROR:TypeError: children[i].className is undefined). You can test in the sandbox. — Automatik (talk) 00:48, 24 January 2017 (UTC)

Wiki markup in the translation[edit]

Could we allow using the | character so that I can add sum-of-parts translations using inflected forms?

As an example, I'd like to put [[лонх|лонхны]] [[хүзүү]] (лонхны хүзүү) as a translation for bottleneck, literally "bottle.GEN neck". Crom daba (talk) 18:30, 18 February 2017 (UTC)

Done. DTLHS (talk) 18:49, 18 February 2017 (UTC)


Hi, I'd ask some programmer to add a standard displaying of "masculine/feminine" choices after inserting the code vec (Venetian language), the same as when inserting Italian translations. It's very useful when working with this language. Thank you --Tn4196 (talk) 20:19, 26 March 2017 (UTC)

RFM discussion: April 2016–March 2017[edit]


The following discussion has been moved from Wiktionary:Requests for moves, mergers and splits (permalink).

This discussion is no longer live and is left here as an archive. Please do not modify this conversation, but feel free to discuss its conclusions.

User:Conrad.Irwin/editor.js to something better

This hasn't been Conrad's personal project for many years, so we should give it a name that reflects its full status on Wiktionary. I don't know what name should be used, or if there is a naming scheme for these kinds of things. I know very little of our JS infrastructure overall. But I do think this should be renamed. —CodeCat 16:07, 13 April 2016 (UTC)

First off, editor.js actually contains two different chunks of code: translation-related stuff and the actual Editor class. I think we should
  1. make an opt-in gadget out of the former replacing this and
  2. move Editor in a separate file and let it be imported always because other scripts may depend on them (I know my scripts do).
Both should be in the MediaWiki namespace of course. --Dixtosa (talk) 17:27, 2 November 2016 (UTC)
We should definitely move the codes from editor.js and User:Conrad.Irwin/creation.js and User:Conrad.Irwin/iwiki.js to their corresponding gadget pages as soon as possible because scripts that are in users' namespace load unminimized. I have tested this and minimizing editor.js alone saves us 40kb (~half of it). If my instructions above are not clear let me know. -Dixtosa (talk) 19:40, 5 November 2016 (UTC)
Yes, please move to mainspace. It should also be renamed but I don't know what to call it. Equinox 19:44, 5 November 2016 (UTC)
Moved to MediaWiki:Gadget-TranslationAdder.js. Feel free to separate the non-translation stuff mentioned above into a separate gadget. - -sche (discuss) 06:44, 27 March 2017 (UTC)