How to override frontend language by url parameter?
Moderators: ooffick, General Support Moderators
Forum rules
-
- Joomla! Enthusiast
- Posts: 117
- Joined: Tue Jun 03, 2014 3:37 pm
How to override frontend language by url parameter?
Hi all!
I am creating a component, which is creating a raw output in frontend.
Translating texts by choosing the frontend language works fine.
Now I want to be able to override the admins language setting by adding 'lang=xx-XX' to the URL.
How can I make Joomla use that language code for translating texts instead of the one configured by the admin?
Important: All texts need to be translated using the language code from the URL, not just the texts in my component's code.
Thank you very much in advance for any useful hint!
Kind regards,
Gerald
I am creating a component, which is creating a raw output in frontend.
Translating texts by choosing the frontend language works fine.
Now I want to be able to override the admins language setting by adding 'lang=xx-XX' to the URL.
How can I make Joomla use that language code for translating texts instead of the one configured by the admin?
Important: All texts need to be translated using the language code from the URL, not just the texts in my component's code.
Thank you very much in advance for any useful hint!
Kind regards,
Gerald
- Per Yngve Berg
- Joomla! Master
- Posts: 30930
- Joined: Mon Oct 27, 2008 9:27 pm
- Location: Romerike, Norway
Re: How to override frontend language by url parameter?
The user select in it's profile what language shall be used in administrator or select when loggin in.
-
- Joomla! Enthusiast
- Posts: 117
- Joined: Tue Jun 03, 2014 3:37 pm
Re: How to override frontend language by url parameter?
Hi!
Thank you for your reply.
I meant following:
Using such a URL call ...
... Joomla should use the xx-XX translation files instead of the language configured by the admin or the frontend user.
How can I achieve that?
Thank you for your reply.
I meant following:
Using such a URL call ...
Code: Select all
https://mydomain.com/index.php/option=com_mycomponent&view=myview&format=raw&lang=xx-XX
How can I achieve that?
-
- Joomla! Enthusiast
- Posts: 117
- Joined: Tue Jun 03, 2014 3:37 pm
-
- Joomla! Hero
- Posts: 2906
- Joined: Fri Jul 05, 2013 10:35 am
- Location: Parts Unknown
Re: How to override frontend language by url parameter?
Not possible out of the box. You'd need to write a plugin.
-
- Joomla! Enthusiast
- Posts: 117
- Joined: Tue Jun 03, 2014 3:37 pm
Re: How to override frontend language by url parameter?
Hi!
Thank you for that hint.
How could I override the frontend language by url parameter using an own plugin?
Kind regards,
Gerald
Thank you for that hint.
How could I override the frontend language by url parameter using an own plugin?
Kind regards,
Gerald
-
- I've been banned!
- Posts: 13639
- Joined: Sun Jul 05, 2009 3:30 am
- Location: Canberra, Australia
Re: How to override frontend language by url parameter?
My suggestion is to purchase a book on writing plugins for Joomla. The best resource, that I'm aware of, for writing J! plugins is Programming Joomla! Plugins by Jisse Reitsma, Yireo Education, 2014 (if you can still find a copy in print). Good luck with that.
Alternatively you might be able to find a freelance software developer to write a plugin for you.
Alternatively you might be able to find a freelance software developer to write a plugin for you.
-
- Joomla! Enthusiast
- Posts: 117
- Joined: Tue Jun 03, 2014 3:37 pm
Re: How to override frontend language by url parameter?
Hello!
Thank you for your hints, too.
As my requests seem to have led to misunderstandings, I try to clear up / consolidate:
Originally I asked for a hint how to achieve the goal described in the initial post of this thread using native Joomla functions.
Then I was told by SharkyKZ, that Joomla does not provide with such a function natively and that I would have need to write a plugin for that purpose.
As it might be noticable in my posts I do know how to write Joomla extensions (including plugins) and I am actually willing to do that.
All I am trying to find out is:
Which lever do I have to move in Joomla (using a plugin) to enable the system to override the frontend language by using an URL parameter in a component call?
I would be very grateful for any help in finding that "lever".
Thank you all very much in advance!
Kind regards,
Gerald
Thank you for your hints, too.
As my requests seem to have led to misunderstandings, I try to clear up / consolidate:
Originally I asked for a hint how to achieve the goal described in the initial post of this thread using native Joomla functions.
Then I was told by SharkyKZ, that Joomla does not provide with such a function natively and that I would have need to write a plugin for that purpose.
As it might be noticable in my posts I do know how to write Joomla extensions (including plugins) and I am actually willing to do that.
All I am trying to find out is:
Which lever do I have to move in Joomla (using a plugin) to enable the system to override the frontend language by using an URL parameter in a component call?
I would be very grateful for any help in finding that "lever".
Thank you all very much in advance!
Kind regards,
Gerald
-
- Joomla! Enthusiast
- Posts: 117
- Joined: Tue Jun 03, 2014 3:37 pm
Re: How to override frontend language by url parameter?
Your help still is very much appreciated