Implementing i18n in javascript