This is to add collaborative language translation functionality to your site! If you use several languages, you can ask your users to help you to translate your web application into other languages. This service helps you to manage the process. Read more and see screenshots at this blog.
It works with Rails 2.3.9 and above. Was not tested with Rails 3.0
You have to copy files from this project into your application. All the manual changes are described below.
Add migration files from db/migrate to db/migrate in your project. Change the migration number to the newest version for your rails project and run it.
- create_translations.rb
- init_translations.rb - change this file to add admins (important!) and reviewers for your site
Implement (if not done) the next two functions in translation_controller.rb
before_filter :login_required
before_filter :guest_not_allowed, :except => [:list,:search]
- You have to have User model that manages people
- Add content of misc/to_user.rb into user.rb
Add new routes from misc/to_routes.rb
- Install gem will_paginate
- Add require "will_paginate" into config/environment.rb
-
Change default owner for language strings in file libhelp/translation/update_db.rb look for line "submitter_id = 4". Change id to your admin id.
-
$ script/translation/update_db - will create db entries based on lang_server.yml
-
On the server deploy script manage(deploy/production.rb) will do all this. See as well file script/translation/ondeploy
After your rails project is started, you should find translation service at http://yoursite/translation.
See further two sections on tuning up the things.
You can specify languages that your site uses in language.rb function self.get_website_languages.
These languages are used for language files generation. If your site uses german, english and french for example, you should specify only those languages.
You have to get the key from google translate and change line
key = "yourkey"
in google_translate.rb file, if you plan to use auto translation for language strings.
Replace everywhere string "Yoursite"/"yoursite" with actual site name/domain name you are using.
Not necessary but might be useful
Add new email sending function from misc/to_user_notifier.rb into user_notifier.rb
If you want to add deploy scripts to populate translation databases and generate language files, a (config/deploy/production.rb) misc/to_deploy_production.rb. See libhelp/readme.md for details.
All language files for english are saved in config/locales/templates/lang_server.yml. This file is used to generate entries in database translation table. Once string are translated into different languages, this file is used to generate language yml files. File lang_client.yml is used to generate javascript files for the client. See libhelp/translation/generate_js.rb for details.
MIT
Copyright (C) 2011 by Evgeny Bogdanov
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.