contao/import — Issue #3629: Contao-2.11.beta: javascript - use one global variable in backend
Author: DyaGa
Created: 2011-11-29 21:54:01+00:00
State: open
Labels: Feature

In Contao 2.11.beta you add `getLocaleString` method in BackendTemplate and it returns such JS code:

```
var CONTAO_THEME="default",
CONTAO_COLLAPSE="Collapse node",
CONTAO_EXPAND="Expand node",
CONTAO_LOADING="Loading data",
CONTAO_SCRIPT_URL="",
REQUEST_TOKEN="95f42d8e9d13a3aff9a60c149dc7d2b2";
```

in this case we have 6 global variables in JS code.

To my mind, the best solution will be to use one global variable `Contao`, example:

```
var Contao = {
theme: "default",
lang: {
collapse: "Collapse node",
expand: "Expand node",
loading: "Loading data",
},
script_url: "",
request_token: "95f42d8e9d13a3aff9a60c149dc7d2b2"
};
```

--- _Originally created on November 12th, 2011, at 11:14pm (ID 3629)_