# Rosetta

> Rosetta resource files localization

URL: https://store.crowdin.com/rosetta
Identifier: rosetta
Category: File Formats
Type: App
Author: Crowdin

Rosetta is a very lightweight, general-purpose internationalization library. The resource files of Rosetta are typically JS files, sometimes with JS code inside texts.



**Note:** Rosetta allows you to store all locales in one JS object. To translate your resource files with Crowdin you would have first separate your locales to one per language. JS code inside resource files is allowed.

## File Format Details

| Attribute | Value |
| --------- | ----- |
| File Extension | .json, .js |
| [API Type](https://developer.crowdin.com/api/v2/#operation/api.projects.files.post) | js |
| Source can be edited in Crowdin | No |
| Generating translated files via [Bundles](https://support.crowdin.com/bundles/) | [Search Crowdin Store](https://store.crowdin.com/tags/string-exporter) |
| Supports pluralization | No |
| WYSIWYG Preview in the editor | Yes |
| Supported types of contextual information | WYSIWYG |
| Custom attributes | No |
| Existing translations import possibility | Key-value mapping (trivial) |

## Sample File

```javascript
const i18n = rosetta({
  strings: {
    intro: {
      welcome: 'Welcome, {{username}}!',
      text: 'I hope you find this useful.',
    },
    bar: 'template sees "{{value}}"',
    support(obj) {
      let hour = Math.floor(Math.random() * 3) + 9;
      let str = `For questions, I'm available on ${obj.date.toLocaleDateString()}`;
      str += `, any time after ${hour}:00.`
      return str;
    }
  }
}
```
