[WIP] ResourceBundle refactoring

I've separated the PRs. See #916.