I’m using the WWW class to perform a https request and I don’t specify accept-language in the headers.
My problem is: the server receives always en-US as Accept-Language in the headers of the request, regardless of the real country of the user.
I want to retrieve the currentCulture of the user and pass it to the WWW class.
But I don’t know how to retrieve it ! I read in another threads that System.Globalization.CultureInfo.CurrentCulture and System.Threading.Thread.CurrentThread.CurrentCulture are set to “en-US” by default.
Do you know another way to retrieve the culture code ?
PS: I would like to avoid using a geolocation plugin as much as I can because our server relies on currentculture instead of ips to detect the location of the user. It would represent a heavy update to filter by ip rather than culture code.
Thank you for your help guys !
If the list is correctly filled with the playerScore but not playerName the problem may be the writing of the name in the list (supposing you always fill both at the same time). Are you sure that this part playerName = GameObject.Find("LevelFinisher").GetComponent<finishLevel>().newPlayerName; returns the correct string ?
Hello there,
I found the answer of @streeter12 very interesting but I got an exception when I tried to use the CultureInfo with date formatting.
After nearly an hour of struggle and research in obscure documentation, I finally managed to create a broader method, that works with formatting. Here it is!
I’ve got the exact same problem as you. I really need to retrieve the current culture of the player’s system to adapt the display of the date and time to the player’s local standards. As no one answered you, I’ve created a thread on the forum to find some help. I’ve also put a link to this question in the thread. I hope someone will find a solution to this.
As I can see this now, there is just no good solution (aside from making a plugin that supports all platforms but it surely feels like Unity should do it in-engine), but we can vote for this task would be resolved https://feedback.unity3d.com/suggestions/fix-localization-issues-with-cor (all of my 10 votes goes towards it)
I have no idea as i've never used this approach. I guess the circumstances where one should need something like this are pretty rare (what is your scenario?)
If the list is correctly filled with the playerScore but not playerName the problem may be the writing of the name in the list (supposing you always fill both at the same time). Are you sure that this part playerName = GameObject.Find("LevelFinisher").GetComponent<finishLevel>().newPlayerName; returns the correct string ?
– DenisTribouillois