0

Customizing your 'Citation template' for your WikiEditor

Posted by Priyanka Nag on 9:18 PM in , , , , ,

Anyone who has worked on the MediaWiki CMS, will probably know how difficult it is to handle this CMS at times. If you have ever edited Wikipedia pages (here I am referring mainly to the English Wikipedia i.e. http://en.wikipedia.org/), you will be aware of the 'Cite' option that you get at the right hand top corner of your editor. The 'citation' option is used for adding references in your document. You must be aware that when you create a new Wikipage on any Wikipedia, you need to add some relevant references against it. This is made very easy using the 'Cite' option. It gives the user, a template where the user can simply fill in some details to get the reference going, no need to worry about the tags (they are auto-generated).
This 'Cite' option which is present in the English Wikipedia is actually missing from most other Wikipedia(s). It is not at all an easy task to get the Citation option in place and working. You can read on how to get the 'Cite' option on the editor here.

Once you have the 'Cite' option in place, you might want to customize the template. If I want to get the 'Cite' option for my own language's Wikipedia, I will definitely want to have the template in my own language. To make such modifications, we have to work on a few JavaScript files like:
  • RefToolbarConfig.js
  • RefToolbarLegacy.js
  • RefToolbarMessages-en.js
The RefToolbar Messages-en.js file is responsible for the messages that are displayed in the template for the end user. If we want to customize our template in our own way, we need to first change the messages here. All messages here are hard coded, so we need to go into the code and simply change the strings. If we translate the strings to some other language, we will get the template ready for that language's Wikipedia or your own MediaWiki in that language.
Here I have given an example of how it can be done in Bengali.

Once we get the template customized, next we can go on to make a few changes in the remaining two files.
What I had done was a simple task. I had simply replaced the hard coded values in these files with variable names and assigned the variables some value. So, from next time, if some change needs to be done, we do not need to struggle through the entire piece of JavaScript, we can simply go ahead and make the changes in the variable's value. 


This way the citation template can be customized in our own required way.

0 Comments

Post a Comment

If you like the blog, you may also want to checkout Priyanka's website