[solved] Skin Expressions: Localized or empty string in iif-expression (1 Viewer)

bta489

Portal Pro
March 17, 2013
168
92
Home Country
Germany Germany
I'm trying to modify the Apollo-Skin. In the original skin some words are harcoded in plain english and I want to replace them with the localized version. But one inside an iif - Expression isn't cooperating. The line in question is something like this (I removed the working parts for clarity):
XML:
<label>#(iif(eq(#TVSeries.Episode.AvailableSubtitles,'1'),' | #(L(293))',''))</label>
This should, if subtitles are available, add the separator and the localized string "Subtitles" (string-ID 293). If no subtitles are available this string should be empty. But this only displays ' | #(L(293))'.

I had some success to display the correct string by enclosing the entire iif-Expression with the translation-Expression. But then if the iif-statement returns false instead of an empty string an error message is displayed in the label.
 

bta489

Portal Pro
March 17, 2013
168
92
Home Country
Germany Germany
For future reference, I'll solve my own problem... Only 5 years later :)

It seems the correct notation inside those functions is without the #(), so just L(293) should do the trick for just a string and no additional characters.
For additional characters use the string.format function. So for the example above:
XML:
<label>#(iif(eq(#TVSeries.Episode.AvailableSubtitles,'1'),string.format('| {0}',L(293)),''))</label>
 

Users who are viewing this thread

Top Bottom