-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[imp] Implement Backend Language Switcher #9126
Conversation
* @return void | ||
*/ | ||
public function switchAdminLanguage() | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you allow a param in this function ($languageId) then we can use it in a module lang switcher.
Also a check
if (isset($languageId))
{
JFactory::getApplication()->setUserState('application.lang', $languageId);
}
else
{
$cid = $this->input->get('cid', '');
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean we "could" use it, right?
Do you want to add one to core or would that just be to let a 3rd party create one?
Also, I would rather, if @joomla/cms-maintainers agree with your proposal, use $languageTag as it is not an id which is for $whatever in
`JFactory::getApplication()->setUserState('application.lang', $whatever)'
but the language tag, i.e fr-FR, en-GB, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup!
I find this an essential addition for backend users with multilingual sites. Right now I need to install 3PD extension for this really basic functionality.
Figuring out the variable type by reading the code is hard but yes $languageTag seems more appropriate! (I thought $cid was referring to a number)
@infograf768 for usability how about reordering the buttons, first the ones related with options selected, them the general ones (not related to the options selected). Also what to do you think of instead "Switch Backend Language" having "Switch to Language". Since the button only appear on the admin languages, IMHO probably makes more sense. In other words: instead of: Default | Install Languages | Switch Backend Language this: Default | Switch to Language | Install Languages |
@andrepereiradasilva |
I have tested this item ✅ successfully on dbd6920 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9126. |
I have tested this item ✅ successfully on dbd6920 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9126. |
At this point - works as described.
|
For consistency I think that this should be referred to as Administrator Language and not Backend Language This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9126. |
This PR has received new commits. CC: @MATsxm, @richard67 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9126. |
I have modified the language strings as well as the order of the buttons. @MATsxm The button will behave the same way as the "Default" button which also displays when only one language is installed. @andrepereiradasilva I guess that Switch Language does not need the "to". Please test again @dgt41 |
I have tested this item ✅ successfully on 295bf8c This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9126. |
I have tested this item ✅ successfully on 295bf8c This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9126. |
rtc. thanks for feedback and testing. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9126. |
This PR has received new commits. CC: @MATsxm, @richard67 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9126. |
Folks, I will ask you to test again, sorry. |
I have tested this item ✅ successfully on 49595b0 @infograf768 What last screenshot does not show (because I think you switched from English to English) is that the success message is in the language from before switching, as your first screenshot in the test description shows (switched from English to Italian: Title "Messagio" in Italian but message content in English. I guess we cannot change this in an easy way, otherwise you would have done it, right? Or is it by purpose? I also assume that there is no other easy way to get the language full name so you have to parse the XML file, right? Or could it maybe be obtained from the language lists's 1st column, e.g. with jQuery? Anyway, for me it is good enough as it is now, and I hope it will go into 3.5.0 Beta 3 or RC. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9126. |
I have tested this item ✅ successfully on 49595b0 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9126. |
Same issue when the user is set to Default Language and another language is set to default. The content of the message is picked from the former language. No idea how to solve this. If it is possible this should be another PR imho. I did parse the xx-XX.xml file indeed. Easy enough. code is
|
@infograf768 Thanks for the info, I just was curious. For me it is fine now as it is. |
i think you could also use |
@richard67 @infograf768 isnt the message always in english right now because it is a new language string that doesnt exist in the other languages so en-gb is always used as a fallback This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9126. |
I have tested this item ✅ successfully on 49595b0 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9126. |
@brianteeman Ahhhh, sure, you are right. Silly me! |
It is deprecated. |
Works as intended for me. Thanks JM |
[imp] Implement Backend Language Switcher
@infograf768 Thanks a lot for this great new feature. It helps a lot with testing (multi) language stuff in backend. I think it is worth to be mentioned in the new features of the release notes with an own head line. |
BTW:
Nope. As I stated above #9126 (comment) the message is in the former language. It is the same as Default change as you can test by setting an admin language to Default when logged with a user set to use Default language. |
I have a solution for that. Will make a new PR for both Default and Switch. |
This PR adds a new Toolbar Button to let admin switch the Backend Language to any language.
It replaces #9119 which was only letting switch to the Default Admin Language.
The purpose of the PR is to facilitate the work of devs, translators and admins in general.
After PR, one will get:
@richard67 @andrepereiradasilva @Kubik-Rubik
Thanks for testing.