Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 34 lines (18 sloc) 1.689 kb
ccdc033 @lifo Basic README
lifo authored
1 Tolk is a Rails engine designed to facilitate the translators doing the dirty work of translating your application to other languages.
be0c96e @dhh First init
authored
2
ccdc033 @lifo Basic README
lifo authored
3 * Installation & Setup
be0c96e @dhh First init
authored
4
ccdc033 @lifo Basic README
lifo authored
5 To install :
be0c96e @dhh First init
authored
6
ccdc033 @lifo Basic README
lifo authored
7 $ script/plugin install git://github.com/dhh/tolk.git
be0c96e @dhh First init
authored
8
ccdc033 @lifo Basic README
lifo authored
9 To setup :
be0c96e @dhh First init
authored
10
ccdc033 @lifo Basic README
lifo authored
11 1) Define the primary locale inside your application's configuration file :
be0c96e @dhh First init
authored
12
ccdc033 @lifo Basic README
lifo authored
13 # environment.rb
14 Locale.primary_locale_name = 'en'
be0c96e @dhh First init
authored
15
ccdc033 @lifo Basic README
lifo authored
16 2) Generate a new migration and copy relevant parts of tolk/db/schema.rb to self.up() and migrate
be0c96e @dhh First init
authored
17
ccdc033 @lifo Basic README
lifo authored
18 * Usage
be0c96e @dhh First init
authored
19
ccdc033 @lifo Basic README
lifo authored
20 Tolk treats <tt>Locale.primary_locale_name</tt> as the main source of strings to be translated. Developers are expected to make all the changes to that file ( en.yml in our case ) and treat all the other locale.yml files as readonly files.
be0c96e @dhh First init
authored
21
ccdc033 @lifo Basic README
lifo authored
22 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 :
be0c96e @dhh First init
authored
23
6b8bd68 @lifo More README
lifo authored
24 $ script/runner 'Locale.sync!'
ccdc033 @lifo Basic README
lifo authored
25
26 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.
be0c96e @dhh First init
authored
27
ccdc033 @lifo Basic README
lifo authored
28 Upon visiting http://<your app>/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 :
be0c96e @dhh First init
authored
29
6b8bd68 @lifo More README
lifo authored
30 $ script/runner 'Locale.dump_all'
be0c96e @dhh First init
authored
31
6b8bd68 @lifo More README
lifo authored
32 This will generate yml files for all non primary locales and put them in RAILS_ROOT/config/locales/ directory by default. You can pass directory path as the argument if you want the generated files to be at a different location :
33
34 $ script/runner "Locale.dump_all('/Users/lifo')"
Something went wrong with that request. Please try again.