Permalink
Browse files

Tolk rake tasks

  • Loading branch information...
1 parent e44048d commit ebd233c6aeccc5fb903b5059e3e4bfe80f6518aa @lifo lifo committed Apr 8, 2010
Showing with 16 additions and 3 deletions.
  1. +5 −3 README
  2. +11 −0 tasks/tolk_tasks.rake
View
8 README
@@ -30,15 +30,17 @@ Tolk treats <tt>Tolk::Locale.primary_locale_name</tt> as the main source of stri
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 :
- $ script/runner 'Tolk::Locale.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.
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 :
- $ script/runner 'Tolk::Locale.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 pass directory path as the argument if you want the generated files to be at a different location :
+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')"
View
@@ -0,0 +1,11 @@
+namespace :tolk do
+ desc "Sync Tolk with the default locale's yml file"
+ task :sync => :environment do
+ Tolk::Locale.sync!
+ end
+
+ desc "Generate yml files for all the locales defined in Tolk"
+ task :dump_all => :environment do
+ Tolk::Locale.dump_all
+ end
+end

0 comments on commit ebd233c

Please sign in to comment.