// Path: src/main/java/net/eliosoft/elios/main/LoggersManager.java
// public class LoggersManager {
//     private static LoggersManager instance;
// 
//     private HashMap<String, Logger> loggersMap = new HashMap<String, Logger>();
// 
//     private LoggersManager() {
//     }
// 
//     /**
//      * get the singleton instance of the LoggersManager.
//      *
//      * @return the instance
//      */
//     public static LoggersManager getInstance() {
//         if (LoggersManager.instance == null) {
//             LoggersManager.instance = new LoggersManager();
//         }
//         return LoggersManager.instance;
//     }
// 
//     /**
//      * gets the logger with the given name.
//      *
//      * @param loggerName
//      *            the name of the logger to get
//      * @return the logger with the corresponding name
//      */
//     public Logger getLogger(final String loggerName) {
//         if (!loggersMap.containsKey(loggerName)) {
//             this.loggersMap.put(loggerName, Logger.getLogger(loggerName));
//         }
//         return this.loggersMap.get(loggerName);
//     }
// 
//     /**
//      * get all the loggers of the application.
//      *
//      * @return a list containing all the loggers
//      */
//     public List<Logger> getLoggersList() {
//         return new ArrayList<Logger>(this.loggersMap.values());
//     }
// }


import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.logging.Logger;
import net.eliosoft.elios.main.LoggersManager;
/*
 * This file is part of Elios.
 *
 * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON
 *
 * Elios is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Elios is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Elios. If not, see <http://www.gnu.org/licenses/>.
 */

package net.eliosoft.elios.gui.views;



/**
 * This class provides i18n functionalities.
 *
 * @author Alexandre COLLIGNON
 */
public final class Messages {
    /** bundle full qualified name. **/
    private static final String BUNDLE_NAME = "net.eliosoft.elios.gui.views.messages"; //$NON-NLS-1$

    private static final Logger LOGGER = LoggersManager.getInstance()
            .getLogger(Messages.class.getCanonicalName());

    /** bundle instance. **/
    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
            .getBundle(BUNDLE_NAME);

    /**
     * Ensure that no object can be create.
     */
    private Messages() {
        // nothing
    }

    /**
     * Returns the localized text of the given key if the resource is found,
     * returns !key! (key is the argument) otherwise.
     *
     * @param key
     *            string that identified a localized text
     * @return the localized text or !key! is the resource is not found
     */
    public static String getString(final String key) {
        try {
            return RESOURCE_BUNDLE.getString(key);
        } catch (MissingResourceException e) {
            return fallbackTranslation(key);
        }
    }

    /**
     * Returns the localized text of the given key if the resource is found or
     * throws a MissingResourceException.
     *
     * @param key
     *            string that identified a localized text
     * @return the localized text
     * @throws MissingResourceException
     *             if the resource is not found
     */
    private static String internalGetString(final String key)
            throws MissingResourceException {
        return RESOURCE_BUNDLE.getString(key);
    }

    /**
     * Returns a formatted localized string identified by the given key. The
     * string is populated according to {@link MessageFormat}.
     *
     * @param key
     *            string that identified a localized text
     * @param objects
     *            variable arguments of Object that will used to populated the
     *            string
     * @return the populated localized text, returns !key! (key is the argument)
     *         otherwise.
     */
    public static String getString(final String key, final Object... objects) {
        try {
            return new MessageFormat(internalGetString(key)).format(objects);
// Path: src/main/java/net/eliosoft/elios/main/LoggersManager.java
// public class LoggersManager {
//     private static LoggersManager instance;
// 
//     private HashMap<String, Logger> loggersMap = new HashMap<String, Logger>();
// 
//     private LoggersManager() {
//     }
// 
//     /**
//      * get the singleton instance of the LoggersManager.
//      *
//      * @return the instance
//      */
//     public static LoggersManager getInstance() {
//         if (LoggersManager.instance == null) {
//             LoggersManager.instance = new LoggersManager();
//         }
//         return LoggersManager.instance;
//     }
// 
//     /**
//      * gets the logger with the given name.
//      *
//      * @param loggerName
//      *            the name of the logger to get
//      * @return the logger with the corresponding name
//      */
//     public Logger getLogger(final String loggerName) {
//         if (!loggersMap.containsKey(loggerName)) {
//             this.loggersMap.put(loggerName, Logger.getLogger(loggerName));
//         }
//         return this.loggersMap.get(loggerName);
//     }
// 
//     /**
//      * get all the loggers of the application.
//      *
//      * @return a list containing all the loggers
//      */
//     public List<Logger> getLoggersList() {
//         return new ArrayList<Logger>(this.loggersMap.values());
//     }
// }


// Path: src/main/java/net/eliosoft/elios/gui/views/Messages.java
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.logging.Logger;
import net.eliosoft.elios.main.LoggersManager;

/*
 * This file is part of Elios.
 *
 * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON
 *
 * Elios is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Elios is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Elios. If not, see <http://www.gnu.org/licenses/>.
 */

package net.eliosoft.elios.gui.views;



/**
 * This class provides i18n functionalities.
 *
 * @author Alexandre COLLIGNON
 */
public final class Messages {
    /** bundle full qualified name. **/
    private static final String BUNDLE_NAME = "net.eliosoft.elios.gui.views.messages"; //$NON-NLS-1$

    private static final Logger LOGGER = LoggersManager.getInstance()
            .getLogger(Messages.class.getCanonicalName());

    /** bundle instance. **/
    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
            .getBundle(BUNDLE_NAME);

    /**
     * Ensure that no object can be create.
     */
    private Messages() {
        // nothing
    }

    /**
     * Returns the localized text of the given key if the resource is found,
     * returns !key! (key is the argument) otherwise.
     *
     * @param key
     *            string that identified a localized text
     * @return the localized text or !key! is the resource is not found
     */
    public static String getString(final String key) {
        try {
            return RESOURCE_BUNDLE.getString(key);
        } catch (MissingResourceException e) {
            return fallbackTranslation(key);
        }
    }

    /**
     * Returns the localized text of the given key if the resource is found or
     * throws a MissingResourceException.
     *
     * @param key
     *            string that identified a localized text
     * @return the localized text
     * @throws MissingResourceException
     *             if the resource is not found
     */
    private static String internalGetString(final String key)
            throws MissingResourceException {
        return RESOURCE_BUNDLE.getString(key);
    }

    /**
     * Returns a formatted localized string identified by the given key. The
     * string is populated according to {@link MessageFormat}.
     *
     * @param key
     *            string that identified a localized text
     * @param objects
     *            variable arguments of Object that will used to populated the
     *            string
     * @return the populated localized text, returns !key! (key is the argument)
     *         otherwise.
     */
    public static String getString(final String key, final Object... objects) {
        try {
            return new MessageFormat(internalGetString(key)).format(objects);
        } catch (MissingResourceException e) {