factorize `setTextContent` to fix `localizeElement`