rolandtoth / AdminOnSteroids

Various ProcessWire admin tweaks to boost productivity.
https://processwire.com/talk/topic/13389-adminonsteroids/
GNU General Public License v2.0
39 stars 9 forks source link

Multilingual page pickers #22

Open gmclelland opened 7 years ago

gmclelland commented 7 years ago

Just had an idea. I'm not sure it is possible, but how about adding a client-side language picker to each place these pickers are shown?

Maybe a dropdown select field for choosing the EN, ES, DE just like you did in the AdminOnSteriods configuration options?
untitled 2016-11-02 15-42-44

Selecting a different language would only show/select pages in that specific language. The autocomplete page input, page tree picker, select child page picker, and select file picker would only show/select pages in that language.

I was thinking that after choosing a different language it would perform an ajax request to replace the field's contents.

This would allow a user to pick or browse pages in a language that is different from the user's language.

example:fieldtype-assisted-url untitled 2016-11-02 15-56-10

Here are some other examples where these pickers appear.

example: ckeditor-page-linker image

example: parent page selector image

example: AdminOnSteriods NavItems page picker image

rolandtoth commented 7 years ago

Well I found a workaround that could work, setting the "lang" GET parameter with a hook:

$this->addHookBefore('ProcessPageList::execute', function(HookEvent $event) {
            $this->input->get['lang'] = 1020;
        });

Of course 1020 needs to be dynamic, which could be achieved by the picker (select), eg. placing a cookie. Plus the "Select page" field would need to be reloaded as well.

This change would also make the labels to be translated to the target language ("Choose"), and of course the page titles that appear. The latter would make it hard for English editors to pick the right page if they see the page titles in Chinese or Russian, for example.

Perhaps it were more handy (and safe) to leave the user language as is, and use these buttons (EN, DE, ES, etc) to "convert" paths to the corresponding language paths? Eg. "/contact-us" to "/de/kontakt-uns"? This could be more easily achieved using a small ajax call I guess.

rolandtoth commented 7 years ago

From UI point of view it would be better to add the DE, ES, etc buttons on each row next to Choose. I'm not sure if this could achieved easily, perhaps this should be in the core instead.

gmclelland commented 7 years ago

I'm really not sure what the best interface would be? I like your ideas as well. I wonder how we can get more user interface ideas from the community? Maybe mention this on the AdminOnSteriods forum post?

I tried looking at how other CMS implement something like this, but I couldn't find any good implementations.

I really just wanted to do a brain dump and get these ideas out of my head. I didn't want to get busy and just forget about them.

I also wanted to give you another possible feature to add for v100!

Maybe @ryancramerdesign could look at these ideas as well?

rolandtoth commented 7 years ago

I think the best would be to create a forum topic about this, and adding a feature request for PW GitHub to make Ryan know about it.

The main issue is to determine what the user would need - would he need to see page titles in his language (set in his Profile), or localized titles. I would say that the former sounds more logical but maybe others have different views.