@@ -0,0 +1,2995 @@
+package com.xpn.xwiki.plugin.applicationmanager.core.plugin;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.ResourceBundle;%0A%0Aimport com.xpn.xwiki.XWikiContext;%0Aimport com.xpn.xwiki.web.XWikiMessageTool;%0A%0A/**%0A * Plugin internationalization service based %7B@link XWikiMessageTool%7D.%0A * %0A * @version $Id: $%0A */%0Apublic class XWikiPluginMessageTool extends XWikiMessageTool%0A%7B%0A    /**%0A     * @param bundle the default Resource Bundle to fall back to if no document bundle is found when%0A     *            trying to get a key%0A     * @param context the %7B@link com.xpn.xwiki.XWikiContext%7D object, used to get access to XWiki%0A     *            primitives for loading documents%0A     */%0A    public XWikiPluginMessageTool(ResourceBundle bundle, XWikiContext context)%0A    %7B%0A        super(bundle, context);%0A    %7D%0A%0A    /**%0A     * %7B@inheritDoc%7D%0A     * %3Cp%3E%0A     * Start calling %3Ccode%3Econtext%3C/code%3E's %7B@link XWikiMessageTool#get(String)%7D then if nothing is found%0A     * use plugin's %7B@link ResourceBundle%7D.%0A     * %0A     * @see com.xpn.xwiki.web.XWikiMessageTool#getTranslation(java.lang.String)%0A     */%0A    protected String getTranslation(String key)%0A    %7B%0A        String translation = this.context.getMessageTool().get(key);%0A%0A        if (translation == key) %7B%0A            try %7B%0A                translation = this.bundle.getString(key);%0A            %7D catch (Exception e) %7B%0A                translation = null;%0A            %7D%0A        %7D%0A%0A        return translation;%0A    %7D%0A%0A    /**%0A     * Find a translation and then replace any parameters found in the translation by the passed%0A     * params parameters. The format is the one used by %7B@link java.text.MessageFormat%7D.%0A     * %0A     * @param key the key of the string to find%0A     * @param params the array of parameters to use for replacing %22%7BN%7D%22 elements in the string. See%0A     *            %7B@link java.text.MessageFormat%7D for the full syntax%0A     * @return the translated string with parameters resolved%0A     * @see com.xpn.xwiki.web.XWikiMessageTool#get(String, List)%0A     */%0A    public String get(String key, String%5B%5D params)%0A    %7B%0A        List paramList = new ArrayList(params.length);%0A%0A        for (int i = 0; i %3C params.length; ++i) %7B%0A            paramList.add(params%5Bi%5D);%0A        %7D%0A%0A        return get(key, paramList);%0A    %7D%0A%0A    /**%0A     * Find a translation and then replace any parameters found in the translation by the passed%0A     * param parameter. The format is the one used by %7B@link java.text.MessageFormat%7D.%0A     * %0A     * @param key the key of the string to find%0A     * @param params the parameter to use for replacing %22%7B0%7D%22 element in the string. See%0A     *            %7B@link java.text.MessageFormat%7D for the full syntax%0A     * @return the translated string with parameters resolved%0A     * @see com.xpn.xwiki.web.XWikiMessageTool#get(String, List)%0A     */%0A    public String get(String key, String param)%0A    %7B%0A        List paramList = new ArrayList(1);%0A%0A        paramList.add(param);%0A%0A        return get(key, paramList);%0A    %7D%0A%7D%0A

Add XWikiPluginMessageTool that extends XWikiMessageTool. His goal is to first search in the context if a message key string exist and if not use the "default" one in the ResourceBundle defined by the plugin.