Giter VIP home page Giter VIP logo

i18n_locale_editor's Introduction

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, editor loads it asynchronously from CDN as noConflict(), then loads itself

  • tested in Firefox and Chromium

  • tested on rails 2.3.8, 2.3.2 with bundler see: gembundler.com/rails23.html

  • not designed as production CMS, it’s for developers and translators

Installation

add to your Gemfile:

gem "i18n_locale_editor"

run:

bundle install

add to your layout’s <HEAD> section:

=include_i18n_editor

start server with environment variable:

I18N_EDITOR=true script/server

Use

  • toggle selector by clicking on button in bottom right corner

  • click on some translation and edit translation directly in your site

  • navigate to /translations to see all translations in editor

TODO

  • tests

  • code review and documentation

  • rails 3 support

  • start using jQuery temlates, it’s cool api.jquery.com/category/plugins/templates/

  • test it on real-life translator’s workflow to save clicks and improve efficiency (maybe add ‘commit and next’ to editor)

  • toggle each translations in modal window

  • 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

  • make saving back to yaml atomic (save to /tmp and move)

  • 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

  • <strike>escape path for eval in hash_tools.rb (!!!)</strike>

  • 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 © 2011 Adam Kliment, Virtualmater s.r.o. See LICENSE for details.

i18n_locale_editor's People

Stargazers

Marcin Nowicki avatar Bank Lee avatar Angus H. avatar Denis Evgrafov avatar Emiliano Ticci avatar Adam Kliment avatar  avatar Eric Skogen avatar Akira Matsuda avatar Ivan Nemytchenko avatar

Watchers

James Cloos avatar

Forkers

banklee

i18n_locale_editor's Issues

undefined local variable or method `directory'

/usr/lib/ruby/gems/1.8/gems/i18n_locale_editor-0.0.1/lib/i18n_locale_editor.rb:12: undefined local variable or method directory' for main:Object (NameError) from /usr/lib/ruby/gems/1.8/gems/i18n_locale_editor-0.0.1/lib/i18n_locale_editor.rb:11:ineach'
from /usr/lib/ruby/gems/1.8/gems/i18n_locale_editor-0.0.1/lib/i18n_locale_editor.rb:11
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in require' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:innew_constants_in'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in require' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/rails/gem_dependency.rb:215:inload'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:307:in load_gems' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:307:ineach'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:307:in load_gems' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:164:inprocess'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in send' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:inrun'
from /home/netmilk/projects/i18n_test/config/environment.rb:9
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/commands/generate.rb:1
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire'
from script/generate:3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.