How to make our app to support multiple languages | Android Studio | Java
ฝัง
- เผยแพร่เมื่อ 6 ก.พ. 2025
- This tutorial is about how to develop an app with multiple language support.
We will create separate strings.xml files for each language.
We will use AlertDialog to display languages to choose one of them and change. The settings will be saved using shared preferences, so whenever you will start the app it will load with the language you selected last time.
Buy Me a Coffee: paypal.me/atif...
Chanel:
/ mohammadatif1
Websites:
technifysoft.com/
devofandroid.b...
Apps/Games on PlayStore:
play.google.co...
If u like this video, Like, Comment, Subscribe to support us...
Clean and neat. I saw few other tutorial and this is by far the simplest and most effective. This is what I will be using. Thank you!
You're welcome 😊
@@AtifSayings hi i am a student in UI UX design, i am curious how apps support multiple languages, is it the engineers job to add languages to the app?, how do i as a designer assist this process to make my app designs more accessible to people?
thsnk you sooooooo much even after 6 years it works
You're welcome
One Word!! ........................................ Awesome. Really Useful. Thank You Bro
Thank you for this perfect walk-through - saved me so much time!
Nice
Nice work!
Thank you for the tutorial...Run Successfully💖
You're welcome
Many thanks. April 2020 and stills working. I could manage to make it work on my app. Thanks!
This is working on my emulator but when I uploaded it to google play, choosing the language is not changing the language. How can I solve this issue?
good work
How to make navigation have an option to select language with out opening any fragment or activity, Please
with best regards
Thanks,
This video made me do a subscribe .
wow thanks and nice
Most welcome
This is so helpful!! Thanks a lot!! Finally understand!
tnx for make this tutorial
You're welcome
That was awesome. Thanks broo. It works for me
Very useful tutorial
Great brother 😊
JazakAllah
Легендарно!!!
Попробуй в интернетах ещё найти что-то подобное!..
То ли я слишком глуп, а все уже знают, или просто никто таким уже не пользуется?...
Thank you.
This video is very helpful.
its very help ful bro thanks a lot
Good job dude!!! Thanks a lot :)
bro . changing languages is not working after uploading it in play store
In debug mode is it working? Issue is on release apk?
@cemilerdem2685 make sure you've set minifyEnabled false
Really Helpful!
great Atif ,application is working but drawer layout item not change the language
Make sure you've put its strings to their respective localized strings.xml files
At last! I got the simplest tutorial.
Thank you sooo much, that was really helpful
I only changed
SharedPreferences prefs=getSharedPreferences("setting", Activity.MODE_PRIVATE);
to
SharedPreferences prefs=getSharedPreferences("save to all activity", Activity.MODE_PRIVATE);
and its working for me
Shivani Ingale both are same
+Atif Pervaiz But 1st one give error in my case
ok
It is the best tutorial !! Thanks a lot !
sir when i clean app history and then reopen app dosen't have selected language its have default language i want when i select a language then its continue have the language wich i chosed
User shared preferences to save which language was selected then whenever app starts, load the value from shared preferences, in that way you can set the language that was selected last time
Is this video no voice or it's just my earphone?
SharePreferences not working at my side, after reopening the app it shows default value english. Please help me
Jazak Allah
Thank you. It's very help me.
Thanks a Lot man !!!!!!!
Can you please tell why I am able to select language only once. After it if I select language it doesn't reflect on the other activities of the app! Hoping for quick answer!
write all strings in strings.xml of each language
call loadLocale(); function before setContentView(R.layout.activity_name); of each activity
@@AtifSayings what about Fragments?
i have a problem the list of language appear to me in horizanl view , not verical and i can't chose one of them
Really appreciate you man !
good tutorial but it shows the language but when you click on a language it doesn't change the texts to the language you have selected
Hello Atif,
Perfect Video, I did the same that you did in the video and it works fine when I run my app directly from android studio, but my problem is that when i upload my app in google play store and download back from play store the localization is not working. Can you advice me what should i do?
May be u haf made some mistake.
Because im using same some of my apps on playstore
@@AtifSayings i copied the exact same code.but the language is not changing.can you help?
@@farahnazreza984 I have the same problem, i tried for APK and it´s work fine but when i publish (PlayStore) nothing do it.
@@AtifSayings same problem
@@AtifSayings is it working offline?
Thank you, it was very helpful video.
Thank you very much!!! You help my life! haha
You're welcome
Your Tutorial is always well sir, please give us some project tutorial.
Hi, thanks very much for the tutorial, It's very nice, I have a question, when I run the emulator I'm able to change the language, but when I run it in the phone it's is not changing the language.
it has been 2 years but i need to ask. did you solve the issue and how :(
Thank you so much. Verry helped!
finally something useful thanks
You're welcome :)
i am unble to see any indian language when translated and pasted in android studio
atif bhai keyboard bhi change ho ga ?
Okay great😊.... but what if i wanted to ask the user which language they want when they first launch the app?!
You can do it using Shared Preferences.
In launch get a boolean value from shared Preferences e.g. isOldUse if value is false which is always false when launching first time then set required language after that save its value true
Then next time you lanuch its valie will be true
Hello sir , isn't working for me in the phone should I change the getsharedprefrences name into another name please help
Thanks a lot it's worked great , there is a little problem changing language change my textview directions and margin
Sounds good
Damn, you made it seem so easy! hahah
Thx bro
You're welcome
how can I apply changing language in multi interface, because it still change language in main activity
Clear, efficient, thanks a lot
i want implement this code into fragment not at mainactivity how?
is there any method that change app data language at realtime and data is coming from firebase ???
May be.... but i don't know yet
@@AtifSayings hmmm thanx sir
and sir is there any method to use single recyclerview + cardview for different data coming from firebase
Thank you!
You're welcome!
so if I change the language in one activity, will it be followed by all activities?
Is it possible?I need it!!!"
@@razushikh4553 did you manage to solve it?
It is not working for API level 23 and below (Android version 6.0 and lower). Do you have any idea?
Same Problem. It is not working for API level 21.
sir video is very informative and useful. can you please share the link of code of the same programme?
Thanks You. I don't have code 😕
am i the only one that this is not working for me? I put setlocale() before setContentView() it can be translated , but loadLocale() doesn't work
How to manage the radio button selection in this case?
what if i dont use action bar on any of my activity?
This is up to you. all strings in strings.xml of each language will be translated.
@@AtifSayings but when i code the ActionBar actionBar = getSupportActionBar();
actionBar.setTitle(getResources().getString(R.string.app_name)); on my activity the activity keep crashing
@@misharosni6842 skip/remove code related to actionbar because you don't want to use actiobar then you don’t have to set title of the actionbar
I have written the same code in my program but is not working (nothing is happening). Can any one help me to correct it. Please...
Hi thank you so much for this
but I have a problem, when i close the app and restart it again, everything is good, just navigation view it open from start , why it does not open from end, i hope you understand me , thank you
Hi sir please if you find a solution tell le please!
@@walidpivano117 i found a soulution , you have to set local in OnCreate before setContentView
not working for me the language dosent change
hello bro .. its a Awesome video.. but i have one doubt .. how can i change the language for all other activities ..
Do you know how can i change all other activities
Hi Atif,
I have been following your tutorials lately and they are great for learning studio. While following this tutorial I came across an issue which is:
I have copied the exact code but when I choose language, the strings aren't changed. While writing UpdateConfiguration() I saw that this is deprecated and while going through answers on Google I was unable to understand what to do.
Now I want to Localize my app but I am unable to do so. Can you please help?
Thaks you....
If the method is depreciated it still should work. ok, send your screenshot on email, ill check it out
Hi, thanks for your kind response. I have sent you the email with Screenshots and Logcat errors.
Please help and thanks for responding again. Very kind of you.
Do you try if the app has many activities
ys,
@@AtifSayings I'm having a problem, when I turn off the app and open it again, only the current activity changes the language, the remaining activites don't
Hi have a book app in English but I would like to add another language using Sqlite.
this code just only change with language OS, the alertdialog language not work! please help me
have you used recreate() after changing via dialog?
Thank you brother :D
Yo welcom
Thanks !
You're welcome :)
@@AtifSayings bro i need source code please
Please help don't work idont know why ever think is good and when i click the botton nothing happened
You may not work because of Android Version, he implemented only support some version. There is another way to do.
Hi thanks for this video. But this is not working in Android 8 mobiles how can I fix it can you help me.
so did it fixed
Jazaka Allah , how can use for all activities ?
Could you please share with us the code. I want to change the language of my weather app to Arabic.
Actually i don't have code of this project :(
You can share what you are coding , Thank you.
Thanks for the video but i noticed as soon i am inside my RTL Layout and I change my orientation from portrait to landscape the layout changes back from RTL to LTR, any way to prevent this?
any solution for this?
what should i do if i want to implement this method in a fragment that using radio button in setting of apps. thx
I think you will need to implement it in the base activity only. I mean the one in which you have implemented the fragment.
How we change all app language doing this process because this process best for only one activity when i create two activity then firstly i select language then for both activity language must be change then how we can do this for two activity??(without using second button on second activity) help me sir..
it will change the language of the strings in strings.xml whether being used in one activity or whole application (multiple activities)
Atif Pervaiz but at that time i try like that "like normal app firstly we select a language for all app this type of thing how i do in my app" you are on write way but i can not understand for all app so tell me how i can do that and sir when i select hindi then for that particular activity's language change but not second activity language change so plz provide solution
Reply asap
it should change the language of all activities whose strings are in strings.xml
also write methods (used in changing language) in others activities too
best! dislikers have no life
@Trupti Londhe Copy same code in each activity
thank you very mush brother
tutorial is good but i am getting a small error can you please help me for me the action bar which i am adding does not support..
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setTitle(java.lang.CharSequence)' on a null object reference
did you manage to solve it?
Lol, honestly I was expecting someting much more smaller in code but I forgot that this is java :D
:D
The code is quite small which was written in java :/
What he did in java? Made Dialogue and just two methods. That's all. :D How is this not small?
Plsss how to remove any debugging code from Android studio project
Didn't get what exactly you want to say, elaborate
Thank you so much :)))
Thank u so much bro
You're welcome
bro Can u pls share me your this Source code im facing some issues not able to switch language
Actually i don't have it
Thx man!!
why are we using recreate instead of return; please help
Recreate is used to restart activity which is here required to apply changes
Return just stops executing code that is after return
@@AtifSayings Thankyou sir
Works , just api level 24 and above , what to do with api level 21 and other, pleas if you can help;
Have you got any solution for this than please share .I am also stuck with that concept only
it works for me from api 17
will this make the full app changes, or just that activity only ?
please reply anyone !
Everything string written in strings.xml either of one activity or all activities of complete app will be changed.
Thank You ♥
@@AtifSayings but u did write all the languages separately.
Instead of using shared preference use Room database
If you can please make a tutorial video
If you have done already send the link plz
Hello friend, a question how could I change the language for all the activities and not in one?
hello friend ...did you get the answer please share me.. im also having the same doubt
bro all the videos on you tube are those in which they are changing the language of the single activity.please tell us how we can change the language of more than one activity
do same for all activities if you want to change language programatically. write strings of each activity in strings.xml
It did not change during I changed I need to refresh. Why did I get this I was following you all?
pls help dear.
elaborate the problem
What if I have tons of data in sqlite database, can I change that too in different languages,or I will have to write again all things in the other languages.
i think you have to write separate data for each language
bhai pelase help merr app me hindi likhne par ???? aa rha hai please help
Thank you it's working
Assalam eo alaikum atif bhai meri app ma change language wala buttton language change ni kr rha
WaAlaikumAssalam
Code ni h is ka ab mere pas
I wrote exactly same code but this is not working in my phone why
But this is working in my brother phone why like that?
@@mukhaambikavaradavenkata8045 That may not work because of Android Version, he implemented only support some version. There is another way to do.
@@CamboTutorial do you have any solution for this to work on all android versions? if you have then please share I am looking for that from long time thank you
@@amitwaghmare7186 Nice to hear that, I will share when I have time to make video. Thanks