0

Language condition for <If> tag, e.g. <If lang="en">


Avatar
Stefan

For multilingual websites, it would be extremely helpful to be able to use an tag to output different content depending on the language of the current page.

I think something similar to the following examples might work well:

<If lang="en">
<h1>Hello</h1>
</If>

<If lang="fr">
<h1>Bonjour</h1>
</If>

<If lang="de">
<h1>Hallo</h1>
</If>

A

Activity Newest / Oldest

Avatar

Tangible Plugins

Status changed to: Closed

Avatar

Tangible Plugins

Hi Stefan! Until WordPress itself implements a standardized multilingual that we can tap into, this type of syntax won't be a priority since it would rely on integrations with individual multilingual plugins. I'm sure we'll circle back to this once that's implemented into core WP.

Luckily, there are still ways of accomplishing this kind of thing with the existing plugin. If you want this setting to be user-specific, you could work with the locale field. This might look something like:

If user_field=locale value=fr_CA

You can find more info about this field here: docs.loopsandlogic.com/67/loop-user?category_id=45

Alternatively, if your multilingual plugin modifies the URL in some way to serve up content, you could work with that instead. That might be simple like this:

If route value="fr/*"

Or if you want a bit more control over which part of the route is being checked, you could write something like this:

If check="{Route part=1}" value="fr"

You can find more information about routes here: docs.loopsandlogic.com/78/route?category_id=58

As you can see, there are lots of ways that you can achieve this functionality with the existing plugin depending on how your multilingual plugin of choice works. Since native multilingual support is one of the next big priorities in the development of core WordPress, we'll wait until more information exists about their approach before we implement L&L features that relate to multilingual sites.