1
+ ClickToGlobalize
2
+ =================
3
+
4
+ ClickToGlobalize is an extension for Globalize plugin, it allows to edit in
5
+ place globalized labels. With this plugin you don't have to create a
6
+ globalization back-end, but just edit your interface in place!!
7
+
8
+ If you have a previous globalization experience, you probably noticed that the
9
+ main problem of dedicated back-ends is the lack of the context where the
10
+ string will be placed in. It isn't a trivial issue: you'll never know if the
11
+ meaning of your string is harmonious with other labels and how your string will
12
+ be rendered, until the page load.
13
+
14
+ Now you can forget this issues, you can directly globalize in place!!
15
+
16
+ Check for news and tutorials at the project home page[http://www.lucaguidi.com/pages/click-to-globalize].
17
+
18
+ Getting Started
19
+ ===============
20
+
21
+ 1. Install Globalize[http://www.globalize-rails.org/].
22
+
23
+ 2. Install Click To Globalize:
24
+ $ ./scripts/plugin install http://dev.23labs.net/svn/rails/plugins/click_to_globalize/trunk
25
+
26
+ 3. Add at the end of your layout the following code:
27
+ <%= click_to_globalize -%>
28
+
29
+ 4. Put in your view:
30
+ <%= 'hello_world'.t %>
31
+
32
+ 5. Start your server and click to globalize.
33
+
34
+ Prerequisites
35
+ =============
36
+
37
+ * Globalize plugin: www.globalize-rails.org.
38
+
39
+ * RedCloth gem (optional) for textile formatting.
40
+
41
+ * BlueCloth gem (optional) for markdown formatting.
42
+
43
+ Install
44
+ =======
45
+
46
+ 1. Install Globalize, if you don't already done.
47
+
48
+ 2. Install Click To Globalize:
49
+ Rails 2.0
50
+ $ ./scripts/plugin install http://dev.23labs.net/svn/rails/plugins/click_to_globalize/trunk
51
+ Rails 1.2.x
52
+ $ ./scripts/plugin install http://dev.23labs.net/svn/rails/plugins/click_to_globalize/branches/for-1.2.x
53
+
54
+ 3. Run the setup task:
55
+ $ rake click:setup
56
+
57
+ 4. Run the tests (optional):
58
+ $ rake click:test
59
+
60
+ 5. Choose your languages, they will be used to create a picker menu.
61
+ class ApplicationController < ActionController::Base
62
+ self.languages = { :english => 'en-US', :italian => 'it-IT' }
63
+ end
64
+
65
+ 6. If you like to use wiki-formatting styles, you could use textile (RedCloth)
66
+ or markdown (BlueCloth).
67
+ class ApplicationController < ActionController::Base
68
+ self.formatting :textile
69
+ end
70
+
71
+ 7. Personalize the access to the globalization features, overriding #globalize:
72
+ class ApplicationController < ActionController::Base
73
+ def globalize?
74
+ current_user.admin?
75
+ end
76
+ end
77
+
78
+ NOTE: #globalize? is method to turn on/off all the Click to Globalize features.
79
+ NOTE: self.globalize? has been deprecated in favor of globalize?.
80
+
81
+ 8. Add at the end of your layout the following code:
82
+ <%= click_to_globalize -%>
83
+
84
+ Uninstall
85
+ =========
86
+
87
+ 1. $ ./script/plugin remove click_to_globalize
88
+
89
+ Features
90
+ ========
91
+
92
+ * In place editing for each globalized string.
93
+
94
+ * Easy and painless plug-in/plug-out process.
95
+
96
+ * Unobtrusive Javascripts.
97
+
98
+ * Textile and Markdown support.
99
+
100
+ * Auto transformation from input text to textarea for long strings.
101
+
102
+ Common Issues
103
+ =============
104
+
105
+ * Since the Globalize plugin creates folders like 'for-1.2', be sure to rename
106
+ the folder to 'globalize'.
107
+
108
+ * Due to unobtrusive nature of the plugin, each page is parsed by javascript
109
+ to find the right element and bind to it an Ajax.InPlaceEditor.
110
+ Be sure your (X)HTML is wellformed.
111
+
112
+ NOTE: If you use the Rails scaffold system, Click To Globalize
113
+ doesn't works. Cleanup the code before to use.
114
+
115
+ * If you use a wiki-formatting style it could be advisable to use #h to avoid
116
+ security problems (i.e. XSS).
117
+ <%= textilize(h('some_text'.t)) %>
118
+
119
+ Contribute
120
+ ==========
121
+
122
+ * Check out the code and test it:
123
+ $ svn co http://dev.23labs.net/svn/rails/plugins/click_to_globalize/trunk
124
+ $ rake click:test
125
+
126
+ * Create a ticket to: http://dev.23labs.net/rails/trac.cgi
127
+
128
+ * Create a patch and add as attachement to the ticket.
129
+
130
+ Credits
131
+ =======
132
+
133
+ Javascript tests are based on Prototype[http://prototypejs.org] test libs.
134
+
135
+
136
+
137
+ Copyright (c) 2007-2008 Luca Guidi - http://23labs.net, released under the MIT license
0 commit comments