i wouldnt really use t() because its slow and people forget that this code is vulnerable to XSS. What i normally do is to have a hidden div or span which i show with javascript that contains the translation