? ? Success

User tests: Successful: Unsuccessful:

avatar Bakual
Bakual
16 Sep 2016

Currently in a multilingual site the backend indicates the language in several places using a country flag. Since that is not always an appropriate thing some expressed the wish to hide those flags which is currently not possible.
Based on a discussion in #12034 and based on some code started by @andrepereiradasilva this is what I came up with.

Summary of Changes

Basically this adds the possibility to assign no image to a content language. Until now, a flag had to be chosen.
To avoid showing invalid images all over the place, the code had to be adjusted to check the value of the content language image property and fall back to a label or nothing if it wasn't specified.

Testing Instructions

  1. Set up a multilingual site, make sure you have some associations set as well
  2. Adjust at least one content language so it doesn't have an image assigned. Leave at least one language with a flag so you can test both at the same time ?
  3. Check the various places where a flag is usually shown;

  • Menu module shows a flag for a menu with a language specific home
  • Menu manager shows the language specific home button as flag
  • Template manager shows the language specific default button as flag
  • Several lists show the language with a preceding flag
  • Associations have a flag in the tooltip
  • In a module edit, the "Menu Assignment" tab shows the language specific home menu items with a flag

A note: This is strictly about backend. As far as I know in frontend the only place the flags are used is the language switcher module, and that one already has a switch to toggle between flags and text.

Documentation Changes Required

None that I'm aware of.

avatar Bakual Bakual - open - 16 Sep 2016
avatar Bakual Bakual - change - 16 Sep 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 16 Sep 2016
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 16 Sep 2016
Category Administration Components Tags Modules Templates (admin)
avatar Bakual Bakual - change - 16 Sep 2016
The description was changed
avatar Bakual Bakual - change - 16 Sep 2016
The description was changed
avatar Bakual Bakual - edited - 16 Sep 2016
avatar Bakual Bakual - edited - 16 Sep 2016
avatar Bakual Bakual - change - 16 Sep 2016
The description was changed
avatar Bakual Bakual - edited - 16 Sep 2016
avatar Bakual Bakual - edited - 16 Sep 2016
avatar andrepereiradasilva
andrepereiradasilva - comment - 16 Sep 2016

Nice @Bakual ! Thanks for doing this. Will test tomorrow.

avatar MATsxm
MATsxm - comment - 16 Sep 2016

Like Andre, great and thanks for this... Hope being able to test it tomorrow.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/12051.

avatar MATsxm MATsxm - test_item - 17 Sep 2016 - Tested unsuccessfully
avatar MATsxm
MATsxm - comment - 17 Sep 2016

I have tested this item ? unsuccessfully on 08b336a


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/12051.

avatar MATsxm
MATsxm - comment - 17 Sep 2016

I have tested with 3 languages (en-GB, fr-CA and fr-FR WOITHOUT image)on fresh install and few unexpected behaviors happened.

All menu items view, it looks fine:

screen shot 2016-09-16 at 19 45 25

Content languages and templates also:

screen shot 2016-09-16 at 19 46 33
screen shot 2016-09-16 at 19 48 28

For other views, nothing seems to appear:
(tested Contact, modules, cat, articles)
screen shot 2016-09-16 at 19 50 56
screen shot 2016-09-16 at 19 51 07
screen shot 2016-09-16 at 19 51 23screen shot 2016-09-16 at 19 51 32


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/12051.

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Sep 2016

i tested this. All seems fine except:

1 bug in contacts:
image

Lack of uniformization. Sometime the language code is used, another times the language sef is used.
IMHO the language code should always be used

image

image

image

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Sep 2016

Besides the comments above IMHO the new layout needs to be also applied in com_weblinks repo

avatar Bakual
Bakual - comment - 17 Sep 2016

@MATsxm That is strange, it looks like this for me:
lists

Can you try with error reporting enabled? Maybe there is some error hidden there.
And also check if the file /layouts/joomla/content/language.php is present. It should look like this: https://github.com/Bakual/joomla-cms/blob/no-lang-image/layouts/joomla/content/language.php

avatar MATsxm
MATsxm - comment - 17 Sep 2016

@Bakual
TBH, I suspect a problem while applying the patch.
I'll try on a new install later today.
Thanks


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/12051.

avatar Bakual
Bakual - comment - 17 Sep 2016

@andrepereiradasilva Yes, if this is merged, the Weblinks should be adjusted as well.
The contacts bug should be fixed now. I missed the helper function there.

As for the inconsistency, the thing is that the language code (en-GB) would look very ugly on that "home" button or in the menu because it is much longer. I've also used the same as is already been used in the association labels.
For the association tooltip I have settled for the language code because the SEF code is already present below the tooltip. Changing that to SEF doesn't make sense as it would be redundant information. We could completely remove it if we want.

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Sep 2016

As for the inconsistency, the thing is that the language code (en-GB) would look very ugly on that "home" button or in the menu because it is much longer. I've also used the same as is already been used in the association labels.

But if you have a sef 'de' and other 'de-ch' it would look even "uglier".
Also you used the language code in other places
image

I still think is more correct to have the language code than the SEF. The sef can be anything the user wants, the langauge code must respect iso.

For the association tooltip I have settled for the language code because the SEF code is already present below the tooltip. Changing that to SEF doesn't make sense as it would be redundant information. We could completely remove it if we want.

reggarding association tooltip an idea would be to improve it like we did in GSOC multilingual project. Example:
image

See https://github.com/joomla-projects/gsoc16_improved-multi-lingual/blob/staging/administrator/components/com_associations/helpers/associations.php#L498

that way you don't even need to use the language code or sef. in this case we could just add or not the flag if exists as you do in the language columns

avatar Bakual
Bakual - comment - 17 Sep 2016

In the module assignment I just went with the data that was available. ?
In the other places I think it makes more sense to use the same code like it is already used for associations. Or we have to change that as well. But I think the additional value is not worth it. To be honest, I think most sites will not have multiple "dialects" of the same language installed.

The suggestion for the association tooltip looks nice. However I'd use a popover there with the language as title. I'll have a look later.

avatar Bakual
Bakual - comment - 17 Sep 2016

@andrepereiradasilva What would you say if we do this:
popover

Would be the same with or without flag.

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Sep 2016

fine by me
but i would prefer the category in a new line something like

Category: xxxx

avatar jeckodevelopment
jeckodevelopment - comment - 17 Sep 2016

@Bakual why not using two lines?
Article (en-GB)
Category (en-GB)
and avoid also the double brackets

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Sep 2016

i would go for

language-name
------------------
article-title
Category: category-title

And i would also make that button/tooltip a layout that does not depend on the component helper ...

avatar Bakual
Bakual - comment - 17 Sep 2016

Good points ?

avatar infograf768
infograf768 - comment - 17 Sep 2016

Did not we say that it should not impact frontend?
I.e. again, I would not let a Content Language without an Image.

The way this is done, it does impact when one has chosen to display flags in frontend.
Example: took off the flag for Macedonian language:

screen shot 2016-09-17 at 18 26 06

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Sep 2016

yeah, i guess the language switcher module should also check if the image exists to avoid those.

avatar Bakual
Bakual - comment - 17 Sep 2016

From the intial PR description:

A note: This is strictly about backend. As far as I know in frontend the only place the flags are used is the language switcher module, and that one already has a switch to toggle between flags and text.

If you don't set a flag for a specific language I'm supposing you're not showing the flags in frontend at all. I don't think anyone wants to mix it in frontend.

avatar joomla-cms-bot joomla-cms-bot - change - 17 Sep 2016
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 17 Sep 2016
Category Administration Components Tags Modules Templates (admin) Administration Components Tags Language & Strings Modules Templates (admin)
avatar Bakual
Bakual - comment - 17 Sep 2016

And i would also make that button/tooltip a layout that does not depend on the component helper ...

It already uses a JLayout, but that one isn't done optimal. It expects the link/tooltip/text already present as a string saved in $item->link. The helper class is needed anyway to query the associated items data from the database.

Updated the PR to show a popover as the association tooltip:
tooltip

avatar infograf768
infograf768 - comment - 17 Sep 2016

If you don't set a flag for a specific language I'm supposing you're not showing the flags in frontend at all. I don't think anyone wants to mix it in frontend.

we should not suppose. we should make it easier for users. this pr also forces to refactor the lang switcher as no one would understand that opting to display flags may not...

this is exactly why i think this proposal is wrong. in back-end we should have a general parameter concerning all content languages, and still assign a flag/icon to each of them.

this pr would just add confusion.

avatar Bakual
Bakual - comment - 17 Sep 2016

in back-end we should have a general parameter concerning all content languages

That would only be possible as a parameter in the Joomla config (ridiculous) or as a template parameter (using overrides).

this pr would just add confusion.

Why? If you set the flag to "None", no flag is shown. Quite straight forward imho. And if you set a flag to "None", no flag is shown in frontend as well.
I can adjust the language switcher module to deal with that. It's easy. I would just need to know what it should show instead. For the dropdown I'd say just show the name of the language without any flag, but what should it show in the other mode where only flags are shown? The language name or a label with SEF code? Both alternatives imho look very wrong, that's why I didn't do anything there.

avatar andrepereiradasilva
andrepereiradasilva - comment - 17 Sep 2016

i agree with bakual on this.

I can adjust the language switcher module to deal with that. It's easy. I would just need to know what it should show instead. For the dropdown I'd say just show the name of the language without any flag

Yes. Makes sense.

but what should it show in the other mode where only flags are shown? The language name or a label with SEF code? Both alternatives imho look very wrong, that's why I didn't do anything there.

I would put a label. Yes it does not look good, but remember this is just a fallback.

avatar infograf768
infograf768 - comment - 18 Sep 2016

That would only be possible as a parameter in the Joomla config (ridiculous) or as a template parameter (using overrides).

The simple solution, as I had suggested, is a new option in com_languages.
Then that param would be fetched in the new layout.

avatar Bakual
Bakual - comment - 18 Sep 2016

The simple solution, as I had suggested, is a new option in com_languages.
Then that param would be fetched in the new layout.

As I said earlier, I will not do that as fetching params from another extension (com_languages) imho is a wrong thing to do. Even if it is already done today in the application, I don't think we should start doing that in every component. It just feels very wrong to me.

avatar mbabker
mbabker - comment - 18 Sep 2016

Architecturally, global configuration values should NOT be part of an extension of any type. These are global values and should be part of the global configuration. We should stop placing values which will affect global behavior at an extension level because it creates a bad understanding of the level of influence of the parameter (something I see in the global configuration will affect the entire site, something I see at an extension level only affects things interacting with that extension).

avatar infograf768
infograf768 - comment - 18 Sep 2016

it would not be a global config but a com_languages option, therefore indeed at extension level.

avatar mbabker
mbabker - comment - 18 Sep 2016

How is it a com_languages option if it affects behavior in the entire application stack!? It is not localized to that extension only.

avatar infograf768
infograf768 - comment - 19 Sep 2016

Ok, then let's make it an option in the back-end templates. Any Option there changes the display on the whole back-end (Colours for example). And showing icon/flags or Content Language Title Native (It should NOT be the Title) should be considered as a design choice...

You understand I still think that letting a Content Language having no image is what bothers me most.

avatar Bakual
Bakual - comment - 19 Sep 2016

The language switcher module now can take care of this change.
Dropdown:
dropdown
Inline:
inline

avatar Bakual
Bakual - comment - 19 Sep 2016

Ok, then let's make it an option in the back-end templates. Any Option there changes the display on the whole back-end (Colours for example). And showing icon/flags or Content Language Title Native (It should NOT be the Title) should be considered as a design choice...

I made that suggestion way back with my first PR and it was shot down, thus I went with this approach here...

You understand I still think that letting a Content Language having no image is what bothers me most.

No, I don't really understand what the issue is with that approach. It actually adds flexibility.

avatar andrepereiradasilva
andrepereiradasilva - comment - 19 Sep 2016

found some issues:

  • a minor js issue. When you select image as "None" and save. Then edit again and try to change it again to a flag. The flag preview is not there.
  • In modules menu assignments you use the langauge code, you use the SEF in all other views, so you should use the SEF here too.

image

As for the rest all seems to work fine.

avatar andrepereiradasilva
andrepereiradasilva - comment - 19 Sep 2016

also i think it's needed to add the same SEF fallback in recent 3.7.x merge #12042

avatar Bakual
Bakual - comment - 19 Sep 2016

@andrepereiradasilva Fixed the flag preview and using SEF in the module assignment. Had to add it to the MenusHelper first so I have it available in the layout.

avatar Bakual
Bakual - comment - 19 Sep 2016

also i think it's needed to add the same SEF fallback in recent 3.7.x merge #12042

Indeed. Should be easy to do. But changing this PR to be based on 3.7.x means I have to fix some conflicts first. I'd rather first know if it is going to be accepted or not.

avatar andrepereiradasilva andrepereiradasilva - test_item - 19 Sep 2016 - Tested successfully
avatar andrepereiradasilva
andrepereiradasilva - comment - 19 Sep 2016

I have tested this item successfully on 3127eda

Works as described.

Please don't forget to change also in 3.7.x branch and com_weblinks when/if this merged.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/12051.

avatar jeckodevelopment jeckodevelopment - change - 19 Sep 2016
Labels Added: ?
avatar Bakual
Bakual - comment - 19 Sep 2016

Rebased to 3.7.x and fixed the conflicts.

avatar infograf768
infograf768 - comment - 20 Sep 2016

?
What a great improvement! I suggest to change the strings in mod_languages.
I am sure you will like my proposal:

screen shot 2016-09-20 at 08 37 06


screen shot 2016-09-20 at 08 37 29

avatar Bakual
Bakual - comment - 20 Sep 2016

@infograf768 I think we all know by now that you don't like this proposal....
Also your strings are not correct. For the dropdown it would use the flag if available. There is no "These may not be flags" as it will just be omitted if no flag is selected for that language. For the other mode it doesn't take the native name as fallback, it takes the SEF code.
If you want to change the strings (which I don't think is necessary) just append "... if available".

avatar andrepereiradasilva
andrepereiradasilva - comment - 20 Sep 2016

issue on new feature on 3.7.x branch

image

avatar Bakual
Bakual - comment - 20 Sep 2016

Thanks for the reminder. Done now:
assoc

avatar infograf768
infograf768 - comment - 20 Sep 2016

I am sure you will like my proposal:

It was a joke, evidently. Just to show that this is not B/C.

avatar Bakual
Bakual - comment - 20 Sep 2016

Just to show that this is not B/C.

Sorry but that is just not true.
It is perfectly B/C as nothing changes during an update and even new installations behave exactly the same as today.
Only when the administrator actively edits the content language and removes the flag, then it will not show the flag anymore for that language. I'd say that is expected behavior and hasn't anything to do with B/C or not.

avatar andrepereiradasilva
andrepereiradasilva - comment - 20 Sep 2016

@Bakual 3.7.x as also a new modal: the menus modal
this needs to be taken care too

image

avatar Bakual
Bakual - comment - 20 Sep 2016

@andrepereiradasilva Good find. Done as well.

avatar andrepereiradasilva andrepereiradasilva - test_item - 20 Sep 2016 - Tested successfully
avatar andrepereiradasilva
andrepereiradasilva - comment - 20 Sep 2016

I have tested this item successfully on d250f24


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/12051.

avatar Gitjk
Gitjk - comment - 22 Sep 2016

Since that is not always an appropriate thing some expressed the wish to hide those flags...

I just can't imagine any case where a language flag is not appropriate. Can somebody enlighten me by giving an example for which this PR makes sense?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/12051.

avatar brianteeman
brianteeman - comment - 22 Sep 2016

Look up what language they speak in Quebec and you have your answer

avatar Bakual
Bakual - comment - 22 Sep 2016

I just can't imagine any case where a language flag is not appropriate. Can somebody enlighten me by giving an example for which this PR makes sense?

I found this page quite an interesting read: http://www.flagsarenotlanguages.com/blog/
Personal example: I live in Switzerland, a country where there are four (!) official languages. You just can't use the Swiss flag to represent any of the language spoken here.

avatar Gitjk
Gitjk - comment - 22 Sep 2016

Hmm, I've always looked at the flags as 'language flags', not 'country flags'! So it has always been fine for me to use the british flag for English language content (which is used by English speaking visitors of my site, including for example Britains and Americans, and the German flag for German language content. Site admins could use Quebec's flag if they wish to target citizens of Quebec only. But I doubt that many people associate their flag with French language content.

Link: Quebec's flag


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/12051.

avatar Bakual
Bakual - comment - 22 Sep 2016

Yeah, that is what is done today. But as said, some don't want that and in some cases (like Switzerland) it just doesn't work at all. That's why this PR wants to make the flags optional in backend as well (in frontend they are already).

avatar Gitjk
Gitjk - comment - 22 Sep 2016

Ok, I understand that some German speaking Swiss citizens prefer to display 'DE' instead of the German flag ?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/12051.

avatar brianteeman brianteeman - test_item - 9 Oct 2016 - Tested successfully
avatar brianteeman
brianteeman - comment - 9 Oct 2016

I have tested this item successfully on d250f24


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12051.

avatar brianteeman brianteeman - change - 9 Oct 2016
Status Pending Ready to Commit
Labels
avatar brianteeman
brianteeman - comment - 9 Oct 2016

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12051.

avatar joomla-cms-bot joomla-cms-bot - change - 9 Oct 2016
Labels Added: ?
avatar rdeutz rdeutz - change - 11 Oct 2016
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-10-11 19:46:04
Closed_By rdeutz
avatar rdeutz rdeutz - close - 11 Oct 2016
avatar rdeutz rdeutz - merge - 11 Oct 2016
avatar zero-24 zero-24 - close - 11 Oct 2016
avatar zero-24 zero-24 - close - 11 Oct 2016
avatar zero-24 zero-24 - change - 11 Oct 2016
Labels Removed: ? ?

Add a Comment

Login with GitHub to post a comment