adapted simple translation support from https://codereview.appspot.com/6194048/