Hi Shivangi,
I have created a blog for exactly the same use case,
you can refer to my blog from the link below:
https://medium.com/mendix/breaking-language-barriers-with-mendix-a-guide-to-changing-languages-for-anonymous-users-864838a2c3a4
Let me know, if you face any issues,
Hope it helps!