dylanz/i18n_backend_database — pull request #15 by spemmons (2012-09-26 13:25:40+00:00)
Title: combined features and fixes currently in use by numerex for several production apps

i really like this gem and have pushed my company to use it for several apps, especially when needing to go to outside translation firms to get the localization work done. the GUI is particularly useful for this process, but also the rake tasks have been enhanced to deal with practical scenarios we encounter...

some of the earlier changes included in the history were done by a spanish-speaking contractor we used, but more recently, i've done most of the changes...

FIXES
* various changes to work with rails 3.0, mostly pulled from other contributors...
* localize ("l" method) format was being modified with gsub and might be a frozen constant -- made a dup before processing...
* explicitly use I18n::Backend::Locale model in places where simply using Locale was getting confused...
* direct English "keys" with trailing periods were sometimes getting confused with locale-file keys if the English was a single word like "Tracking..." -- also ensure that matching is case sensitive...

FEATURES
* when loading locale files from gems, it is possible that the app may want to override them, so we the gem files first, followed by the app files...
* improved the finding of direct English text in code that allows avoiding the use of /locales/en.yml for most app-level translations -- this is the really beauty of this gem IMHO...
* generally beefed up the rake tasks to include a full "reset_locales_and_translations" process that will load gem-based locale files, search for direct English in the app, and prepare other locales for translation in the GUI
* added a TranslationSource model with a "belongs_to" relationship to Translation that helps establish where a translation came from: locale file, source file, etc. -- useful for diagnostics
* import/export/backup of translations into /config/translations/XX.yml for each locale in the DB; helps with migrating translations from a test/dev server where the GUI is allowed to run to a production server where it is not...
* added rails engine to server public assets used by GUI
* route to GUI is not published when Rails.env.production? is true
* generally improved GUI for usability and provide graphical feedback regarding % completion
* added export to CSV to GUI -- no import from CSV yet... needed?

KNOWN ISSUES:
* i have had a goal (not yet achieved) of using travis CI to run the tests. i'm not really an rspec guy, so i've struggled getting the tests running successfully. they do not seem to have been kept up-to-date and they need more work... and better coverage. i hope to address that soon...
* the standard i18n handling of "default" values is not quite right, but this was true before...
* asset translation doesn't work... did it ever? we don't use it, so haven't invested time in this...

cheers! -SE-