/**
* 
* <b>Includes (+Dependences):</b>
* <code>
*   <script type="text/javascript" src="/_bsJavascript/core/util/Bs_String.lib.js"></script>
* </code>
* 
* <b>How to use:</b>
* include this class
* include/define your class
* then execute: YourClass.inherits(Bs_Languageable);
* 
* <b>How it works:</b>
* 
* @author     andrej arn <andrej-at-blueshoes-dot-org>
* @package    javascript_core
* @subpackage lang
* @copyright  blueshoes.org
*/
function Bs_Languageable() {}
	
	/**
	* language iso code. note that such a language file needs to exist in the lang folder.
	* @access private
	* @var    string _language
	* @see    this.setLanguage()
	* @since  bs-4.6
	*/
	Bs_Languageable.prototype._language = 'en';
	
	/**
	* sets the language specified.
	* note that such a language file needs to exist in the lang folder, and the file needs to be included.
	* check the examples.
	* @access public
	* @param  string language (iso code.)
	* @return bool (true if the language is available, false if not.)
	* @see    this._language
	* @since  bs-4.6
	*/
	Bs_Languageable.prototype.setLanguage = function(language) {
		//lang handling
		//if (typeof(Bs_DatePicker_Lang) == 'undefined') return false;
		//if (typeof(Bs_DatePicker_Lang[language]) == 'undefined') return false;
		this._language = language;
		return true;
	}
	
	/**
	* returns a text string for the current language.
	* @access public
	* @param  string section
	* @param  string key
	* @param  array args
	* @return string
	* @throws key (if no such key is defined, a string "section key" is returned.)
	*/
	Bs_Languageable.prototype.getInterfaceText = function(section, key, args) {
		try {
			var str = Bs_InterfaceText[this.className][this._language][section][key];
			if (args) {
				str = sprintf(str, args);
			}
			return str;
		} catch (e) {
			alert(e);
			return section + ' ' + key;
		}
	}


