You could use “standard” browser methods for language determination, like you describe.
Or you can use the query string language parameter: The user’s language setting
A language is passed in the Javascript Helper “onContext” function: but this is the stream/broadcaster selected language (so a gotcha)