Hi Jain, (hope this is your first name :) ) $msg is a instance of xwiki messaging tool. (swiki-core\src\main\java\com\xpn\xwiki\web\XWikiMessageTool.java) it is mostly used to get translations for a certain translation key. translations are kept in bundles in specific documents like this: translationkey1=My english version of this translation_key_2=My text here You can add a document as translation document by going in xwiki administration /bin/admin/XWiki/XWikiPreferences > Preferences > Advanced section > Internationalization Document Bundles and adding the fullnames of the documents that want to act as translation pages. Like: MySpace.Translations After you add your document here, you can do wherever you want $msg.get("translation_key_2") or more simple ${msg.translation_key_2} and you text will render. To add another language just translate your translation document in the desired language (use the "Translate this document into" link).
Guillaume,
You said that $msg.get("translation") would render a message. But, how do I know what are the otehr strings (like "translation") that I can use to render appropriate messages. Is there a lsit of these somewhere in the code or on xwiki.org?
Thanks
On Wed, Apr 16, 2008 at 1:28 PM, Kamna Jain <[email protected]> wrote:
Hello Devs,
In the past few days, I have been looking a lot at the Velocity templates and the Xwiki core code. There are a few things I am not able to understand.
1) Where is $msg variable defined in the core code? I see it a lot in the scripts. Is it a hashtable for messages. Where is it defined?
2) what is referred to by "xpage","xredirect"
For eg. in the following mehtod from Utils.java
public static String getPage(XWikiRequest request, String defaultpage) { String page; page = request.getParameter("xpage"); if ((page == null) || (page.equals(""))) { page = defaultpage; } return page; }
does this mean, that if a page with that name exists in the template directory(xpage), it will be returned. But, what is defaultpage?
Currently the login page does not show any error if the provided credentials are wrong. (authentication with LDAP) A look at the LoginErrorAction.java in the Web package revealed that it returns the same string as the LoginAction - "login" so, if I created anither loginerror.vm in teh templates folder and returned "loginerror" in the render function of this LoginErrorAction.java class, it would run the new script.
But, at this stage I do not know what would be the content of the loginerror.vm.... #xwikimessageboxstart($msg.get("error") $msg.get("notallowed")) - would this work?
I picked this up from accessdenied.vm ...
Thanks for all help
Thanks
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs