refactor browser language detect