Search
Other Snippets questions
Forum

Detect the language and return the corresponding snippet

Denis Poirel's Avatar Denis Poirel
Hello,

I'm using your great Snippet component and I'd like to have your opinion.
I need to set up a site in several languages. My idea is to prepare snippets that will be used in articles. Is it possible to automatically display the snippet corresponding to the language chosen by the visitor and how to manage the detection of the chosen language?

Thank you in advance
Denis
Peter van Westen's Avatar Peter van Westen ADMIN
You can make multiple snippet, each for a specific language. Then in the content, use the snippet that corresponds with that language, like:
{snippet alias="my-snippet-en"}
{snippet alias="my-snippet-de"}
etc...

If you want to use the same snippet tag for all articles, like:
{snippet alias="my-snippet"}
Then you would have to use php (through Sourcerer) to check the language, and output the content you want based on the language. Either directly in that snippet, or include the other language based snippets.

Another option would be to use ReReplacer Pro to replace a placeholder (like [MY-MULTILINGUAL-SNIPPET]) with a different {snippet} tag for every language.
Please post a rating at the Joomla! Extensions Directory
Denis Poirel's Avatar Denis Poirel
Good evening and thank you for your reply.
I'm going to do my tests.
Congratulations again on your work!
Denis
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription