Closed lmeurs closed 2 weeks ago
@lmeurs Thanks for reporting.
Language is a User level property, it will be the most recent language set for the User.
List of properties and where they are now stored with User Model:
Full documentation: https://documentation.onesignal.com/docs/user-model-migration-guide
@jkasten2: thank you for your reply. It's clear that language is a user level property. As explained at https://github.com/OneSignal/OneSignal-Website-SDK/issues/1094#issuecomment-1684403605 we set the user language server side through API PATCH requests to https://onesignal.com/api/v1/users/by/custom_alias/123456.
In case of a new subscription, it seems like the user's language property automatically gets overwritten by the browser's default language. Is this correct? If so, is this expected behavior? The POC is for a website in 10 languages, we need control over the stored language, so we can apply custom lanuage fallback.
Thanks for the details here, that makes things very clear to me now.
I am guessing you login in the user first, authenticating with your backend, then call OneSignal.login()
? If so would you be able to to give the OneSignal SDK their language preference just before calling OneSignal.login()
? Example something like this:
// setLanguage doesn't exist, just a suggestion for demonstration
OneSignal.User.setLanguage(languagePreference);
OneSignal.login(myID);
If not, let me know what would ideal for you.
The flow you describe is correct, not sure how setting a custom value client side (like we currently do server side) could solve this issue.
I guess the problem is that language is a property that can be set to a custom value through the API, but automatically gets overwritten when a new subscriptions is created. I understand you have to set the initial language and all you (currently) have is the browser's preferred languages. I also understand the language getting updated in certain occasions, but maybe language should be decoupled from the browser's preferred language after once it has been set to a custom value?
Closing this due to lack of activity. If this remains an issue, please open a new report with updated information and we will investigate. Thanks
What happened?
During out tests we logged in with the same user on different devices. When logging in for the first time on a new device, languages of all subscriptions get reset to en.
Possibly related: https://github.com/OneSignal/OneSignal-Website-SDK/issues/1094
What browsers are you seeing the problem on?
Chrome (Chromium)
What operating system are you running?
W11, Android 13
Steps to reproduce?
What did you expect to happen?
I expected the originally set language to remain in tact
Relevant log output
No response