Changed the text trim implementation for better i18n.

Review URL: https://codereview.appspot.com/8637047

git-svn-id: http://blockly.googlecode.com/svn/trunk@758 c400ca83-b69d-9dd7-9705-49c6b8615e23