This really looks like it ought to work, but...
::Passage
<<set $nationality to "USA">>
His office is on the top floor, so you'll need to take the <<lift>>.
::Widget
<<widget "lift">>\
<<if $nationality == "USA">>\
<<= "elevator">>\
<<elseif $nationality == "UK">>\
<<= "lift">>\
<</if>>\
<</widget>>
That outputs a space between the <<widget>> and the full stop/period at the end of the sentence, so it looks like this:
His office is on the top floor, so you'll need to take the elevator .
Can anybody see what I'm doing wrong?