OK, it is done and seems to be working now. I set a test on your Website, so you can check it out - it's only visible for Webmasters, so don't worry about other people seeing it. It works for Dutch language, but in English the empty space is not visible anymore. Now, how it was done? Let's assume that you had as a starting point this link Title in MyMenus:
[nl]Dutch link[/nl][en]English link[/en]
And then decided that you want only a menu for the Dutch users. So you would remove the English part and leave like this:
[nl]Dutch link[/nl]
That would show fine in Dutch, but in English, XOOPS was still rendering the menu structure, it was just leaving it empty, because xLanguage didn't have anything for English. I was going to check for an empty string in the Link Title because I assumed the in English it will be empty. But the problem was that xLanguage kicks in at the browser level, so at the code level the value of the Title was still something like:
[nl]Dutch link[/nl]
i.e. it was not empty. I was thinking that I'll need to somehow get to xLanguage and test the value of the link against the language, but Bleekk suggested to test it at the Smarty level, and it was the right suggestion
What XOOPS has is a Smarty variable
<{$xoops_langcode}>
which shows the code of the
current language. So if I am in English, the value would be "en", and it Dutch "nl" So what I did was to test for that value of the current language in the link Title, and if the value was there (for example, for Dutch it would be "[nl]"), I would let MyMenus render the menu, otherwise it would stay empty. So in the Smarty template I've added this check:
<{assign var=myStr value="["|cat:$xoops_langcode|cat:"]"}>
<{if $menu.title|strstr:$myStr}>
1) Basically we create a string "myStr" with the language tag for the current language, so for Dutch it would be [nl] 2) Then we check if this language tag is in the link's Title. Assuming that the Title is:
[nl]Dutch link[/nl]
it will show the link only when we have selected Dutch as the current language It is actually a pretty simple solution that will work for any language. I'll add it to the SVN, so the next release of MyMenus will have this feature as a standard
Once again thanks to Bleekk who redirected my thinking to a Smarty solution, which in the end was much simpler than what I was considering in the first place