Refactoring js translation