chore(i18n): Refactor i18n code into OO service

This is based on and replaces @cash's original work in https://github.com/Elgg/Elgg/pull/5663