A sample application that demonstrates usage of two i18n-related plugins:
-
i18n_db - a Rails-2.2+ internationalization backend driven by sql and memcached.
-
simple_loc_compat - a set of i18n helper methods that mimic those of the excellent Simple Localization plugin which stopped its development in October 2008.
In addition, this sample app contains a convenient ajaxified translations editor and a simple locale list editor.
After checking out, do not forget to run:
git submodule init git submodule update
so that the plugin directories get populated.
There is an SQL file with the sample translations content in the project dir. Create the db and load it, e.g.:
rake db:create mysql i18n_db_admin_development < i18n_sample.sql
Start the application and check out the following local pages (assuming that you aliased i18n_db_admin.local with localhost for this app):
- i18n_db_admin.local/locales
-
translator homepage
- i18n_db_admin.local
-
compare with the view template in app/views/pages/index.html.erb
- i18n_db_admin.local/1/translations
-
main locale editor
- i18n_db_admin.local/2/translations
-
translation editor
- i18n_db_admin.local/admin/locales
-
locales list for the admin
Now create another alias, so that fr.i18n_db_admin.local points to the same IP address. Visit the application at fr.i18n_db_admin.local and see the translations in action.
Run memcached and try the application in production mode - you will see that pretty much everything will be cached. After editing the translations, click the relevant “Reload cache” link at the locales page to make your changes visible to visitors.