Class: Tolk::LocalesController
Instance Method Summary
collapse
#authenticate, #ensure_no_primary_locale
Instance Method Details
#all ⇒ Object
32
33
34
|
# File 'app/controllers/tolk/locales_controller.rb', line 32
def all
@phrases = @locale.phrases_with_translation(params[:page])
end
|
#create ⇒ Object
41
42
43
44
|
# File 'app/controllers/tolk/locales_controller.rb', line 41
def create
Tolk::Locale.create!(locale_params)
redirect_to :action => :index
end
|
#dump_all ⇒ Object
46
47
48
49
50
|
# File 'app/controllers/tolk/locales_controller.rb', line 46
def dump_all
Tolk::Locale.dump_all
I18n.reload!
redirect_to request.referrer
end
|
#index ⇒ Object
6
7
8
|
# File 'app/controllers/tolk/locales_controller.rb', line 6
def index
@locales = Tolk::Locale.secondary_locales.sort_by(&:language_name)
end
|
#show ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/controllers/tolk/locales_controller.rb', line 10
def show
respond_to do |format|
format.html do
@phrases = @locale.phrases_without_translation(params[:page])
end
format.atom { @phrases = @locale.phrases_without_translation(params[:page], :per_page => 50) }
format.yaml do
data = @locale.to_hash
render :text => Tolk::YAML.dump(data)
end
end
end
|
#stats ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'app/controllers/tolk/locales_controller.rb', line 52
def stats
@locales = Tolk::Locale.secondary_locales.sort_by(&:language_name)
respond_to do |format|
format.json do
stats = @locales.collect do |locale|
[locale.name, {
:missing => locale.count_phrases_without_translation,
:updated => locale.count_phrases_with_updated_translation,
:updated_at => locale.updated_at
}]
end
render :json => Hash[stats]
end
end
end
|
#update ⇒ Object
26
27
28
29
30
|
# File 'app/controllers/tolk/locales_controller.rb', line 26
def update
@locale.translations_attributes = translation_params
@locale.save
redirect_to request.referrer
end
|
#updated ⇒ Object
36
37
38
39
|
# File 'app/controllers/tolk/locales_controller.rb', line 36
def updated
@phrases = @locale.phrases_with_updated_translation(params[:page])
render :all
end
|