Skip to content
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 for default language gets added always #2507

Closed
mattherick opened this issue Dec 18, 2013 · 11 comments
Closed

Empty translation for default language gets added always #2507

mattherick opened this issue Dec 18, 2013 · 11 comments

Comments

@mattherick
Copy link
Contributor

I have "de" as default language. If I add a page and change the language to "en" and only save the new "en" translated page I have a new page with one "en" translation in the database - so far so good, that´s what I want.

But if I now do this for my locales menu:

app/helpers/application_helper.rb

def locales_menu(page)
  debugger
  translations = page.translations.map(&:locale).sort
  translations.each do |locale|
    puts locale
  end
end

I will get:

translations => [:de, :en] # should only be :en

page.translations => [
  #<Refinery::Page::Translation id: 42, refinery_page_id: 38, locale: "en", title: "englisch only", custom_slug: "", menu_title: "", slug: "englisch-only", created_at: "2013-12-18 09:27:44", updated_at: "2013-12-18 09:27:44">, 
  #<Refinery::Page::Translation id: nil, refinery_page_id: 38, locale: "de", title: nil, custom_slug: nil, menu_title: nil, slug: nil, created_at: nil, updated_at: nil>
]

As you can see there is an "empty" translation for "de" - and I really have no idea why? I do not magic stuff or something like that, but it is annoying..I have to filter out all these "empty" translations.. on locales menu, navigation, subnavigation, subsubnavigation, and so on..

Anyone an idea what´s wrong here?

I think that´s the top of the mountain of the following issues:
#2487
#2488

@parndt
Copy link
Member

parndt commented Dec 18, 2013

Which versions of globalize and refinerycms are you using, please?

@mattherick
Copy link
Contributor Author

I have the problem in two projects:

first:

refinerycms (2.1.0)
globalize3 (0.3.0)

 (full refinery-setup)
 refinerycms (2.1.0)
 refinerycms-acts-as-indexed (1.0.0)
 refinerycms-authentication (2.1.0)
 refinerycms-core (2.1.0)
 refinerycms-dashboard (2.1.0)
 refinerycms-i18n (2.1.0)
 refinerycms-images (2.1.0)
 refinerycms-inquiries (2.1.0 77169bf)
 refinerycms-page-images (2.1.0 d3b51e3)
 refinerycms-page-resources (0.0.2 d2a6270)
 refinerycms-pages (2.1.0)
 refinerycms-projects (1.0)
 refinerycms-resources (2.1.0)
 refinerycms-settings (2.1.0 07c2ee4)

second:

refinerycms (2.1.1)
globalize (3.0.1)

(full refinery-setup)
refinerycms (2.1.1)
refinerycms-acts-as-indexed (1.0.0)
refinerycms-authentication (2.1.1)
refinerycms-core (2.1.1)
refinerycms-dashboard (2.1.1)
refinerycms-i18n (2.1.0)
refinerycms-images (2.1.1)
refinerycms-investors (1.0)
refinerycms-page-images (2.1.0)
refinerycms-page-resources (0.0.2 d2a6270)
refinerycms-pages (2.1.1)
refinerycms-resources (2.1.1)
refinerycms-settings (2.1.0)

@parndt
Copy link
Member

parndt commented Dec 18, 2013

The second shouldn't have this problem.. Hmm. So for some reason it's got an unpersisted translation for the page?

@mattherick
Copy link
Contributor Author

Yes..and I really did nothing magic or so on.. Just default refinerycms setup. In one project I have an own extension, but that´s not the problem.

@parndt
Copy link
Member

parndt commented Dec 18, 2013

cc @shioyama .. sorry

@shioyama
Copy link
Contributor

Hmm... the latest AR3 version of globalize is 3.0.2, but there's nothing between 3.0.1 and 3.0.2 related to this, so it looks like a bug. I'll see if I can isolate a test that reproduces this, but if you could write one that would make it easier to solve. i.e. take refinery out of the picture and see if you can reproduce the same behaviour.

@shioyama
Copy link
Contributor

p.s. I would recommend updating the first project to globalize ~> 3.0.0. globalize3 is no longer supported.

@shioyama
Copy link
Contributor

Ok I don't see this in a vanilla globalized model, so it's coming from something refinery is doing. I can help but I don't know refinery well so it would help to investigate a bit further and figure out where it's coming from. Perhaps related to #2462?

@mattherick
Copy link
Contributor Author

Case 1:

  • Backend: English and german translation
  • Frontend: English and german translation => correct

Case 2:

  • Backend: Only english translation
  • Frontend: English and german translation, german translation is "empty" => not correct

So there must be a problem with refinery frontend locales or something similar? I do not get it..hmm.. The backend looks good and it works with globalize, everything gets saved correctly. But in the frontend there is a problem..

@parndt
Copy link
Member

parndt commented Dec 18, 2013

Sometimes I think we should delete all translation functionality and rebuild it with the current versions of globalize.

@shioyama
Copy link
Contributor

Isn't this just some kind of interface issue, unrelated to the backend (globalize, etc.)? Looks that way to me.

@parndt parndt closed this as completed Jul 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants