var Translator = function(url, dictionary){
    this.url = url;
    this.dictionary = dictionary;
}
Translator.prototype.translate = function(string)
{
    if((this.dictionary != null) && (typeof this.dictionary[string] != 'undefined'))
    {
	return this.dictionary[string];
    }
    else
    {
	// add string to dictionary for next loading
	$.getJSON(this.url, {string: string}, function(data){})
    }
}

