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

Multilingual: adding warning when changing item language. #12308

Closed
wants to merge 1 commit into from

Conversation

infograf768
Copy link
Member

@infograf768 infograf768 commented Oct 4, 2016

Create a multingual site.
For example with 3 languages. Here I used en-GB, fr-FR and it-IT
Enable Associations in the language filter.

Create menu items, articles, contacts, newsfeeds, categories, assigning a specific Content Language to each of them. Save them without creating associations yet.

Edit one of these items (test on all kinds) tagged for example to en-GB.
Look at the Associations tab
The possible associations proposed are fr-FR and it-IT => OK
Change the language of the item, for example to fr-FR
DO NOT SAVE
Look again at the associations tab
The available associations are the same as before.

These should change to reflect the new language for the item.
I.e. we should get en-GB and it-IT
But as the original language value is set in the database, the item has to be saved BEFORE selecting/creating Associations.

Patch and test again.
This PR displays a message to let the user know the item has to be saved again before creating associations.

screen shot 2016-10-04 at 17 51 39

Note: It is normal, once associations are created, to not be able to change the language of the edited item.

@dgt41 @andrepereiradasilva @alikon

@brianteeman for the new string

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-3.7.x labels Oct 4, 2016
@brianteeman
Copy link
Contributor

The string is indeed wrong but I am not sure exactly what you mean.
Do you mean something like "reset the available assocications?"

On 4 October 2016 at 17:08, infograf768 notifications@github.com wrote:

Create a multingual site.
For example with 3 languages. Here I used en-GB, fr-FR and it-IT
Enable Associations in the language filter.

Create menu items, articles, contacts, newsfeeds, categories, assigning a
specific Content Language to each of them. Save them without creating
associations yet.

Edit one of these items (test on all) tagged for example to en-GB.
Look at the Associations tab
The possible associations proposed are fr-FR and it-IT => OK
Change the language of the item, for example to fr-FR
DO NOT SAVE
Look again at the associations tab
The possible associations are the same as before.

These should change to reflect the new language for the item.
I.e. we should get en-GB and it-IT
But as the original language value is set in the database, the item has to
be saved BEFORE selecting/creating Associations.

Patch and test again.
This PR displays a message to let the user know the item has to be saved
again before creating associations.

[image: screen shot 2016-10-04 at 17 51 39]
https://cloud.githubusercontent.com/assets/869724/19082098/0059b18e-8a5d-11e6-8752-0f1c5fa3b7a6.png

Note: It is normal, once associations are created, to not be able to
change the language of the edited item.

@dgt41 https://github.com/dgt41 @andrepereiradasilva
https://github.com/andrepereiradasilva @alikon
https://github.com/alikon

@brianteeman https://github.com/brianteeman for the new string

You can view, comment on, or merge this pull request online at:

#12308
Commit Summary

  • Multilingual: adding warning when changing item language.

File Changes

Patch Links:


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#12308, or mute the thread
https://github.com/notifications/unsubscribe-auth/ABPH8UmX0ERSFFTtuCNHCntTnSIzPwdUks5qwnnngaJpZM4KN3We
.

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

@infograf768
Copy link
Member Author

"reset the available associations" sounds right.
If you understood the issue, I will modify.

@brianteeman
Copy link
Contributor

Reading your report more closely I think I understood it correctly

On 4 October 2016 at 17:38, infograf768 notifications@github.com wrote:

"reset the available associations" sounds right.
If you understood the issue, I will modify.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#12308 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABPH8ajORA0cakRy8z8ISqJr46ybHZf2ks5qwoD8gaJpZM4KN3We
.

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

@infograf768
Copy link
Member Author

String modified. Thanks.

@andrepereiradasilva
Copy link
Contributor

andrepereiradasilva commented Oct 4, 2016

i see here you are getting with this, but i think that's to much warnings for the user and it maybe could be done without any warnings. Example:

  1. When loaded the associations edit.php layout would have all languages associations fields/buttons:
    • If item set to All languages: languages associations fields/buttons fields would be hidden and the message there
    • If item set to a language: only the current language associations fields/buttons would be hidden and no message
  2. Then, with js, when changing language :
    • from All to a language: show the other languages associations associations fields/buttons with js
    • from a language to All language: hide the associations buttons and empty the associations field values with js
    • from a language to another language (not All language): show one and hide the other and empty the old/new language associations field values with js

@infograf768
Copy link
Member Author

Concerning 1. we get this already before patch.
Concerning 2. Well said. Out of my abilities.

If no one does it, this PR is better than nothing...

@andrepereiradasilva
Copy link
Contributor

Concerning 1. we get this already before patch.

Actually we don't. If we have a language selected that langiuage associations field/buttons is not rendered in the HTML so it can't be shown on change

Concerning 2. Well said. Out of my abilities.

I can help with that. something like this would work i think (just a PoC written directly with no test at all)

jQuery(document).ready(function() {
    jQuery('#jform_language').on('change' function() {

        // Get the current selected language.
        var selected = $(this).val();

        // if the current selected is All languages hide the associations fields/buttons
        if (selected == '*')
        {
            jQuery('#associations .control-group').hide();
        }
        else
        {
            // Show all associations fields/buttons.
            jQuery('#associations .control-group').show();

            // Remove the associations, ie, empty the associations fields and reset the buttons to Select/Create.
            // [TODO]

            // Now hide the ones not needed.
            jQuery('#associations .control-group').each(function(index, element) {
                var label = element.find('div.control-label label');

                // Current selected language. Hide it.
                if (label.attr("id") == 'jform_associations_' + selected.replace('-', '_') + '_id-lbl')
                {
                    element.hide();
                }
            });
        }
    });
});

@jreys what do you think?

@infograf768
Copy link
Member Author

This branch has a booboo. Closing as Andre has anyway a much better solution

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

Successfully merging this pull request may close these issues.

4 participants