jitsi / jitsi-meet-react-sdk

React SDK for Jitsi Meet
Apache License 2.0
65 stars 36 forks source link

Language #36

Closed jgarplind closed 10 months ago

jgarplind commented 10 months ago

As per https://community.jitsi.org/t/default-language/114671/20 the highest prioritized language is that set as a query parameter.

I cannot find any way to do this using this library, but a wild guess would be that it should be implemented the same way as the release query parameter here?

mihhu commented 10 months ago

You can pass the defaultLanguage to the configOverwrite prop, I think it was added here after that community thread.

Edit: or not, let me take a look

mihhu commented 10 months ago

You can pass the defaultLanguage to the configOverwrite prop

Made some tests and noticed it can't be overridden, can you please confirm? Based on the code I've referenced above I'd say the query param and config are equivalent.

jgarplind commented 10 months ago

🗒️ As per everything I can find documented, you are correct that defaultLanguage cannot be overridden, at least based on a default installation with this whitelist.

Also this comment stating

// Default language for the user interface. Cannot be overwritten.

❗ ... still, at least on my localhost, I just tried (maybe for the first time?) setting configOverwrite={{defaultLanguage: "en"}}, and it just worked. Also tried with es and sv, which also worked.


I'm a bit confused, but temporarily relieved. Maybe this ought to be documented somehow?

mihhu commented 10 months ago

After further investigation I think the fact that it works might be a bug that needs to be fixed in jitsi-meet, as the current implementation takes the defaultLanguage from the url directly, without taking into account the whitelist filtering. I'm going to implement lang as a prop for JitsiMeeting, as you've suggested, until we clear that up.

mihhu commented 10 months ago

Released v1.4.0 that supports lang. We'll mark defaultLanguage as deprecated, but keep it around for backwards compatibility. Thanks for pointing this out!

jgarplind commented 10 months ago

@mihhu I just got around to testing the new lang prop, and unfortunately I think it doesn't work?

Specifically, it seems that browser language detection takes precedence over the lang prop (unlike the defaultLang prop!), so as long as the language detector finds something that matches a language known to the Jitsi server, the lang prop has 0 impact.

This behavior could be acceptable for a prop called defaultLanguage, but when I explicitly set lang: xx, I expect it to be honored over other more implicit ways of setting the language.

Sorry, my bad, I wrongly assumed it was set on configOverwrite rather than a prop on JitsiMeeting. It works just fine 😄

jgarplind commented 10 months ago

Closing since it is fixed and confirmed. Thanks a lot for the quick solution!