Advertisement
Problem with default language in Joomla\CMS\Language\Text Topic is solved
Moderators: ooffick, General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sun Mar 23, 2025 11:02 pm
Problem with default language in Joomla\CMS\Language\Text
I am developing a component for joomla 5 for a site with three languages ru-RU zh-CN en-GB. The component is 100% translated into ru-RU.
I want the translation at the beginning to check the current language of the user, and if the translation is not found, then take ru-RU.
Now, if there is no translation zh-CN, it takes the translation en-GB.
I suspect that the problem is in the default at Text:
object(Joomla\CMS\Language\Language)#699 (23) {
["debug":protected]=
bool(false)
["default":protected]=
string(5) "en-GB"
...}
However, I was never able to change this parameter through the admin. Site language, admin language and plugin language are defaulted to ru-RU. What am I missing ?
Translated with *** URL Removed *** (free version)
I want the translation at the beginning to check the current language of the user, and if the translation is not found, then take ru-RU.
Now, if there is no translation zh-CN, it takes the translation en-GB.
I suspect that the problem is in the default at Text:
object(Joomla\CMS\Language\Language)#699 (23) {
["debug":protected]=
bool(false)
["default":protected]=
string(5) "en-GB"
...}
However, I was never able to change this parameter through the admin. Site language, admin language and plugin language are defaulted to ru-RU. What am I missing ?
Translated with *** URL Removed *** (free version)
Last edited by imanickam on Mon Mar 24, 2025 3:49 am, edited 1 time in total.
Reason: Removed the URL that showed a translation site. Please do not repeat this in the future. Moved the topic from the forum Language - Joomla! 5.x to the forum Joomla! 5.x Coding.
Reason: Removed the URL that showed a translation site. Please do not repeat this in the future. Moved the topic from the forum Language - Joomla! 5.x to the forum Joomla! 5.x Coding.
Advertisement
- ceford
- Joomla! Virtuoso
- Posts: 3155
- Joined: Mon Feb 24, 2014 10:38 pm
- Location: Edinburgh, Scotland
- Contact:
Re: Problem with default language in Joomla\CMS\Language\Text
Just a thought: go to System / Content Languages. What order are the languages in? Might a change of order give you what you want?
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sun Mar 23, 2025 11:02 pm
Re: Problem with default language in Joomla\CMS\Language\Text
Hello, unfortunately your idea didn't work for me.
I can always write my own wrapper for the class, but I would still like to make my own idea using the available methods (if there are any).
- Webdongle
- Joomla! Master
- Posts: 45097
- Joined: Sat Apr 05, 2008 9:58 pm
Re: Problem with default language in Joomla\CMS\Language\Text
A few thoughts
Default language of your browser?
Default menu items?
Default language of your browser?
Default menu items?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sun Mar 23, 2025 11:02 pm
- Webdongle
- Joomla! Master
- Posts: 45097
- Joined: Sat Apr 05, 2008 9:58 pm
Re: Problem with default language in Joomla\CMS\Language\Text
Hmmm
With multi lingual sites should there be no general Home menu item, just one for each language?
With multi lingual sites should there be no general Home menu item, just one for each language?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
-
- Joomla! Virtuoso
- Posts: 3207
- Joined: Fri Jul 05, 2013 10:35 am
- Location: Parts Unknown
Re: Problem with default language in Joomla\CMS\Language\Text
en-GB is the default language of the CMS as a whole. It comes with en-GB language pack which can't be uninstalled. If a language file for current language doesn't exist, it falls back to en-GB. This is the intended behavior for the time being.
Since 5.0, intentionally or not, it is possible to change the default language using Joomla\Language\Language::setDefault() (technically it was always possible by extending Joomla\CMS\Language\Language). But doing this on the global language instance is not recommended. You should create a new instance and load the files however you want.
Since 5.0, intentionally or not, it is possible to change the default language using Joomla\Language\Language::setDefault() (technically it was always possible by extending Joomla\CMS\Language\Language). But doing this on the global language instance is not recommended. You should create a new instance and load the files however you want.
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sun Mar 23, 2025 11:02 pm
Re: Problem with default language in Joomla\CMS\Language\Text
Many thanks for the quick reply.SharkyKZ wrote: ↑Tue Mar 25, 2025 9:47 am en-GB is the default language of the CMS as a whole. It comes with en-GB language pack which can't be uninstalled. If a language file for current language doesn't exist, it falls back to en-GB. This is the intended behavior for the time being.
Since 5.0, intentionally or not, it is possible to change the default language using Joomla\Language\Language::setDefault() (technically it was always possible by extending Joomla\CMS\Language\Language). But doing this on the global language instance is not recommended. You should create a new instance and load the files however you want.
Advertisement