Widgets based on choosen language?

Sperber

Well-known member
Is anyone aware of an addon, that does that?

I´m building an international forum, where I want to switch sideblocks for new posts and threads etc. when a user changes the language. Guess this can be done by conditionals, but - coming from XF 1 - I´m playing around with XF 2 now for just a few days. Anyone seen something like that?
 
Should be pretty simple, create your language specific widgets, do not give them a position.

Give them a unique "Widgey key" name like:
englishwidget
spanishwidget

Then create a HTML widget, give it the position you want these language-specific widgets to display.

Check "Advanced Mode" to remove the wrapper

This would be the content:

<xf:if is="$xf.visitor.language_id == '1'">
<xf:widget key="englishwidget" />
<xf:elseif is="$xf.visitor.language_id == '2'" />
<xf:widget key="spanishwidget" />
</xf:if>

1 in this example is the ID for the English language, 2 being ID for the Spanish language. You can find the ID by editing the language and looking at the URL:

admin.php?languages/english-us.1/edit

admin.php?languages/spanish.2/edit

In my case English = 1
Spanish = 2

Hope that helps...
 
Back
Top Bottom