modified api and added language selection support to text editor