Getting started

July 14, 2017

In this guide, we will setup you’re first project, sync a localization file and make updates on a sample project.

Install the Accent CLI

This CLI will be used to communicate with Accent’s API.

GitHub Repository

$ npm install -g accent-cli

Configuring the tool

accent-cli reads from the accent.json file. The file should contain valid JSON representing the configuration of your project. If your project stores the localization files in app/locales, the accent.json file should look like:

{
  "api": {
    "url": "http://your.accent.instance",
    "key": "2nziVSaa8yUJxLkwoZA"
  },
  "sync": [
    {
      "language": "fr",
      "format": "json",
      "path": "app/locales/fr/*.json"
    }
  ]
}

WARNING: The CLI is very easy to use

Sync your first file

This will sync the file app/locales/fr/translations.json.

$ accent sync --write
Fetch config... ✓
=== Sync My First Project

Syncing paths (1)
→ app/locales/fr/*.json

app/locales/fr/translations.json
✓ Successfully synced the files in Accent

Writing paths (1)
→ app/locales/fr/*.json

app/locales/fr/translations.json
✓ Successfully write the locale files from Accent

You can also preview the changes that a sync will make before overwriting your locale files!

$ accent sync
Fetch config... ✓
=== Sync My First Project

Syncing paths (1)
→ app/locales/fr/*.json

app/locales/fr/translations.json
new 10
remove 3

Et Voilà!

You can now start to translate your project! After you have made some changes, just run the sync command to update your master language.

Adding another language

In the web UI, you can add another language which will follow the master language. It will add the same strings when you sync, remove the same strings and add conflicts when strings in the master language are marked as conflicts.

After this is done. you can now add a new add translations section to your config so all files can be updated:

{
  "api": {
    "url": "http://your.accent.instance",
    "key": "2nziVSaa8yUJxLkwoZA"
  },
  "sync": [
    {
      "language": "fr",
      "format": "json",
      "path": "app/locales/fr/*.json"
    }
  ],
  "addTranslations": [
    {
      "language": "en",
      "format": "json",
      "path": "app/locales/en/*.json"
    }
  ]
}

Now, if you want to sync your translations, you just use the add-translations command.

Of course you can preview first.

$ accent add-translations
Fetch config... ✓
=== Add translations My First Project

Adding translations paths (1)
→ app/locales/en/*.json

app/locales/en/translations.json
update 4

And update locale file when everything looks good!

$ accent add-translations --write

Hooks, stats…

And more features coming soon, the accent-cli is a must for Accent users!

Ready to get started?

Deploy Accent and start translating your project!