On-device translation of text and images