fix(i18n): Refactor to be able to add unit tests, added unit tests

Refactor the serialization to be able to add unit tests
Add unit tests

Closes #2418