localized_scaffold 0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +6 -0
- data/README.rdoc +273 -0
- data/generators/locales/standard.de-FO.yml +106 -0
- data/generators/locales/standard.de.yml +106 -0
- data/generators/locales/standard.en.yml +106 -0
- data/generators/localized_devise_views_generator.rb +100 -0
- data/generators/localized_scaffold_generator.rb +624 -0
- data/generators/templates/devise/locales/devise.de-FO.yml +45 -0
- data/generators/templates/devise/locales/devise.de.yml +60 -0
- data/generators/templates/devise/locales/devise_views.de.yml +78 -0
- data/generators/templates/devise/locales/devise_views.en.yml +79 -0
- data/generators/templates/devise/views/confirmations/new.html.erb +23 -0
- data/generators/templates/devise/views/mailer/confirmation_instructions.html.erb +6 -0
- data/generators/templates/devise/views/mailer/reset_password_instructions.html.erb +8 -0
- data/generators/templates/devise/views/mailer/unlock_instructions.html.erb +6 -0
- data/generators/templates/devise/views/passwords/edit.html.erb +30 -0
- data/generators/templates/devise/views/passwords/new.html.erb +23 -0
- data/generators/templates/devise/views/registrations/edit.html.erb +54 -0
- data/generators/templates/devise/views/registrations/new.html.erb +34 -0
- data/generators/templates/devise/views/sessions/new.html.erb +32 -0
- data/generators/templates/devise/views/shared/_links.erb +25 -0
- data/generators/templates/devise/views/unlocks/new.html.erb +23 -0
- data/generators/templates/erb/scaffold/_form.html.erb +11 -0
- data/generators/templates/erb/scaffold/_index.html.erb +54 -0
- data/generators/templates/erb/scaffold/edit.html.erb +20 -0
- data/generators/templates/erb/scaffold/index.html.erb +73 -0
- data/generators/templates/erb/scaffold/layout.html.erb +51 -0
- data/generators/templates/erb/scaffold/new.html.erb +18 -0
- data/generators/templates/erb/scaffold/scaffold_generator.rb +57 -0
- data/generators/templates/erb/scaffold/show.html.erb +22 -0
- data/generators/templates/locales/de.yml +61 -0
- data/generators/templates/locales/en.yml +61 -0
- data/generators/templates/rails/helper/helper.rb +118 -0
- data/generators/templates/rails/helper/scaffold_helper.rb +53 -0
- data/generators/templates/rails/scaffold_controller/controller.rb +338 -0
- data/generators/templates/rails/stylesheets/templates/scaffold.css +203 -0
- data/generators/templates/test_unit/scaffold/templates/functional_test.rb +117 -0
- data/init.rb +3 -0
- data/install.rb +1 -0
- data/lib/tasks/localized_scaffold.rake +39 -0
- data/localized_scaffold.rb +7 -0
- data/rails/init.rb +3 -0
- data/test/localized_scaffold_test.rb +8 -0
- data/test/test_helper.rb +3 -0
- data/uninstall.rb +1 -0
- metadata +120 -0
data/Gemfile
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,273 @@
|
|
1
|
+
= Localized Scaffold
|
2
|
+
|
3
|
+
== About
|
4
|
+
|
5
|
+
The "localized_scaffold" gem provides a Rails 3 generator for scaffolding
|
6
|
+
with the same parameters as the orginal scaffold generator (it actually
|
7
|
+
overwrites the original code) but producing localized views and localized
|
8
|
+
controller flashes. It also generates a nicer user interface (for example with
|
9
|
+
a title helper instead of generating h2) and produces a controller with some
|
10
|
+
comments which also supports JSON. Localized Rails scaffolding with style...
|
11
|
+
|
12
|
+
Just give it a try and toss it away if you don't like it -- it's pretty easy
|
13
|
+
to have a test drive (see sample below).
|
14
|
+
|
15
|
+
Rails 2: There is a Rails 2 compatible version which has to be installed as
|
16
|
+
a Rails plugin instead of a gem. The latest Rails 2 version can be installed
|
17
|
+
from branch "rails2".
|
18
|
+
|
19
|
+
== Installation and usage
|
20
|
+
|
21
|
+
Here are the steps to get a first impression about the generator:
|
22
|
+
|
23
|
+
rails foo
|
24
|
+
cd foo
|
25
|
+
|
26
|
+
Edit the Gemfile to include "localized_scaffold" and optionally install the
|
27
|
+
"will_paginate" gem to automatically add pagination using this library and to
|
28
|
+
have everything around for authentication (see more on devise localization
|
29
|
+
below):
|
30
|
+
|
31
|
+
vi Gemfile
|
32
|
+
gem 'localized_scaffold'
|
33
|
+
gem 'will_paginate', '>= 3.0.pre'
|
34
|
+
|
35
|
+
bundle install
|
36
|
+
|
37
|
+
The generated code uses "form.error_messages" which was moved to a separate
|
38
|
+
plugin in Rails 3 for some reason. Install the plugin or implement the method
|
39
|
+
with your own code t osee error messages:
|
40
|
+
|
41
|
+
rails plugin install git://github.com/rails/dynamic_form.git
|
42
|
+
|
43
|
+
A standard set of localization files will be installed in "config/locales" and
|
44
|
+
a set of locale files is generated per scaffold. This setup has to be
|
45
|
+
configured in the i18n configuration:
|
46
|
+
|
47
|
+
rake localized_scaffold:configure
|
48
|
+
|
49
|
+
If you don't like a rake task to mess around with your application file, edit
|
50
|
+
"config/application.rb") manually and add the following lines to the Rails
|
51
|
+
initializer (only the two config lines...):
|
52
|
+
|
53
|
+
Rails::Initializer.run do |config|
|
54
|
+
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '*.{rb,yml}')]
|
55
|
+
config.i18n.default_locale = :en
|
56
|
+
end
|
57
|
+
|
58
|
+
Add more locale files by downloading them from a repository set up
|
59
|
+
by Sven Fuchs at github (git://github.com/svenfuchs/rails-i18n.git) to
|
60
|
+
"config/locales":
|
61
|
+
|
62
|
+
rake localized_scaffold:download_locales
|
63
|
+
|
64
|
+
Have a look at the options supported by the generator:
|
65
|
+
|
66
|
+
rails generate localized_scaffold
|
67
|
+
|
68
|
+
As a first test, just add a sample scaffold:
|
69
|
+
|
70
|
+
rails generate localized_scaffold bar name:string seats:integer
|
71
|
+
rake db:migrate
|
72
|
+
|
73
|
+
rails server
|
74
|
+
|
75
|
+
Now open your browser and visit "http://localhost:3000/bars" to test the
|
76
|
+
application and finally have a look at the localization files generated in
|
77
|
+
"config/locales".
|
78
|
+
|
79
|
+
And please contribute by sending in your localized versions of the default
|
80
|
+
and standard locale files. :-)
|
81
|
+
|
82
|
+
== One more thing...
|
83
|
+
|
84
|
+
I couldn't resist to add a few small but powerful additions I need so often:
|
85
|
+
Feel free to use or ignore them.
|
86
|
+
|
87
|
+
=== Method to_s()
|
88
|
+
|
89
|
+
Models should return something meaningful when to_s is called on their
|
90
|
+
objects and optional option <code>--str</code> is used to do so. The to_s
|
91
|
+
method of the model is generated to return the provided field (therefor the
|
92
|
+
name of the option) and its fallback is the value of the searchbar option
|
93
|
+
(see below) or the first attribute if that is missing as well. You can
|
94
|
+
always modify the implementation of the method afterwards.
|
95
|
+
|
96
|
+
Sample using "about" instead of default first attribute "name":
|
97
|
+
|
98
|
+
rails generate localized_scaffold company name:string about:text --str about
|
99
|
+
|
100
|
+
=== Belongs to something
|
101
|
+
|
102
|
+
There is an <code>--belongsto</code> option which can be used to generate
|
103
|
+
model, controller and views for a "parent" belongs_to relationship like
|
104
|
+
companies having many addresses or phone numbers.
|
105
|
+
|
106
|
+
Here is a sample for exactly that:
|
107
|
+
|
108
|
+
rails generate localized_scaffold company name:string about:text
|
109
|
+
|
110
|
+
rails generate localized_scaffold address company_id:integer what:string \
|
111
|
+
street:string zip:string town:string state:string country:string \
|
112
|
+
--belongsto company --str town
|
113
|
+
|
114
|
+
rails generate localized_scaffold email company_id:integer kind:string \
|
115
|
+
address:string --belongsto company --str address
|
116
|
+
|
117
|
+
There is only little linking between the interfaces and you should double
|
118
|
+
check your routes, but after creating a new company at "/companies/new", you
|
119
|
+
will be able to see all its addresses and add new ones at
|
120
|
+
"/companies/1/addresses". Same for e-mail-addresses at "/companies/1/emails".
|
121
|
+
|
122
|
+
=== Searchbar
|
123
|
+
|
124
|
+
When there are lots of records, it makes sense to have an A B C picker and it
|
125
|
+
would be nice to offer a simple search form for fast access to known objects.
|
126
|
+
That's what the new <code>--searchbar</code> option does. It supports the
|
127
|
+
<code>--belongsto</code> option but is also useful without.
|
128
|
+
|
129
|
+
Here again a sample:
|
130
|
+
|
131
|
+
rails generate localized_scaffold company name:string about:text \
|
132
|
+
--searchbar name
|
133
|
+
|
134
|
+
=== No show...
|
135
|
+
|
136
|
+
Often the show view is not needed as the index view already displays all of
|
137
|
+
its data. Just add this option to suppress its generation. The show action is
|
138
|
+
still generated to support the XML and JSON format but for HTML the user will
|
139
|
+
be redirected to the index page.
|
140
|
+
|
141
|
+
Here is a sample:
|
142
|
+
|
143
|
+
rails generate localized_scaffold company name:string about:text --noshow
|
144
|
+
|
145
|
+
=== Embedding in parent
|
146
|
+
|
147
|
+
When having a belongs_to relationship, it might be nicer to not only link to
|
148
|
+
that data from the show view of the "parent" but to actually embed a couple
|
149
|
+
of items and use the index view only if more than a certain amount of items
|
150
|
+
is available. That's what the <code>--embed</code> option is for:
|
151
|
+
|
152
|
+
rails generate localized_scaffold email company_id:integer what:string \
|
153
|
+
address:string --belongsto company --str address --embed 4
|
154
|
+
|
155
|
+
=== Listify field values
|
156
|
+
|
157
|
+
Some fields only allow a certain set of values and these values have to be
|
158
|
+
localized as well. The listify option implements such a mechanism by creating
|
159
|
+
a set of methods in the model and preparing the localization files. Sample:
|
160
|
+
"salutation:mr,mrs,none kind:office,private,mobile,other"
|
161
|
+
|
162
|
+
And a sample:
|
163
|
+
|
164
|
+
rails generate localized_scaffold email company_id:integer kind:string \
|
165
|
+
address:string --belongsto company --str address \
|
166
|
+
--listify "kind:office,private,other"
|
167
|
+
|
168
|
+
There is still enough to do till you have a nice app and this is still
|
169
|
+
scaffolding and nothing more, but these additional options should save some
|
170
|
+
annoying work...
|
171
|
+
|
172
|
+
== Demo
|
173
|
+
|
174
|
+
As a wrap up, here is a complete sample of a simple phone book only using
|
175
|
+
scaffolding:
|
176
|
+
|
177
|
+
rails phonebook
|
178
|
+
cd phonebook
|
179
|
+
|
180
|
+
vi Gemfile
|
181
|
+
gem 'localized_scaffold'
|
182
|
+
gem 'will_paginate', '>= 3.0.pre'
|
183
|
+
|
184
|
+
bundle install
|
185
|
+
|
186
|
+
rake localized_scaffold:download_locales
|
187
|
+
rake localized_scaffold:configure
|
188
|
+
|
189
|
+
rails plugin install git://github.com/rails/dynamic_form.git
|
190
|
+
|
191
|
+
vi config/application.rb
|
192
|
+
config.i18n.default_locale = :de # For example
|
193
|
+
|
194
|
+
rails generate localized_scaffold person salutation:string firstname:string \
|
195
|
+
lastname:string --searchbar lastname --listify "salutation:mr,mrs,none"
|
196
|
+
|
197
|
+
rails generate localized_scaffold phone person_id:integer kind:string \
|
198
|
+
number:string --belongsto person \
|
199
|
+
--listify "kind:office,private,mobile,fax,other" \
|
200
|
+
--str number --embed 5 --noshow
|
201
|
+
|
202
|
+
rails generate localized_scaffold email person_id:integer kind:string \
|
203
|
+
address:string --belongsto person --listify "kind:office,private,other" \
|
204
|
+
--str address --embed 5 --noshow
|
205
|
+
|
206
|
+
rake db:migrate
|
207
|
+
|
208
|
+
vi config/routes.rb
|
209
|
+
root :to => 'people#index'
|
210
|
+
|
211
|
+
rm public/index.html
|
212
|
+
|
213
|
+
rails server
|
214
|
+
|
215
|
+
Now open http://localhost:3000/people to test the application and finally have
|
216
|
+
a look at the localization files generated in "app/locale".
|
217
|
+
|
218
|
+
== Devise
|
219
|
+
|
220
|
+
There is an additional generator named "localized_devise_views" which does
|
221
|
+
just would you would expect: It adds its own "devise_views.en.yml" etc. files
|
222
|
+
and uses these files for localization of devise. The generated code also uses
|
223
|
+
the title helper for title and headline which integrates better with the
|
224
|
+
remaining application.
|
225
|
+
|
226
|
+
Here are the additional steps to run a localized version of devise in the
|
227
|
+
application above:
|
228
|
+
|
229
|
+
vi Gemfile
|
230
|
+
gem 'devise', '>= 1.1.rc1'
|
231
|
+
|
232
|
+
bundle install
|
233
|
+
|
234
|
+
rails generate devise_install
|
235
|
+
|
236
|
+
rails generate devise user
|
237
|
+
|
238
|
+
rails generate localized_devise_views user
|
239
|
+
|
240
|
+
rake db:migrate
|
241
|
+
|
242
|
+
vi app/controllers/application_controller.rb
|
243
|
+
before_filter :authenticate_user!, :except => [ :show, :index]
|
244
|
+
|
245
|
+
rails server
|
246
|
+
|
247
|
+
Now open http://localhost:3000/people to test the application and check that
|
248
|
+
you have to register to create a new person or edit an existing one.
|
249
|
+
|
250
|
+
== Copyright & License
|
251
|
+
|
252
|
+
Copyright (c) 2009, 2010 Jan Ulbrich
|
253
|
+
|
254
|
+
Permission is hereby granted, free of charge, to any person
|
255
|
+
obtaining a copy of this software and associated documentation
|
256
|
+
files (the "Software"), to deal in the Software without
|
257
|
+
restriction, including without limitation the rights to use,
|
258
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
259
|
+
copies of the Software, and to permit persons to whom the
|
260
|
+
Software is furnished to do so, subject to the following
|
261
|
+
conditions:
|
262
|
+
|
263
|
+
The above copyright notice and this permission notice shall be
|
264
|
+
included in all copies or substantial portions of the Software.
|
265
|
+
|
266
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
267
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
268
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
269
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
270
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
271
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
272
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
273
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# Do not edit this file: "It will be overwritten by the localized_scaffold"
|
2
|
+
# generator!"
|
3
|
+
|
4
|
+
de-FO:
|
5
|
+
standard:
|
6
|
+
language: "Deutsch"
|
7
|
+
|
8
|
+
cmds:
|
9
|
+
account: "Einstellungen"
|
10
|
+
add: "Hinzufügen"
|
11
|
+
add_above: "Oberhalb hinzufügen"
|
12
|
+
add_below: "Unterhalb hinzufügen"
|
13
|
+
add_left: "Links hinzufügen"
|
14
|
+
add_right: "Rechts hinzufügen"
|
15
|
+
all: "Alle anzeigen"
|
16
|
+
answer: "Beantworten"
|
17
|
+
back: "Zurück"
|
18
|
+
browse_back: "Zurückblättern"
|
19
|
+
browse_forward: "Vorblättern"
|
20
|
+
cancel: "Abbrechen"
|
21
|
+
change: "Ändern"
|
22
|
+
close: "Schliessen"
|
23
|
+
copy: "Kopieren"
|
24
|
+
create: "Speichern"
|
25
|
+
create_and_continue: "Speichern und weiterbearbeiten"
|
26
|
+
delete: "Löschen"
|
27
|
+
destroy: "Löschen"
|
28
|
+
display: "Anzeigen"
|
29
|
+
done: "Fertig"
|
30
|
+
download: "Laden"
|
31
|
+
edit: "Bearbeiten"
|
32
|
+
find: "Finden"
|
33
|
+
generate: "Generieren"
|
34
|
+
help: "Hilfe"
|
35
|
+
hide: "Ausblenden"
|
36
|
+
home: "Startseite"
|
37
|
+
import: "Importieren"
|
38
|
+
invite: "Einladen"
|
39
|
+
larger: "Grösser"
|
40
|
+
login: "Anmelden"
|
41
|
+
logout: "Abmelden"
|
42
|
+
modify: "Ändern"
|
43
|
+
more: "Mehr"
|
44
|
+
more_information: "Mehr Information"
|
45
|
+
new: "Neu"
|
46
|
+
next: "Weiter"
|
47
|
+
next_page: "Weiter"
|
48
|
+
ok: "OK"
|
49
|
+
open: "Öffnen"
|
50
|
+
overview: "Übersicht"
|
51
|
+
owner: "Besitzer"
|
52
|
+
preview: "Vorschau"
|
53
|
+
previous_page: "Zurück"
|
54
|
+
print: "Druckansicht"
|
55
|
+
refresh: "Aktualisieren"
|
56
|
+
register: "Registrieren"
|
57
|
+
register_continue: "Registrierung fortsetzen"
|
58
|
+
remove: "Entfernen"
|
59
|
+
reply: "Antworten"
|
60
|
+
reset: "Zurücksetzen"
|
61
|
+
save: "Speichern"
|
62
|
+
save_and_continue: "Speichern und Weiterbearbeiten"
|
63
|
+
search: "Suchen"
|
64
|
+
select: "Auswählen"
|
65
|
+
send: "Senden"
|
66
|
+
settings: "Einstellungen"
|
67
|
+
show: "Anzeigen"
|
68
|
+
smaller: "Kleiner"
|
69
|
+
style: "Darstellung"
|
70
|
+
update: "Speichern"
|
71
|
+
upload: "Hochladen"
|
72
|
+
users: "Benutzer"
|
73
|
+
|
74
|
+
errors:
|
75
|
+
cant_close_window: "Konnte dieses Fenster nicht automatisch geschlossen werden?"
|
76
|
+
login_required: "Für diese Aktion müssen Sie sich autorisieren."
|
77
|
+
no_data: "Keine passenden Daten gefunden..."
|
78
|
+
no_javascript: "Javascript benötigt"
|
79
|
+
access_denied: "Auf die angeforderte Seite haben Sie keinen Zugriff!"
|
80
|
+
|
81
|
+
in_place_edit:
|
82
|
+
cancel: "Abbrechen"
|
83
|
+
click_to_edit: "Anklicken zum Bearbeiten..."
|
84
|
+
click_tools_to_edit: "Icons anklicken um zu bearbeiten..."
|
85
|
+
loading: "Laden..."
|
86
|
+
ok: "OK"
|
87
|
+
saving: "Speichern..."
|
88
|
+
|
89
|
+
labels:
|
90
|
+
and: "und"
|
91
|
+
and_or: "und/oder"
|
92
|
+
are_you_sure: "Sind Sie sicher?"
|
93
|
+
confirmed: "bestätigt"
|
94
|
+
hits: "%s Treffer"
|
95
|
+
hours: "Stunden"
|
96
|
+
loading: "Lade Daten..."
|
97
|
+
no: "Nein"
|
98
|
+
or: "oder"
|
99
|
+
page: "Seite"
|
100
|
+
searchterm: "Suchbegriff"
|
101
|
+
unconfirmed: "unbestätigt"
|
102
|
+
yes: "Ja"
|
103
|
+
|
104
|
+
googlemap:
|
105
|
+
incompatible_browser: "Dieser Browser kann Google Maps leider nicht darstellen."
|
106
|
+
loading: "Lade Google Map..."
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# Do not edit this file: "It will be overwritten by the localized_scaffold"
|
2
|
+
# generator!"
|
3
|
+
|
4
|
+
de:
|
5
|
+
standard:
|
6
|
+
language: "Deutsch"
|
7
|
+
|
8
|
+
cmds:
|
9
|
+
account: "Einstellungen"
|
10
|
+
add: "Hinzufügen"
|
11
|
+
add_above: "Oberhalb hinzufügen"
|
12
|
+
add_below: "Unterhalb hinzufügen"
|
13
|
+
add_left: "Links hinzufügen"
|
14
|
+
add_right: "Rechts hinzufügen"
|
15
|
+
all: "Alle anzeigen"
|
16
|
+
answer: "Beantworten"
|
17
|
+
back: "Zurück"
|
18
|
+
browse_back: "Zurückblättern"
|
19
|
+
browse_forward: "Vorblättern"
|
20
|
+
cancel: "Abbrechen"
|
21
|
+
change: "Ändern"
|
22
|
+
close: "Schliessen"
|
23
|
+
copy: "Kopieren"
|
24
|
+
create: "Speichern"
|
25
|
+
create_and_continue: "Speichern und weiterbearbeiten"
|
26
|
+
delete: "Löschen"
|
27
|
+
destroy: "Löschen"
|
28
|
+
display: "Anzeigen"
|
29
|
+
done: "Fertig"
|
30
|
+
download: "Laden"
|
31
|
+
edit: "Bearbeiten"
|
32
|
+
find: "Finden"
|
33
|
+
generate: "Generieren"
|
34
|
+
help: "Hilfe"
|
35
|
+
hide: "Ausblenden"
|
36
|
+
home: "Startseite"
|
37
|
+
import: "Importieren"
|
38
|
+
invite: "Einladen"
|
39
|
+
larger: "Grösser"
|
40
|
+
login: "Anmelden"
|
41
|
+
logout: "Abmelden"
|
42
|
+
modify: "Ändern"
|
43
|
+
more: "Mehr"
|
44
|
+
more_information: "Mehr Information"
|
45
|
+
new: "Neu"
|
46
|
+
next: "Weiter"
|
47
|
+
next_page: "Weiter"
|
48
|
+
ok: "OK"
|
49
|
+
open: "Öffnen"
|
50
|
+
overview: "Übersicht"
|
51
|
+
owner: "Besitzer"
|
52
|
+
preview: "Vorschau"
|
53
|
+
previous_page: "Zurück"
|
54
|
+
print: "Druckansicht"
|
55
|
+
refresh: "Aktualisieren"
|
56
|
+
register: "Registrieren"
|
57
|
+
register_continue: "Registrierung fortsetzen"
|
58
|
+
remove: "Entfernen"
|
59
|
+
reply: "Antworten"
|
60
|
+
reset: "Zurücksetzen"
|
61
|
+
save: "Speichern"
|
62
|
+
save_and_continue: "Speichern und Weiterbearbeiten"
|
63
|
+
search: "Suchen"
|
64
|
+
select: "Auswählen"
|
65
|
+
send: "Senden"
|
66
|
+
settings: "Einstellungen"
|
67
|
+
show: "Anzeigen"
|
68
|
+
smaller: "Kleiner"
|
69
|
+
style: "Darstellung"
|
70
|
+
update: "Speichern"
|
71
|
+
upload: "Hochladen"
|
72
|
+
users: "Benutzer"
|
73
|
+
|
74
|
+
errors:
|
75
|
+
cant_close_window: "Konnte dieses Fenster nicht automatisch geschlossen werden?"
|
76
|
+
login_required: "Für diese Aktion musst Du Dich autorisieren."
|
77
|
+
no_data: "Keine passenden Daten gefunden..."
|
78
|
+
no_javascript: "Javascript benötigt"
|
79
|
+
access_denied: "Auf die angeforderte Seite hast Du keinen Zugriff!"
|
80
|
+
|
81
|
+
in_place_edit:
|
82
|
+
cancel: "Abbrechen"
|
83
|
+
click_to_edit: "Anklicken zum Bearbeiten..."
|
84
|
+
click_tools_to_edit: "Icons anklicken um zu bearbeiten..."
|
85
|
+
loading: "Laden..."
|
86
|
+
ok: "OK"
|
87
|
+
saving: "Speichern..."
|
88
|
+
|
89
|
+
labels:
|
90
|
+
and: "und"
|
91
|
+
and_or: "und/oder"
|
92
|
+
are_you_sure: "Bist Du sicher?"
|
93
|
+
confirmed: "bestätigt"
|
94
|
+
hits: "%s Treffer"
|
95
|
+
hours: "Stunden"
|
96
|
+
loading: "Lade Daten..."
|
97
|
+
no: "Nein"
|
98
|
+
or: "oder"
|
99
|
+
page: "Seite"
|
100
|
+
searchterm: "Suchbegriff"
|
101
|
+
unconfirmed: "unbestätigt"
|
102
|
+
yes: "Ja"
|
103
|
+
|
104
|
+
googlemap:
|
105
|
+
incompatible_browser: "Dieser Browser kann Google Maps leider nicht darstellen."
|
106
|
+
loading: "Lade Google Map..."
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# Do not edit this file: "It will be overwritten by the localized_scaffold"
|
2
|
+
# generator!"
|
3
|
+
|
4
|
+
en:
|
5
|
+
standard:
|
6
|
+
language: "English"
|
7
|
+
|
8
|
+
cmds:
|
9
|
+
account: "Account settings"
|
10
|
+
add: "Add"
|
11
|
+
add_above: "Add above"
|
12
|
+
add_below: "Add below"
|
13
|
+
add_left: "Add left"
|
14
|
+
add_right: "Add right"
|
15
|
+
all: "Show all"
|
16
|
+
answer: "Answer"
|
17
|
+
back: "Back"
|
18
|
+
browse_back: "Previous"
|
19
|
+
browse_forward: "Next"
|
20
|
+
cancel: "Cancel"
|
21
|
+
change: "Change"
|
22
|
+
close: "Close"
|
23
|
+
copy: "Copy"
|
24
|
+
create: "Create"
|
25
|
+
create_and_continue: "Create and continue editing"
|
26
|
+
delete: "Delete"
|
27
|
+
destroy: "Delete"
|
28
|
+
display: "Show"
|
29
|
+
done: "Done"
|
30
|
+
download: "Download"
|
31
|
+
edit: "Edit"
|
32
|
+
find: "Find"
|
33
|
+
generate: "Generate"
|
34
|
+
help: "Help"
|
35
|
+
hide: "Hide"
|
36
|
+
home: "Homepage"
|
37
|
+
import: "Import"
|
38
|
+
invite: "Invite"
|
39
|
+
larger: "Larger"
|
40
|
+
login: "Login"
|
41
|
+
logout: "Logout"
|
42
|
+
modify: "Modify"
|
43
|
+
more: "More"
|
44
|
+
more_information: "More information"
|
45
|
+
new: "New"
|
46
|
+
next: "Next"
|
47
|
+
next_page: "Next"
|
48
|
+
ok: "OK"
|
49
|
+
open: "Open"
|
50
|
+
overview: "Overview"
|
51
|
+
owner: "Owner"
|
52
|
+
preview: "Preview"
|
53
|
+
previous_page: "Previous"
|
54
|
+
print: "Print"
|
55
|
+
refresh: "Refresh"
|
56
|
+
register: "Register"
|
57
|
+
register_continue: "Continue registration"
|
58
|
+
remove: "Remove"
|
59
|
+
reply: "Reply"
|
60
|
+
reset: "Reset"
|
61
|
+
save: "Save"
|
62
|
+
save_and_continue: "Save and continue editing"
|
63
|
+
search: "Search"
|
64
|
+
select: "Select"
|
65
|
+
send: "Send"
|
66
|
+
settings: "Settings"
|
67
|
+
show: "Show"
|
68
|
+
smaller: "Smaller"
|
69
|
+
style: "Style"
|
70
|
+
update: "Update"
|
71
|
+
upload: "Upload"
|
72
|
+
users: "Users"
|
73
|
+
|
74
|
+
errors:
|
75
|
+
cant_close_window: "Couldn't the window be closed automatically?"
|
76
|
+
login_required: "You have to authenticate for this action."
|
77
|
+
no_data: "No matching data found..."
|
78
|
+
no_javascript: "Javascript needed"
|
79
|
+
access_denied: "You are not allowed to open the page you requested!"
|
80
|
+
|
81
|
+
in_place_edit:
|
82
|
+
cancel: "Cancel"
|
83
|
+
click_to_edit: "Click to edit..."
|
84
|
+
click_tools_to_edit: "Click tool icons to modify..."
|
85
|
+
loading: "Loading..."
|
86
|
+
ok: "OK"
|
87
|
+
saving: "Saving..."
|
88
|
+
|
89
|
+
labels:
|
90
|
+
and: "and"
|
91
|
+
and_or: "and/or"
|
92
|
+
are_you_sure: "Are you sure?"
|
93
|
+
confirmed: "confirmed"
|
94
|
+
hits: "%s hits"
|
95
|
+
hours: "hours"
|
96
|
+
loading: "Loading data..."
|
97
|
+
no: "No"
|
98
|
+
or: "or"
|
99
|
+
page: "Page"
|
100
|
+
searchterm: "Search term"
|
101
|
+
unconfirmed: "unconfirmed"
|
102
|
+
yes: "Yes"
|
103
|
+
|
104
|
+
googlemap:
|
105
|
+
incompatible_browser: "This web browser can't display Google Maps."
|
106
|
+
loading: "Loading Google Map..."
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# Localized Rails scaffolding with style...
|
2
|
+
|
3
|
+
require 'rails/generators/erb'
|
4
|
+
require 'rails/generators/resource_helpers'
|
5
|
+
require 'rails/generators/erb/scaffold/scaffold_generator'
|
6
|
+
|
7
|
+
require File.join(File.dirname(__FILE__), 'localized_scaffold_generator')
|
8
|
+
|
9
|
+
require 'find'
|
10
|
+
|
11
|
+
# LocalizedDeviseViewsGenerator implements a generator doing the same as the
|
12
|
+
# devise_views generator shipped with devise but adding localization the same
|
13
|
+
# way as supported by the LocalizedScaffoldGenerator.
|
14
|
+
#
|
15
|
+
# Devise supports some localization but only for flashes and not for views.
|
16
|
+
# This generator adds its own "devise_views.en.yml" etc. files and uses these
|
17
|
+
# files for further localization. It also uses the title helper for title and
|
18
|
+
# headline which integrated better with the remaining application.
|
19
|
+
#
|
20
|
+
# The generator was not written from scratch but hijacks basic functionality
|
21
|
+
# from the scaffolding generator overwriting lookup rules to use the right
|
22
|
+
# templates.
|
23
|
+
|
24
|
+
class LocalizedDeviseViewsGenerator < Erb::Generators::Base
|
25
|
+
desc "Creates a set of localized views for Devise using the provided model name
|
26
|
+
to access the user.
|
27
|
+
|
28
|
+
The required NAME parameter is the name of the model devise was installed to
|
29
|
+
run with (same you called \"rails generate devise\" with e.g. \"user\")."
|
30
|
+
|
31
|
+
include Rails::Generators::ResourceHelpers
|
32
|
+
|
33
|
+
# Returns a path relative to the generators directory optionally appending
|
34
|
+
# the provided filename.
|
35
|
+
#
|
36
|
+
# Parameters:
|
37
|
+
#
|
38
|
+
# [filename] Filename or array of filenames to add (defaults to none)
|
39
|
+
|
40
|
+
def self.generator_path(filename = '')
|
41
|
+
return File.join(File.expand_path(File.dirname(__FILE__)),
|
42
|
+
'templates', 'devise', filename)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Creates the views directory.
|
46
|
+
|
47
|
+
def create_root_folder
|
48
|
+
empty_directory File.join('app', 'views', 'devise')
|
49
|
+
end
|
50
|
+
|
51
|
+
# Generates all views in the views directory.
|
52
|
+
|
53
|
+
def copy_view_files
|
54
|
+
views = available_views
|
55
|
+
|
56
|
+
views.each do |filename|
|
57
|
+
template LocalizedDeviseViewsGenerator.generator_path(['views', filename]),
|
58
|
+
File.join('app', 'views', 'devise', filename)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Copy locale files.
|
63
|
+
|
64
|
+
def copy_standard_locales
|
65
|
+
locales = LocalizedDeviseViewsGenerator.generator_path('locales')
|
66
|
+
|
67
|
+
Dir.entries(locales).delete_if { |f| not f.match(/.*\.yml$/) }.each do |l|
|
68
|
+
template File.join(locales, l), File.join('config', 'locales', l)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Copy of the scaffold layout and css file.
|
73
|
+
|
74
|
+
def copy_layout_and_stylesheet_files
|
75
|
+
template File.join(File.dirname(LocalizedDeviseViewsGenerator.generator_path),
|
76
|
+
'erb', 'scaffold', filename_with_extensions(:layout)),
|
77
|
+
File.join('app', 'views', 'layouts', filename_with_extensions('scaffold'))
|
78
|
+
|
79
|
+
template File.join(File.dirname(LocalizedDeviseViewsGenerator.generator_path),
|
80
|
+
'rails', 'stylesheets', 'templates', 'scaffold.css'),
|
81
|
+
File.join('public', 'stylesheets', 'scaffold.css')
|
82
|
+
end
|
83
|
+
|
84
|
+
def name
|
85
|
+
return @name.downcase
|
86
|
+
end
|
87
|
+
|
88
|
+
protected
|
89
|
+
|
90
|
+
# Returns the views to generate.
|
91
|
+
|
92
|
+
def available_views
|
93
|
+
genpath = LocalizedDeviseViewsGenerator.generator_path('views')
|
94
|
+
views = []
|
95
|
+
|
96
|
+
Find.find(genpath) { |f| views << f.sub(genpath, '') if File.stat(f).file? }
|
97
|
+
|
98
|
+
return views
|
99
|
+
end
|
100
|
+
end
|