Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Mediawiki

Internalization for non-Special-Page extensions

 

 

Wikipedia mediawiki RSS feed   Index | Next | Previous | View Threaded


tccroninv at gmail

Oct 14, 2009, 2:44 PM

Post #1 of 2 (542 views)
Permalink
Internalization for non-Special-Page extensions

Hello all,



I have some extensions that I wrote for a project that is moving forward.
The final task is internalization. For special page extensions I was able
to find documentation at http://www.mediawiki.org/wiki/Manual:Special_pages
and http://www.mediawiki.org/wiki/Internationalization that was able to get
me through without a problem. However, I have some tag and hook extensions
that I would like to add internalization for and I can't seem to load them
properly. I have used $wgExtensionMessagesFiles and
wfLoadExtensionMessages, but I am not sure if I used them properly.



Any help in pointing me to documentation for this or any pointers would be
great, I've begun looking through extensions in the matrix, but a lot of
them don't use i18n in the same way I would like to.



Thanks,

Tim Cronin



_______________________________________________
MediaWiki-l mailing list
MediaWiki-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


tccroninv at gmail

Oct 15, 2009, 4:52 PM

Post #2 of 2 (481 views)
Permalink
Re: Internalization for non-Special-Page extensions [In reply to]

Hello All,



First off, sorry for using "internalization" rather than
"internationalization". I noticed the errors just after hitting send.



I have solved my own problem with a bit more trial and error. For those
that are finding this in the future here's the answer I came up with:



You use $wgExtensionMessagesFiles to add the extension message file that you
have set up. It doesn't appear to matter where this is, so long as the file
in which it appears is require()'d iin some way. An example of this is as
follows:



$wgExtensionMessagesFiles['referenceName'] =
'/path/to/messages_file.i18n.php';



Note: It is common to have 'referenceName' match 'messages_file' and for
this to also be the name of the extension.



You then need to use wfLoadExtensionMessages inside any function that you
are using in which you want some translation. This is what I was missing:
you apparently can't just use it in the constructor as you can with a
SpecialPage subclass. An example would be:



wfLoadExtensionMessages('referenceName');

Note: referenceName is the same as in $wgExtensionMessagesFiles



Now you can use the multitude of wfMsg functions and the other i18n
functions to internationalize your content. Again, it appears that after
the calling function is finished working, the messages are unloaded and you
need to load them again in any new function that you create.



If I am sending people astray, please let me know,



Thanks,

Tim





_______________________________________________
MediaWiki-l mailing list
MediaWiki-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

Wikipedia mediawiki RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.