# Translate a view into several languages

> Mark texts with @(...) in views and provide translations in resource files selected by LOCALIZE().

Framework: total5
Product: Total.js 5 (total5@0.0.19)
Language: en
Content-SHA256: 46d3cf632dac9d720b148f223066319e74bd1173b10dbf1d0d75d85facde901e
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: total5-installed@total5@0.0.19
Review: not-recorded

Wrap any text of a view in `@(...)` and Total.js replaces it with the translation for the current language. Translations live in `resources/<language>.resource`; each line is `key : translation`. The key is `T` plus the hash of the original text in base 36, which `total5` can generate for you. Texts without a translation stay as written, so the view text acts as the default language.

`LOCALIZE()` decides the language of each request. Here it is read from the query string, but it can be a cookie, a header or a URL segment.

```js definitions/localization.js
LOCALIZE(function($) {
	return $.query.lang;
});
```

```text resources/sk.resource
// Total.js translation file
T4oxobw : Vitajte v obchode
```

```html views/index.html
@{layout('')}
<h1>@(Welcome to the shop)</h1>
```

```js controllers/default.js
exports.install = function() {
	ROUTE('GET /', home);
};

function home($) {
	$.view('index');
}
```
