/**
 * @(#)I18n.java	11/03/05
 * 
 * Copyright 2005 3GP01, KCL.
 * 
 * This program 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 2
 * of the License, or (at your option) any later version.
 *
 * This program 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.
 *
 * The GNU General Public Licence should be contained within licence.txt;
 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA  02110-1301, USA.
 */

import java.util.Locale;
import java.util.ResourceBundle;
	
/**
 * This class contains i18n code and methods to return the current i18n and its components.
 * 
 * @author 3GP01 - Hardev Bhamra, Deepak Chandarana, James Tompkin
 * @version 2.0
 * @see Scrabble
 */

class I18n
{	
	String language = "en";
	String country = "GB";			
	Locale currentLocale = new Locale(language,country);
    ResourceBundle messages = ResourceBundle.getBundle("resources/languages/MessagesBundle", currentLocale);
    
    /**
     * Gets the current <b>language</b> of IRS.
     * 
     * @return language
     */
    public String getLanguage()
    {	
    	return language;	
    }
    
    /**
     * Gets the current <b>country</b> of IRS.
     * 
     * @return country
     */
    public String getCountry()
    {	
    	return country;	
    }
    
    /**
     * Sets the current <b>language</b> and <b>country</b>.
     * 
     * @param lang The desired language.
     * @param count The desired country.
     */
    public void setLanguageAndCountry(String lang, String count)
    {	
    	language = lang;
    	country = count;	
    }
    
    /**
     * Returns the current <b>Locale</b>.
     * 
     * @return Locale
     */
    public Locale getCurrentLocale()
    {	
    	return currentLocale;	
    }
    
    /**
     * Sets the current <b>Locale</b>.
     */
    public void setCurrentLocale()
    {	
    	currentLocale = new Locale(language, country);	
    }
    
    /**
     * Gets the current ResourceBundle.  This will contain all strings of the current Locale.
     * 
     * @return ResourceBundle
     */
    public ResourceBundle getCurrentResourceBundle()
    {	return messages;	}
    
    /**
     * Set the current ResourceBundle to be that of the current Locale.
     */
    public void setResourceBundle()
    {	messages = ResourceBundle.getBundle("resources/languages/MessagesBundle", currentLocale);	}
}  