Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Editing translations now works fine.
  • Loading branch information
sborrazas committed Oct 20, 2011
1 parent 61abf2a commit 3f4bd01
Show file tree
Hide file tree
Showing 20 changed files with 7,829 additions and 22 deletions.
8 changes: 4 additions & 4 deletions app/controllers/translations_controller.rb
@@ -1,5 +1,5 @@
class TranslationsController < ActionController::Base
prepend_view_path(File.join(File.dirname(__FILE__), "..", "views"))

layout 'translations'
before_filter :find_locale

Expand All @@ -19,7 +19,7 @@ def index
# GET /translations
# GET /translations.xml
def translations
@locale ||= Locale.default_locale
@locale ||= I18n::Backend::Locale.default_locale
@translation_option = TranslationOption.find(params[:translation_option])

if @translation_option == TranslationOption.translated
Expand All @@ -37,7 +37,7 @@ def translations
# GET /asset_translations
# GET /asset_translations.xml
def asset_translations
@locale ||= Locale.default_locale
@locale ||= I18n::Backend::Locale.default_locale
@translation_option = TranslationOption.find(params[:translation_option])

@asset_translations = I18n.asset_translations
Expand Down Expand Up @@ -135,6 +135,6 @@ def destroy

private
def find_locale
@locale = Locale.find_by_code(params[:locale_id])
@locale = I18n::Backend::Locale.find_by_code(params[:locale_id])
end
end
2 changes: 1 addition & 1 deletion app/models/locale.rb
Expand Up @@ -56,7 +56,7 @@ def self.available_locales
end

def default_locale?
self == Locale.default_locale
self == I18n::Backend::Locale.default_locale
end

def to_param
Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/translations.html.erb
Expand Up @@ -6,6 +6,7 @@
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Translation Administration: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'scaffold' %>
<%= javascript_include_tag 'jquery.min' %>
<%= javascript_include_tag :defaults %>
<%= javascript_include_tag 'jsProgressBarHandler.js' %>
</head>
Expand Down
30 changes: 13 additions & 17 deletions app/views/translations/translations.html.erb
@@ -1,28 +1,24 @@
<% form_tag translations_url do -%>
<%= select_tag :locale_id, options_from_collection_for_select(Locale.all, :code, :name, @locale.code) -%>
<%= select_tag :translation_option, options_from_collection_for_select(TranslationOption.all, :code, :description, @translation_option.code) -%>
<%= submit_tag 'Go' %>
<% end -%>
<%= form_tag translations_url do %>
<%= select_tag :locale_id, options_from_collection_for_select(Locale.all, :code, :name, @locale.code) %>
<%= select_tag :translation_option,
options_from_collection_for_select(TranslationOption.all, :code, :description, @translation_option.code) %>
<%= submit_tag 'Go' %>
<% end %>

<p>
Textual Translation progress: <span class="progressBar" id="translate_progress"><%= @locale.percentage_translated %></span>
</p>
<p>Textual Translation progress: <span class="progressBar" id="translate_progress"><%= @locale.percentage_translated %></span></p>

<h2><%= @translation_option.description %>: <%= @locale.name %></h2>

<% if @translations.empty? -%>
<% if @translations.empty? %>
<h3>No records for this criteria.</h3>
<% end -%>
<% end %>
<% for translation in @translations %>
<div id="<%= "translation_#{translation.class}_#{translation.id}" %>">
<% remote_form_for([@locale, translation]) do |f| %>
<p><%=h translation.default_locale_value || translation.raw_key %></p>
<p>
<%= f.text_field :value, :size => 128 %>
<%= f.submit "Update" %>
</p>
<%= form_for(translation, :as => :translation, :url => locale_translation_path(@locale, translation), :remote => true) do |f| %>
<p><%= h translation.default_locale_value || translation.raw_key %></p>
<p><%= f.text_field :value, :size => 128 %> <%= f.submit "Update" %></p>
<% end %>
<hr/>
</div>
<hr/>
<% end %>
5 changes: 5 additions & 0 deletions lib/tasks/i18n.rake
Expand Up @@ -57,4 +57,9 @@ namespace :i18n do
I18nUtil.google_translate
end
end

desc "Sync extra files from blogify plugin"
task :sync do
system "rsync -ruv vendor/plugins/i18n_backend_database/public ."
end
end
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit 3f4bd01

Please sign in to comment.