Skip to content

Add Russian translation #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.bundle/
.bin

Gemfile.lock
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source "https://rubygems.org"
source 'https://rubygems.org'

gemspec

gem 'activeadmin', github: 'gregbell/active_admin', branch: 'master'
gem 'activeadmin', github: 'activeadmin', branch: 'master'

162 changes: 0 additions & 162 deletions Gemfile.lock

This file was deleted.

2 changes: 1 addition & 1 deletion activeadmin-globalize.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ Gem::Specification.new do |s|
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "README.md"]

s.add_dependency "activeadmin"
s.add_dependency "globalize", '~> 4.0.0'
s.add_dependency "globalize", '~> 5.0.1'
end

1 change: 1 addition & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ de:
it: "Italienisch"
pt-BR: "Portugiesisch"
pt-PT: "Portugiesisch (Portugal)"
ru: "Russisch"
tr: "Türkisch"

1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ en:
it: "Italian"
pt-BR: "Portuguese"
pt-PT: "Portuguese (Portugal)"
ru: "Russian"
tr: "Turkish"

1 change: 1 addition & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ es:
it: "Italiano"
pt-BR: "Portugués"
pt-PT: "Portugués (Portugal)"
ru: "Ruso"
tr: "Turco"
1 change: 1 addition & 0 deletions config/locales/hu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ hu:
it: "Olasz"
pt-BR: "Portuguese"
pt-PT: "Portuguese (Portugal)"
ru: "Orosz"
tr: "Török"

1 change: 1 addition & 0 deletions config/locales/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ it:
it: "Italiano"
pt-BR: "Portoghese"
pt-PT: "Portoghese (Portogallo)"
ru: "Russo"
tr: "Turco"

1 change: 1 addition & 0 deletions config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ pt-BR:
it: "Italiano"
pt-BR: "Português"
pt-PT: "Português (Portugal)"
ru: "Russo"
tr: "Turco"

1 change: 1 addition & 0 deletions config/locales/pt-PT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ pt-PT:
it: "Italiano"
pt-BR: "Português"
pt-PT: "Português (Portugal)"
ru: "Russo"
tr: "Turco"

16 changes: 16 additions & 0 deletions config/locales/ru.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ru:
active_admin:
globalize:
translations: "Переводы"
language:
de: "Немецкий"
en: "Английский"
es: "Испанский"
fr: "Французский"
hu: "Венгенрский"
it: "Итальянский"
pt-BR: "Португальский (Бразилия)"
pt-PT: "Португальский (Португалия)"
ru: "Русский"
tr: "Турецкий"

2 changes: 1 addition & 1 deletion lib/active_admin/globalize/engine.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module ActiveAdmin
module Globalize
class Engine < ::Rails::Engine
initializer "Active Admin precompile hook", group: :assets do |app|
initializer "Active Admin precompile hook", group: :all do |app|
app.config.assets.precompile += [
"active_admin/active_admin_globalize.css",
"active_admin/active_admin_globalize.js"
Expand Down
6 changes: 3 additions & 3 deletions lib/active_admin/globalize/form_builder_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def translated_inputs(name = "Translations", options = {}, &block)
options.symbolize_keys!
switch_locale = options.fetch(:switch_locale, false)
auto_sort = options.fetch(:auto_sort, true)
form_buffers.last << template.content_tag(:div, class: "activeadmin-translations") do
template.content_tag(:div, class: "activeadmin-translations") do
template.content_tag(:ul, class: "available-locales") do
(auto_sort ? I18n.available_locales.sort : I18n.available_locales).map do |locale|
template.content_tag(:li) do
Expand All @@ -22,13 +22,13 @@ def translated_inputs(name = "Translations", options = {}, &block)
translation ||= object.translations.build(locale: locale)
fields = proc do |form|
form.input(:locale, as: :hidden)
form.input(:id, as: :hidden)
form.input(:id, as: :hidden) if translation.persisted?
I18n.with_locale(switch_locale ? locale : I18n.locale) do
block.call(form)
end
end
inputs_for_nested_attributes(
for: [:translations, translation ],
for: [:translations, translation],
class: "inputs locale locale-#{translation.locale}",
&fields
)
Expand Down