<commit_before># Angular 2 Localization
> Angular 2 Localization is an experiment of implementation of the language translation in the new Angular 2 application using TypeScript.
> it works both through direct loading and asynchronous translations.

## Use Localization class
- Create the `services` folder in the root of your Angular 2 application, and copy `localization.ts`.
- Include [js-cookie.js](https://github.com/js-cookie/js-cookie.git) library.
- Include `js-cookie.d.ts` TypeScript Definition from [tsd](https://github.com/DefinitelyTyped/tsd.git).
- Add in route component:
```TypeScript
@Component({
      selector: 'app',
      bindings: [Localization] 
})
...
class app {
     constructor(public localization: Localization){
     ...
 }
}
bootstrap(app, [HTTP_BINDINGS]);
```

### Direct loading
To inizialize localization by direct loading add the following code in the body of constructor of route component:
```TypeScript
var translationEN = {
      EXAMPLE: 'example',
      ...
}
// add a new translation here<commit_msg>Correct description<commit_after># Angular 2 Localization
> Angular 2 Localization is an experiment of implementation of the translation in the new Angular 2 applications using TypeScript.
> It works both through direct loading and asynchronous translations.

## Use Localization class
- Create the `services` folder in the root of your Angular 2 application, and copy `localization.ts`.
- Include [js-cookie.js](https://github.com/js-cookie/js-cookie.git) library.
- Include `js-cookie.d.ts` TypeScript Definition from [tsd](https://github.com/DefinitelyTyped/tsd.git).
- Add in route component:
```TypeScript
@Component({
      selector: 'app',
      bindings: [Localization] 
})
...
class app {
     constructor(public localization: Localization){
     ...
 }
}
bootstrap(app, [HTTP_BINDINGS]);
```

### Direct loading
To inizialize localization by direct loading add the following code in the body of constructor of route component:
```TypeScript
var translationEN = {
      EXAMPLE: 'example',
      ...
}
// add a new translation here
{'fraction_non_alphanumeric': 0.10662824207492795, 'fraction_numerical': 0.0038424591738712775, 'mean_word_length': 4.092909535452323, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1610434', 'n_tokens_mistral': 586, 'n_tokens_neox': 544, 'n_words': 213}