forked from edwinmoss/active_scaffold_localize
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreadme.txt
33 lines (21 loc) · 1.01 KB
/
readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Contributions welcome!
Option 1:
Download the all the files in locales folder and it's sub-folders into your app's config/locales folder.
Create 'config/initializers/locales.rb' with the following:
I18n.locale = 'en'
Option 2:
Download the locales folder into your app's config folder.
Create 'config/initializers/locales.rb' the following:
I18n.locale = 'en'
LOCALE_OPTIONS = []
Dir["#{File.dirname __FILE__}/../locales/active_scaffold/*.*"].each {|file|
LOCALE_OPTIONS << File.split(file)[1].split(".")[0]
I18n.load_path << file
}
Dir["#{File.dirname __FILE__}/../locales/rails/*.*"].each {|file|
I18n.load_path << file
}
Then if you want to use LOCALE_OPTIONS in your form:
<% form_tag(:action => "change_language") do %>
<%= select_tag(nil, options_for_select([as_(:_select_)] + LOCALE_OPTIONS.collect {|locale| [I18n.backend.translate(locale, :locale_name), locale]}, I18n.locale.to_s), {:name => :lang_code, :onchange => "javascript:submit();"}) %>
<% end %>