Class: TranslateController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- TranslateController
- Defined in:
- app/controllers/translate_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
GET /translate.
-
#reload ⇒ Object
GET /translate/reload.
-
#translate ⇒ Object
POST /translate.
Instance Method Details
#index ⇒ Object
GET /translate
11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/translate_controller.rb', line 11 def index initialize_keys filter_by_key_pattern filter_by_text_pattern filter_by_translated_text_pattern filter_by_translated_or_changed sort_keys paginate_keys @total_entries = @keys.size @page_title = page_title end |
#reload ⇒ Object
GET /translate/reload
36 37 38 39 |
# File 'app/controllers/translate_controller.rb', line 36 def reload Translate::Keys.files = nil redirect_to :action => 'index' end |
#translate ⇒ Object
POST /translate
24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/translate_controller.rb', line 24 def translate processed_parameters = process_array_parameters(params[:key]) I18n.backend.store_translations(@to_locale, Translate::Keys.to_deep_hash(processed_parameters)) Translate::Storage.new(@to_locale).write_to_file Translate::Log.new(@from_locale, @to_locale, params[:key].keys).write_to_file force_init_translations # Force reload from YAML file flash[:notice] = "Translations stored" old_params = params.slice(:filter, :sort_by, :key_type, :key_pattern, :text_type, :text_pattern, :translated_text_type, :translated_text_pattern) redirect_to( {:action => :index}.merge(old_params) ) end |