Skip to content

Commit

Permalink
Quickly update README formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dewski committed Jan 25, 2012
1 parent f30409d commit d826387
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions README.md
Expand Up @@ -7,35 +7,47 @@ Tolk is a Rails 3 engine designed to facilitate the translators doing the dirty

To install add the following to your Gemfile:

gem 'tolk'
```
gem 'tolk'
```

To setup just run:

$ rake tolk:setup
```
rake tolk:setup
```

## Usage

Tolk treats I18n.default_locale as the master source of strings to be translated. If you want the master source to be different from I18n.default_locale, you can override it by setting Tolk::Locale.primary_locale_name. Developers are expected to make all the changes to the master locale file ( en.yml by default ) and treat all the other locale.yml files as readonly files.

As tolk stores all the keys and translated strings in the database, you need to ask Tolk to update it's database from the primary yml file :

$ rake tolk:sync
```
rake tolk:sync
```

The above will fetch all the new keys from en.yml and put them in the database. Additionally, it'll also get rid of the deleted keys from the database and reflect updated translations - if any.

If you already have data in your non primary locale files, you will need to import those to Tolk as a one time thing :

$ rake tolk:import
```
rake tolk:import
```

Upon visiting http://your_app.com/tolk - you will be presented with different options like creating new locale or providing translations for the existing locales. Once done with translating all the pending strings, you are can write back the new locales to filesystem :
Upon visiting http://localhost:3000/tolk - you will be presented with different options like creating new locale or providing translations for the existing locales. Once done with translating all the pending strings, you are can write back the new locales to filesystem :

$ rake tolk:dump_all
```
rake tolk:dump_all
```

This will generate yml files for all non primary locales and put them in #{Rails.root}/config/locales/ directory by default.

You can use the dump_all method defined in Tolk::Locale directly and pass directory path as the argument if you want the generated files to be at a different location :

$ script/runner "Tolk::Locale.dump_all('/Users/lifo')"
```
script/runner "Tolk::Locale.dump_all('/Users/lifo')"
```

You can even download the yml file using Tolk web interface by appending '.yml' to the locale url. E.g http://your_app.com/tolk/locales/de.yml

Expand Down

0 comments on commit d826387

Please sign in to comment.