# Image Uploader scripting API

## Internalization

`tr(string key, string englishText)version >= 1.3.1` Translates a string to the current language.

key represents an id of this message, should be like "scriptname.some_key1.some_key2". You should use string literal only for both arguments! Do not form them dynamically.
scriptname should be the same as your script file (without .nut extension).

Translated strings should be stored in json file `Scripts/Lang/<language_name>.json`.
language_name should be the same as in program's translation filename `Lang\<language_name>.lng`

Aliases for this function: `Translate()` (you can override these functions in your code).

Due to backward compatibility reasons, you should override the tr function in your scripts with this workaround:

    function tr(key, text) {
    	try {
    		return Translate(key, text);
    	}
    	catch(ex) {
    		return text;
    	}
    }

Scripts/example.nut

    print(tr("example.hello_world", "Hello world!"));

Scripts/Lang/Spanish.json

    {
      "example" : {
         "hello_world" : "¡Hola, mundo!"
      }
    }

Output:

    ¡Hola, mundo!