Skip to content

[4.0] Set default Site and Admin languages in installer#28328

Merged
wilsonge merged 20 commits intojoomla:4.0-devfrom
astridx:defaultlanguage
Mar 15, 2020
Merged

[4.0] Set default Site and Admin languages in installer#28328
wilsonge merged 20 commits intojoomla:4.0-devfrom
astridx:defaultlanguage

Conversation

@astridx
Copy link
Copy Markdown
Contributor

@astridx astridx commented Mar 12, 2020

Alternative Pull Request for Draft #27951.

Summary of Changes

Adding back the ability to set Site and Admin languages in the installer.

Testing Instructions

  1. Apply this patch. You do not need to run npm ci or composer i.
  2. Start a new installation.
  3. Install an extra language
  4. Make sure, that can set default frontend language and default administrator language, after you had installed the extra language.
    Joomla Installer
  5. Change the default language for the backend and frontend and make sure that the languages are used correctly.

Expected result

People who don't speak English as a native language are able to set the admin default language before they start to configure things.

Actual result

It is not possible to set a default language during installation.

Documentation Changes Required

Not sure.

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-4.0-dev labels Mar 12, 2020
@infograf768
Copy link
Copy Markdown
Member

Good job! 👍

TODO

  1. Delete from LanguagesModel the now useless code to create a basic multilingual site as we now do it only via the sampledata plugin.
    This means deleting all from line 565 to 1487

  2. Delete from InstallationController
    lines 195 to 204 as we do not use anymore the publishContentLanguages() method

NOTE:
If we want to keep such a method, it should only check for the correct creation of the content language and NOT for its published state. Thus would have to be renamed and string re-added.

  1. Delete the ini strings in en-GB and en-US
    INSTL_DEFAULTLANGUAGE_ACTIVATE_MULTILANGUAGE="Activate the multilingual feature"
    INSTL_DEFAULTLANGUAGE_ACTIVATE_MULTILANGUAGE_DESC="If active, your Joomla site will have the multilingual feature active with localised menus for each installed language."
    INSTL_DEFAULTLANGUAGE_ACTIVATE_LANGUAGE_CODE_PLUGIN="Enable the language code plugin"
    INSTL_DEFAULTLANGUAGE_ACTIVATE_LANGUAGE_CODE_PLUGIN_DESC="If enabled, the language code plugin will add the ability to change the language code in the generated HTML document to improve SEO."
    INSTL_DEFAULTLANGUAGE_COULD_NOT_ADD_ASSOCIATIONS="Joomla was unable to automatically create the language associations."
    INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_CONTENT_LANGUAGE="Joomla was unable to automatically create the %s content language."
    INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU="Joomla was unable to automatically create the %s menu."
    INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_ITEM="Joomla was unable to automatically create the %s home menu item."
    INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_MODULE="Joomla was unable to automatically create the %s menu module."
    INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_CATEGORY="Joomla was unable to automatically create the %s content category."
    INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_ARTICLE="Joomla was unable to automatically create the %s localised article."
    INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_MODULESWHITCHER_LANGUAGECODE="Joomla was unable to automatically publish the language switcher module."
    INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_PLG_LANGUAGECODE="Joomla was unable to automatically enable the Language Code Plugin."
    INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_PLG_LANGUAGEFILTER="Joomla was unable to automatically enable the Language Filter Plugin."
    INSTL_DEFAULTLANGUAGE_MULTILANGUAGE_TITLE="Multilingual"
    INSTL_DEFAULTLANGUAGE_MULTILANGUAGE_DESC="This section allows you to automatically activate the Joomla multilingual feature."
    INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_MULTILANG="Joomla was unable to install the multilingual sample data as only one language is installed. To activate the multilingual feature, you need to install more languages, press the 'Previous' button and choose the desired languages from the list."
    INSTL_DEFAULTLANGUAGE_COULD_NOT_PUBLISH_MOD_MULTILANGSTATUS="Joomla was unable to automatically publish the language status module."
    INSTL_DEFAULTLANGUAGE_COULD_NOT_UNPUBLISH_MOD_DEFAULTMENU="Joomla was unable to automatically unpublish the default menu module."
    INSTL_DEFAULTLANGUAGE_INSTALL_LOCALISED_CONTENT="Install localised content"
    INSTL_DEFAULTLANGUAGE_INSTALL_LOCALISED_CONTENT_DESC="If active, Joomla will automatically create one content category per each installed language. Also, one featured article with dummy content will be created in each category."

  2. Normalize en-US for the strings modified

  3. Important! Make sure that for a distro which is including already another language than en-GB and therefore that language not needing to be installed, that the list of languages to install does not contain it and that it is presented as possible choice for admin and site default.


$this->installed_languages = new \stdClass;
$this->installed_languages->administrator = $this->get('InstalledlangsAdministrator', 'Languages');
$this->installed_languages->frontend = $this->get('InstalledlangsAdministrator', 'Languages');
Copy link
Copy Markdown
Member

@infograf768 infograf768 Mar 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird. It works but should not it be get('InstalledlangsFrontend' ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorrry, I did not see this comment.
The get is set here:

$method = 'get' . ucfirst($property);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curiously, I tested with that modification and it worked also fine...

@astridx
Copy link
Copy Markdown
Contributor Author

astridx commented Mar 14, 2020

@infograf768
1. Delete from LanguagesModel the now useless code to create a basic multilingual site as we now do it only via the sampledata plugin.
This means deleting all from line 565 to 1487

Thank you for your improvements. This is done.

@infograf768
2. Delete from InstallationController
lines 195 to 204 as we do not use anymore the publishContentLanguages() method
NOTE:
If we want to keep such a method, it should only check for the correct creation of the content language and NOT for its published state. Thus would have to be renamed and string re-added.

I deleted these lines because you suggested that. The languages are now unpublished as content languages installed. Is that how it should be?

@infograf768
1. Delete the ini strings in en-GB and en-US
INSTL_DEFAULTLANGUAGE_ACTIVATE_MULTILANGUAGE="Activate the multilingual feature"

Done.

@infograf768
2. Normalize en-US for the strings modified

Done.

@infograf768
Important! Make sure that for a distro which is including already another language
than en-GB and therefore that language not needing to be installed, that the list of languages
to install does not contain it and that it is presented as possible choice for admin and site default.

Since the languages are installed at this point in the installation, that fits. I honestly admit that I haven't tested it.
@tecpromotion Is it possible to test this with the German version?

@infograf768
Copy link
Copy Markdown
Member

I deleted these lines because you suggested that. The languages are now unpublished as content languages installed. Is that how it should be?

Yes, it should behave as when we install languages in backend, i.e. the content languages should be created but not be published.
I was not sure ( @Bakual ?) if we should still make sure the Content languages are created, thus my note above.

@Bakual
Copy link
Copy Markdown
Contributor

Bakual commented Mar 14, 2020

I would certainly create the content language. I don't mind if they are published or not.

@astridx
Copy link
Copy Markdown
Contributor Author

astridx commented Mar 14, 2020

@infograf768 Yes, it should behave as when we install languages in backend, i.e. the content languages should be created but not be published.

This is how it is in this issue at the moment. Then that fits.

@infograf768
Copy link
Copy Markdown
Member

If I do not mistake, this PR contains an extraneous file which is a copy of your config.php

@astridx
Copy link
Copy Markdown
Contributor Author

astridx commented Mar 14, 2020

@infograf768 If I do not mistake, this PR contains an extraneous file which is a copy of your config.php

Thanks. I deleted this wrong file.

@richard67
Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on cd44169

Works like a charm.


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

@richard67
Copy link
Copy Markdown
Member

I have not tested this item.

I just saw now the review comment from @infograf768 😄
https://github.com/joomla/joomla-cms/pull/28328/files#r392090741.
@astridx Could you check?


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

@astridx
Copy link
Copy Markdown
Contributor Author

astridx commented Mar 15, 2020

@richard67 @astridx Could you check?

Thanks Richard. I answered it.

@infograf768
Copy link
Copy Markdown
Member

@astridx
see my further comment
#28328 (comment)

both work here...

@infograf768
Copy link
Copy Markdown
Member

@astridx
Please modify to use InstalledlangsFrontend

The reason is that we do not see an error because the packs we test contain both admin and site parts, but we may have lang packs which contain only the site part, thus why the method/property should correspond precisely.

@astridx
Copy link
Copy Markdown
Contributor Author

astridx commented Mar 15, 2020

@infograf768
Sorry, you are right. Done

@infograf768
Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on b216ae2


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

@richard67
Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on b216ae2

I've played around a bit, using skip button, installing a language and setting defaults and then again installing another one and changing default ... all works as one would expect it to work.

Well done.


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

@richard67
Copy link
Copy Markdown
Member

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Mar 15, 2020
@wilsonge wilsonge merged commit b475126 into joomla:4.0-dev Mar 15, 2020
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Mar 15, 2020
@wilsonge
Copy link
Copy Markdown
Contributor

Thankyou very much for picking this up @astridx ! Super appreciated and nice work!

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.

6 participants