nikolov-tmw / multilingual-wp

A new plugin for multilingual content in WordPress
29 stars 3 forks source link

Meta boxes change depending on active language #36

Closed scherii closed 3 years ago

scherii commented 11 years ago

Hi @nikolov-tmw :relaxed:

Is it possible to change the meta boxes so they depend on the language? For example: I have added a few meta boxes like a custom upload field. If I switch the language the meta box stays the same. I think it would be perfect if the meta box would change as well as the editor itself.

Do you need help testing?

Thanks, Gérard

nikolov-tmw commented 11 years ago

Hi Gérard,

That's a great idea that you have - because so far there's been no way to store different post meta for each language(well your solution still wouldn't do exactly that, but it would get closer to it).

Now the question is how to define which metabox responds to which language. What I'm possibly thinking is maybe grabbing all meta boxes and then letting the user assign them to a specific language(or all).

Do you have any other thoughts on how to achieve that?

For now I can give you some sample JS that would allow you to hook to the language tab change and show/hide your metaboxes accordingly.

scherii commented 11 years ago

Thanks!

Just for my understanding: So you would create one meta box – let's call it «upload box 1» – for the first language and another one («upload box 2») for the second language? And with an interface one could assign «upload box 1» to the first language and «upload box 2» to the second one? If this is correct I think that this is a good solution, too.

Yes, that would be great! But there is no hurry, I don't need it right now. But if you want, I can test it.

nikolov-tmw commented 11 years ago

Pretty much that's what I'm thinking - yes.

Right now you can get all enabled languages and loop through them - that's how you'd create as many meta boxes as needed(each one would be slightly different from the others of course). You would then assign each of those meta boxes to the corresponding language.

When I have some free time, I'll make a branch with the changes required for some custom JS to change the meta boxes depending on the language being edited.

scherii commented 11 years ago

Thanks, I'll keep an eye out :relaxed:

gabriel89 commented 10 years ago

Hello @nikolov-tmw ,

has this issue been already addressed? I am just curious how you implemented the solution - I assume you saved the meta-box as a serialized array, containing the fields for each language, but how will the UI handle language-field associations?

Regards, Gabriel

nikolov-tmw commented 10 years ago

Hi Gabriel,

I still haven't implemented anything like this. I'm considering the option of waiting until the WordPress Metadata UI API - https://github.com/ericandrewlewis/wordpress-metadata-ui-api - gets into core and just adding support for custom fields from there.

In the mean time, I totally can just fire a jQuery event on document(for instance) that will pass the language to which we're switching. This way you would be able to write your own piece of JS and show/hide the appropriate meta boxes.

I'm still not sure when exactly when I'm going to continue working on the plugin(I haven't done anything besides go over the issues list in 5 months), but my hope is to ship a user-ready version for WordPress 3.9(scheduled for release around April), since I'm predicting a big disaster with qTranslate in 3.9 :)

scherii commented 10 years ago

since I'm predicting a big disaster with qTranslate in 3.9 :)

Well said ;)