-
Notifications
You must be signed in to change notification settings - Fork 54
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
Empty translation created without adding it in the UI #1
Comments
I can't reproduce this in the dummy app bundled in this repository, could you try to do that? Are you still experiencing the issue using the latest version from develop branch? Quick setup: git clone https://github.com/fabn/activeadmin-globalize.git
cd spec/dummy
RAILS_ENV=production rake db:migrate
# Change config.serve_static_assets = true in config/environments/production.rb
# Change config.i18n.default_locale = :de in config/application.rb
# You can apply the patch below with patch -n1 < config.patch
rake assets:precompile RAILS_ENV=production
rails s -e production
# open http://localhost:3000/admin and login with devise default credentials, user: admin@example.com, pass: password When I create an article in the above setup I get these logs
And only Here are the gems I'm using
Could you try to reproduce the issue in the dummy app? If you can't I need more details, at least
Here is the patch with changes above to run the app in production, apply it with diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb
index 24dbd4b..7f73038 100644
--- a/spec/dummy/config/application.rb
+++ b/spec/dummy/config/application.rb
@@ -19,7 +19,7 @@ module Dummy
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
- config.i18n.default_locale = :en
+ config.i18n.default_locale = :de
config.i18n.available_locales = [:de, :en, :hu, :it, :'pt-BR', :'pt-PT']
end
diff --git a/spec/dummy/config/environments/production.rb b/spec/dummy/config/environments/production.rb
index b690b1c..20410c1 100644
--- a/spec/dummy/config/environments/production.rb
+++ b/spec/dummy/config/environments/production.rb
@@ -20,7 +20,7 @@ Dummy::Application.configure do
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do this).
- config.serve_static_assets = false
+ config.serve_static_assets = true
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier |
Thanks for the detailed instructions and sorry for not being specific.
It looks like there is no English form data sent to the server. However the duplicate language is created though (See updated screenshots in the issue description). My # ...
config.i18n.fallbacks = true My # ...
config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.available_locales = [:de, :en]
config.i18n.fallbacks = true
config.i18n.enforce_available_locales = true
config.i18n.default_locale = :de |
I read the linked issue in globalize gem and they marked your report as a bug. Maybe it's involved here? Could you try to execute this code using rails console and see if the english version is created as well? your_attrs = {not_translated: 'field'} # your base fields with no need for translations
de_translation = {
locale: :de,
title: 'title',
summary: 'summary',
# ...
}
Programme.create!(your_attrs.merge(translations_attributes: [de_translation])) The embedded dummy application it uses main Gemfile and gemspec. Notice there is no Gemfile.lock in the repository. |
I did this but only the German translation was created: your_attrs = {
website: 'http://google.com',
admin_contact: 'bubu@example.com',
levels: [Level.last],
categories: [Category.last],
fund_types: [FundType.last],
}
de_translation = {
title: 'title',
summary: 'summary'
}
Programme.create!(your_attrs.merge(translations_attributes: [de_translation])) |
Can you launch a pry session on create and use it to explore the created object? You can do that by overwriting the create action in this way: # In your AA resource file
controller do
create! do |format|
binding.pry # Your object is available in resource (or @programme)
format.html { redirect_to resource }
end
end Another interesting thing to see would be the full SQL output for the create action. |
IMHO Propably this whole issue comes down to #17 and globalize/globalize#328 . |
Add Jsonb Input and Add support for Text mode to json_editor
I did run into an issue but there was no issue tracker enabled on the repo:
The original plugin did that as well which I think is the reason for a problem that I am running into on production environment:
See globalize/globalize#362
The text was updated successfully, but these errors were encountered: