|
| 1 | +Click to Globalize |
| 2 | +================== |
| 3 | + |
| 4 | +Click to Globalize is a Rails plugin, it allows to edit *in place* i18n labels. |
| 5 | + |
| 6 | +If you have a previous i18n experience, you probably noticed that the |
| 7 | +main problem of dedicated back-ends is the lack of the context where the |
| 8 | +string will be placed in. It isn't a trivial issue: you'll never know if the |
| 9 | +meaning of your string is harmonious with other labels and how your string will |
| 10 | +be rendered, until the page load. |
| 11 | + |
| 12 | +Now you can forget this issues, you can directly translate in place!! |
| 13 | + |
| 14 | +Check for news and tutorials at the "project home page":http://www.lucaguidi.com/projects/click-to-globalize. |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +Getting Started |
| 19 | +=============== |
| 20 | + |
| 21 | +#Install Click to Globalize: |
| 22 | + @$ ./script/plugin install git://github.com/jodosha/click-to-globalize.git@ |
| 23 | + @rake click:setup@ |
| 24 | +#Add at the end of your layout the following code: |
| 25 | + <%= click_to_globalize -%> |
| 26 | +#Put in your view: |
| 27 | + @<%= t(:'hello_world') %>@ |
| 28 | +#Start your server and click to globalize. |
| 29 | + |
| 30 | + |
| 31 | +Prerequisites |
| 32 | +============= |
| 33 | + |
| 34 | +Click to Globalize is *framework agnostic*, it can talks with *all* the Rails |
| 35 | +plugins who speak the "i18n API":http://rails-i18n.org, but please make sure |
| 36 | +to use a *persistent* backend. |
| 37 | +In fact, the default i18n backend *shipped with Rails*, rely on YAML files, this |
| 38 | +means it doesn't allow runtime translations modifications. |
| 39 | + |
| 40 | +For this purpose, feel free to use my experimental "*globalize2* fork":http://github.com/jodosha/globalize2 |
| 41 | + |
| 42 | + |
| 43 | +Features |
| 44 | +======== |
| 45 | + |
| 46 | +#In place editing for each i18n string. |
| 47 | +#Easy and painless plug-in/plug-out process. |
| 48 | +#Unobtrusive Javascripts. |
| 49 | +#Auto transformation from input text to textarea for long strings. |
| 50 | + |
| 51 | + |
| 52 | +Advanced Features |
| 53 | +================= |
| 54 | +You may wish to restrict the access to Click to Globalize features, if you don't |
| 55 | +everyone can edit your pages. |
| 56 | +All you need to do is override the @in_place_translations?@ method. |
| 57 | + |
| 58 | + class ApplicationController < ActionController::Base |
| 59 | + def in_place_translations? |
| 60 | + current_user.admin? |
| 61 | + end |
| 62 | + end |
| 63 | + |
| 64 | +*NOTE:* The old @globalize?@ method has been deprecated. |
| 65 | + |
| 66 | + |
| 67 | +Uninstall |
| 68 | +========= |
| 69 | + |
| 70 | +@script/plugin remove click-to-globalize@ |
| 71 | + |
| 72 | + |
| 73 | +Old Rails applications |
| 74 | +====================== |
| 75 | + |
| 76 | +The current version of Click to Globalize targets Rails 2.3.x applications. |
| 77 | +If your application uses former version, please check the following branches: |
| 78 | +# "for-2.0":http://github.com/jodosha/click-to-globalize/tree/for-2.0 |
| 79 | +# "for-2.1":http://github.com/jodosha/click-to-globalize/tree/for-2.1 |
| 80 | + |
| 81 | + |
| 82 | +Common Issues |
| 83 | +============= |
| 84 | + |
| 85 | +#Due to unobtrusive nature of the plugin, each page is parsed by javascript |
| 86 | +to find the right element and bind to it an Ajax.InPlaceEditor. |
| 87 | +Be sure your (X)HTML is *wellformed*. |
| 88 | + |
| 89 | +NOTE: If you use the Rails scaffold system, Click to Globalize |
| 90 | +doesn't works. Cleanup the code before to use. |
| 91 | + |
| 92 | += Contribute |
| 93 | + |
| 94 | +* Check out the code and test it: |
| 95 | + $ git clone git://github.com/jodosha/click-to-globalize.git |
| 96 | + $ rake click |
| 97 | + |
| 98 | +* Create a ticket to the "Sushistar Lighthouse page":http://sushistar.lighthouseapp.com |
| 99 | + |
| 100 | +* Create a patch and add as attachment to the ticket. |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | += Credits |
| 105 | + |
| 106 | +Javascript tests are based on Prototype[http://prototypejs.org] test libs. |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | +Copyright (c) 2007-2009 Luca Guidi - http://lucaguidi.com, released under the MIT license |
0 commit comments