Optimize getAvailableLanguages

This is more a game than a real pull request: I love pull requests on pull requests;)