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

Translatable fields are not showing: dev-master (6d1a7d) #29

Closed
peterboorsma opened this issue Jul 14, 2016 · 11 comments
Closed

Translatable fields are not showing: dev-master (6d1a7d) #29

peterboorsma opened this issue Jul 14, 2016 · 11 comments
Labels

Comments

@peterboorsma
Copy link

After installing and adding the correct additions to contenttypes.yml, config and updating the database.
Two issues:

  1. Existing items now have a Language tab. The tab dropdown items have links like this: http://bla.localhost/bolt/editcontent/paginas/1?_locale=en
    but the toggle to the translatable fields don't work. (page reloads instead of showing the right fields)
  2. New items don't show the language tab at all.

In both cases the translate icons for translatable filetypes are missing.

@madc
Copy link
Contributor

madc commented Jul 14, 2016

ad. 1) The translate icons are set by Javascript. Do you get any errors in the console?

ad. 2) As far as i remember, this is intended. You need to add the record with the default language first and can then add translations.

@peterboorsma
Copy link
Author

Yes.

lib.js?2ed94ca141:24 Uncaught Error: Syntax error, unrecognized expression: http://stortemelk3.localhost/beheer/editcontent/paginas/1?_locale=enb.error @ lib.js?2ed94ca141:24b.tokenize @ lib.js?2ed94ca141:24b.select @ lib.js?2ed94ca141:24b @ lib.js?2ed94ca141:24find @ lib.js?2ed94ca141:24fa.fn.init @ lib.js?2ed94ca141:24fa @ lib.js?2ed94ca141:14c.show @ lib.js?2ed94ca141:90(anonymous function) @ lib.js?2ed94ca141:90each @ lib.js?2ed94ca141:14each @ lib.js?2ed94ca141:14b @ lib.js?2ed94ca141:90(anonymous function) @ bolt.js?4c21e560ba:8dispatch @ lib.js?2ed94ca141:25q.handle @ lib.js?2ed94ca141:24
Navigated to http://stortemelk3.localhost/beheer/editcontent/paginas/1?_locale=en

@SvanteRichter
Copy link
Contributor

SvanteRichter commented Jul 14, 2016

  1. That's intentional for now. Until you have saved it it does not have anywhere to "save" the translations, (I'll try to work around this in the future to allow records to only be in an non-default locale).
  2. The behavior is changed from setting the items via JS to setting them on the backend via the _locale query string. This is done so that we don't have to write specific js code to load fields (both bolt's own and extension fields) and also because the JS we wrote to load/unload fields was probably the most fragile thing about the 2.0 version simply because it was often fighting with bolt's own JS and the way that bolt's ajax save cycle worked.

Sounds to me like it's working as it should and the lib.js sounds like it might be unrelated since it is not from this extension.

Sorry, missed the part about the translation icons, Could you please post the contenttypes.yml so I can try to reproduce here?

@peterboorsma
Copy link
Author

peterboorsma commented Jul 14, 2016

The main problem is that the translatable fields won't show up so you can't type text per language.

contenttypes.yml.zip

PS
My posted issues are supposed to help you guys out, not to nag. :)

@SvanteRichter
Copy link
Contributor

SvanteRichter commented Jul 14, 2016

@peterboorsma The issue here is just that while fixing a few other things I changed isTranslateable to is_translateable since it better follows bolt's and YAML's rules about key names that way (I thought it was best to fix all the things that has bothered me in one breaking change when I have to bump major versions anyway). I updated the readme, but forgot to mention it in the issue... :(

Just change isTranslateable to is_translateable and it should work :)

Oh, and I'm very thankful for you trying the extension and posting issue when you run into snags! If you need something in real-time you can also ping me on slack/irc. :)

@peterboorsma
Copy link
Author

Yes. I used the old "isTranslatable". Updated them now.

But...
(and I am sorry) the translations aren't stored properly. If you toggle back and forth between the languages the translated fields are not saved.
Is it intentional that the page is refreshed in the browser instead of changing the translatable fields 'ajaxy'? Because that's what's happening.

@SvanteRichter
Copy link
Contributor

@peterboorsma yeah, it's intentional to refresh the browser instead of doing it ajaxy... That way it will be much more compatible and robust. The old way of doing it ajaxy would be much harder to make compatible with extensions and would require us to write js for loading values into every extension fieldtype.

For me (when testing with your contenttype) it seems like DB query result is getting cached... Could you try updating page with translations a few times and see if your translations appear then? Perhaps local extensions do not get their DB queries results cached which would explain why I didn't see this when writing the code...

@SvanteRichter
Copy link
Contributor

SvanteRichter commented Jul 14, 2016

@peterboorsma Or you should be able to disable the cache by adding database: false to the caching config in config.yml so it looks something like this:

caching:
    config: true
    templates: true
    request: false
    duration: 10
    authenticated: false
    thumbnails: true
    database: false

@peterboorsma
Copy link
Author

I made a copy of my test site on my dev server. Things work fine there so it must be something on my local server. I'll try to figure that out.

@peterboorsma
Copy link
Author

Problem fixed with dev-master (7fa12c) + Bolt 3..0.10

@SvanteRichter
Copy link
Contributor

Great :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants