JS translation refactor