Refactor lib/i18n.js -- not fully working yet