Rails i18n locale editor
Proof of concept of live locale editor for Ruby on Rails
Features
- edit translations in-place in overlay window right on your live site
- cool firebug-like translation key selector for localized strings
- ajax lazy updating for better user experience
- taranslations listing (index)
- select which locales to show in translations index
- show only keys with missing translations
- unobtrusive JS inclusion - if jQuery is not included in project and async autoloads it from CDN as noConflict(), then loads itself
- tested in Firefox and Chromium
- tested on rails 2.3.8, 2.3.2 with bundler see: http://gembundler.com/rails23.html
- not designed as production CMS, it's for developers
Installation
add to your Gemfile:
gem "i18n_locale_editor"
run:
bundle install
add to your layout's
section:=include_i18n_editor
start server with environment variable:
I18N_EDITOR=true script/server
TODO
- tests
- code review and documentation
- rails 3 support
- test it on real-life translator's workflow to save clicks and improve efficiency (maybe add 'commit and next' to editor)
- auto copy js asset and include by gem version in init.rb
- when open in editor is requested, add locale from key to be shown on index if it is not set in session yet
- when open in editor is requeseed and "show only missing" is enabled, check if the requested key is in the result set, if not cancel the fileter and retry
- it will copy javascript assets to RAILS_ROOT/public/i18n_locale_editor on every init, find some better and unobtrusive way
- raise if not vaild html accepted as transalation
- show key name in modal window
- move all javascript functions to i18n namespace to prevent colision
- make hash_tools as inherited class ExtendedHash from Hash (eradicate monkey patching)
- extract translation controller name, model name, routing nammespace to some config and make it dynamic
- ESC to close modal window
- possibility to load another translations in modal
- toggle wym editor in modal (cool)
- change localization key from id to rel in span I18n monkey patch
- git, subversion support for tracking changes
- escape path for eval in hash_tools.rb (!!!)
- translation workflow design
- translation key is held in span id="en.translation.key". check if the 'id' attribute can contain dots
- title, buttons, select options are broken - filter them out
- create tools for refactoring - especially path rename
- paginantion on index
- list missing translations
- api for external access
- scopes support for api (how)
- export all locales to csv (it's done, but not included in this gem)
- import all locales from csv (it's done, but not included in this gem)
- key hitcounter
- test in Opera, IE and other browsers...
- review these issues and move them to the github's task tracker :)
Copyright
Copyright (c) 2011 Adam Kliment, Virtualmater s.r.o. See LICENSE for details.