Update function to make language code safe
Refactor tests