Skip to content

[4.2] Fix wrong installation language select default value#37252

Merged
laoneo merged 10 commits intojoomla:4.2-devfrom
bembelimen:4.2/installation-language-select
May 2, 2022
Merged

[4.2] Fix wrong installation language select default value#37252
laoneo merged 10 commits intojoomla:4.2-devfrom
bembelimen:4.2/installation-language-select

Conversation

@bembelimen
Copy link
Copy Markdown
Contributor

Summary of Changes

Fix the language select default value when installing a fresh Joomla!

Testing Instructions

  • Use a browser where "en" is not the default language
  • Start the installation process of Joomla!

Actual result BEFORE applying this Pull Request

Although the language is discovered correctly, the "English" is displayed as the selected language:

grafik

Expected result AFTER applying this Pull Request

Correct language is selected:

grafik

@brianteeman
Copy link
Copy Markdown
Contributor

woohoo!!

@brianteeman
Copy link
Copy Markdown
Contributor

Can we use the same technique to do something that @wilsonge and I talked about for the language installation step which is to display the current installation language as the default option

@bembelimen
Copy link
Copy Markdown
Contributor Author

Can we use the same technique to do something that @wilsonge and I talked about for the language installation step which is to display the current installation language as the default option

You mean, when I select de-DE, that this language pack is installed by default (when available) or is on top of the list?

@brianteeman
Copy link
Copy Markdown
Contributor

There are good reasons for it not to be installed by default. For example you are installing in german but the site is for a french client.

I just mean that german is either at the top of the list or it stays in the same position but it is preselected as the default in that list.

Hope that makes sense

@bembelimen
Copy link
Copy Markdown
Contributor Author

bembelimen commented Mar 12, 2022

This method is not needed, to pre-select the installation language, we can just use the value of the dropdown:

$model   = new SetupModel;
$options = $model->getOptions();

print_r($options['language']);

Then we just have to sort it up here based on this value.

@brianteeman
Copy link
Copy Markdown
Contributor

To be honest I never really looked to see how to do it. Something I can work on tomorrow

@richard67
Copy link
Copy Markdown
Member

Unrelated to this PR, but I've seen it when testing: Have you noticed that there are 2 entries "English (United Kingdom)" in the language selection? One of them should be "English (New Zealand)", but that's only clear when checking the HTML:

j4 2-test-pr-37252_before_2

Is this a known issue and already reported somewhere?

@richard67
Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on cd2e2db

Works for me. However I'm not sure yet if the failing drone could be related.


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

@brianteeman
Copy link
Copy Markdown
Contributor

no its a bug. If you look at the xml

<name>English (United Kingdom)</name>
<version>4.1.0</version>
<creationDate>February 2022</creationDate>
<author>Joomla! Project</author>
<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<files>
<filename>joomla.ini</filename>
</files>
<metadata>
<name>English (en-NZ)</name>
<nativeName>English (United Kingdom)</nativeName>

@richard67
Copy link
Copy Markdown
Member

no its a bug. If you look at the xml

@brianteeman Do you know if this has to be fixed here in the repo or on Crowdin?

@richard67
Copy link
Copy Markdown
Member

@bembelimen Drone failing again at the API tests at the installation step. Last time it was the system test at the same place, and the time before again the API test. Always at the installation after having selected the language. It seems it is not always failing, but often. Maybe the tests need a little adjustment?

@brianteeman
Copy link
Copy Markdown
Contributor

no its a bug. If you look at the xml

@brianteeman Do you know if this has to be fixed here in the repo or on Crowdin?

sorry dont know

@richard67
Copy link
Copy Markdown
Member

no its a bug. If you look at the xml

@brianteeman Do you know if this has to be fixed here in the repo or on Crowdin?

sorry dont know

I've proposed the fix on Crowdin.

@brianteeman
Copy link
Copy Markdown
Contributor

This is almost perfect but not quite - the problem is when the browser has both a language option and a language+country variant as for example in german

image

If you have one of the variants as your default browser language and joomla has that variant then it works perfectly

image

image

if you have one of the variants as your default browser language and joomla does not have any variants then it works perfectly

image

image

The problem is if you have one of the pure languages which joomla obviously does not have
OR if you have one of the variants and joomla has variants but not that one.

In this case Joomla offers you the last variant in the list
image

image

image

image

Is this solvable? I suspect its not and I am only reporting this just in case. It is definitely better than it was before this pr

@infograf768
Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on cd2e2db


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

@richard67
Copy link
Copy Markdown
Member

@bembelimen I'd set RTC now as it has 2 tests, but there is still the drone failure of which I'm not sure if it is related.

@laoneo laoneo removed the PR-4.2-dev label Mar 20, 2022
@laoneo
Copy link
Copy Markdown
Member

laoneo commented Mar 20, 2022

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Mar 20, 2022
@richard67
Copy link
Copy Markdown
Member

@laoneo Hmm, we still have the constantly failing installation in drone, due to which I was told I should not set RTC.

When @roland-d would do an update of the 4.2-dev branch to the current 4.1-dev branch (so-called "upmerge"), we could see if the fix in the installation language file for the duplicate "English (United Kingdom)" will help with the tests so it's clear they do not fail due to this PR (and beside that would help me with rebasing some other PRs from 4.1-dev to 4.2-dev).

@laoneo
Copy link
Copy Markdown
Member

laoneo commented Mar 20, 2022

Ok, restarted drone and it fails again. So time to remove RTC again.

@richard67
Copy link
Copy Markdown
Member

Back to pending.


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

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Mar 20, 2022
@roland-d
Copy link
Copy Markdown
Contributor

@richard67 Upmerge done

@richard67
Copy link
Copy Markdown
Member

@roland-d Thanks. Will update the branch of this PR here now.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Apr 14, 2022
@brianteeman
Copy link
Copy Markdown
Contributor

RTC but with an unanswered bug ? #37252 (comment)

@bembelimen
Copy link
Copy Markdown
Contributor Author

bembelimen commented Apr 14, 2022

That bug already exists in 3.x (and should be fixed for sure) but is not related to this PR.
As Joomla! looks only in the first two characters (de-DE => de) or some browser only send the first two characters (de) it takes the first "de" entry from the list. And as de-AT < de-DE it's not the Germany German one which is selected.

@brianteeman
Copy link
Copy Markdown
Contributor

That bug already exists in 3.x (and should be fixed for sure) but is not related to this PR

But prior to this PR the language is never preselected.

@roland-d
Copy link
Copy Markdown
Contributor

@bembelimen

As Joomla! looks only in the first two characters (de-DE => de) or some browser only send the first two characters (de) it takes the first "de" entry from the list.

Where is this done?

@bembelimen
Copy link
Copy Markdown
Contributor Author

That bug already exists in 3.x (and should be fixed for sure) but is not related to this PR

But prior to this PR the language is never preselected.

In 3.x it is, it was broken in 4.0 (which is fixed with this PR again) but the old behaviour is not improved.

@brianteeman
Copy link
Copy Markdown
Contributor

Ok

@bembelimen
Copy link
Copy Markdown
Contributor Author

@bembelimen

As Joomla! looks only in the first two characters (de-DE => de) or some browser only send the first two characters (de) it takes the first "de" entry from the list.

Where is this done?

$primary_browserLang = substr($browserLang, 0, 2);

roland-d added a commit to roland-d/joomla-cms that referenced this pull request Apr 16, 2022
Signed-off-by: Roland Dalmulder <contact@rolandd.com>
@laoneo
Copy link
Copy Markdown
Member

laoneo commented Apr 22, 2022

Is the change in the composer lock file correct?

@roland-d roland-d removed the RTC This Pull Request is Ready To Commit label Apr 23, 2022
@roland-d
Copy link
Copy Markdown
Contributor

Removed RTC as the pull request is still pending.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Apr 23, 2022
@Hackwar
Copy link
Copy Markdown
Member

Hackwar commented Apr 23, 2022

Yes, the change in composer lock is correct. That pulls the updated Joomla Browser version, which fixes the issue we had with the tests.

@laoneo
Copy link
Copy Markdown
Member

laoneo commented Apr 24, 2022

Then this needs to be fixed, before it can be merged.

@Hackwar
Copy link
Copy Markdown
Member

Hackwar commented Apr 24, 2022

What needs to be fixed?

@laoneo
Copy link
Copy Markdown
Member

laoneo commented Apr 24, 2022

The conflict

@roland-d roland-d removed the RTC This Pull Request is Ready To Commit label Apr 26, 2022
@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Apr 30, 2022
@richard67
Copy link
Copy Markdown
Member

I've solved the conflicting composer.lock file. The version from this PR was the right one because newer than the one from #37565 .

RTC is still ok, it doesn't need new human tests as all changes after these were only for the automated tests (Joomla browser update) and clean branch updates.

@laoneo laoneo merged commit c00ddcc into joomla:4.2-dev May 2, 2022
@laoneo
Copy link
Copy Markdown
Member

laoneo commented May 2, 2022

Thanks!

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label May 2, 2022
@laoneo laoneo added this to the Joomla 4.2.0 milestone May 2, 2022
@bembelimen bembelimen deleted the 4.2/installation-language-select branch March 15, 2024 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants