How to make our app to support multiple languages | Android Studio | Java
HTML-код
- Опубликовано: 28 сен 2024
- 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...
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?
Many thanks. April 2020 and stills working. I could manage to make it work on my app. Thanks!
Thank you for this perfect walk-through - saved me so much time!
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 😊
@bartlomiej can you provide source code to me
@@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
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
Thank you for the tutorial...Run Successfully💖
You're welcome
Your Tutorial is always well sir, please give us some project tutorial.
This is so helpful!! Thanks a lot!! Finally understand!
i have a problem the list of language appear to me in horizanl view , not verical and i can't chose one of them
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.
Nice
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.
At last! I got the simplest tutorial.
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
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
not working for me the language dosent change
Jazak Allah
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
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
That was awesome. Thanks broo. It works for me
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
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
Nice work!
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.
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?
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
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
It is the best tutorial !! Thanks a lot !
Thanks,
This video made me do a subscribe .
Hi have a book app in English but I would like to add another language using Sqlite.
Thank you, it was very helpful video.
Good job dude!!! Thanks a lot :)
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 😕
good work
How to make navigation have an option to select language with out opening any fragment or activity, Please
with best regards
Thank you. It's very help me.
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
this code just only change with language OS, the alertdialog language not work! please help me
have you used recreate() after changing via dialog?
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?
Very useful tutorial
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
Thank you so much. Verry helped!
It wasn't working on recyclerview items.
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
Really Helpful!
Jazaka Allah , how can use for all activities ?
finally something useful thanks
You're welcome :)
atif bhai keyboard bhi change ho ga ?
Thanks a Lot man !!!!!!!
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.
best! dislikers have no life
@Trupti Londhe Copy same code in each activity
please Source Code
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
Thank you very much!!! You help my life! haha
You're welcome
@carlos pls sharre source code to me
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
i set language code form setting activity how to load class loadlocal form mainactivity?
i have problem with sharedPreferenece in main activity
Some deprecated code but works for now. Thanks
How to add English option?
bhai koi help kr do ap i m beginner in this field
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
Is this possible in app inventor
I don't know about app inventor
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?
Thank you brother :D
Yo welcom
updateConfiguration is deprecated
but it will work
But may not work on other version
im using same method for my apps on playstore
thanks a lot
Thank u so much bro
You're welcome
Thank you it's working
Very very thanks
But my bro how work save for some activities by Shared preferences
what you want to save
Atif Pervaiz if we select language en save to all activity
Simple. If we use settings from here select language
the method is same
Write strings of all activities in strings.xml
You can create a seprate settings activity to change language
write both functions in each activity, call loadLocale() in onCreate(Bundle savedInstanceState), before setContentView(R.layout.your_activity);
Both functions, you meant loadLocale() and setLocale() ?
thanks a lot.
thanks bro!
Thx brother
why language not changes ???????? 😡
please help me
magic
How to make default language on radio button ?
a a w w bro
you implement private mode
i dont want that can i do
i'm not clear what you wanna say
@@AtifSayings can i say in urdu sir
after selecting urdu or arabic then layout changes to right. so i dont want that... plz sir help me
yeah u can say in Urdu
layout changes to right because the arabic and urdu starts from right
lakin items ki direction change nahi honi chaiyay sir
koi dependencies tu add ni krni
ni dependencies ni add krni
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 :(
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
tnx for make this tutorial
You're welcome
Thank you.
This video is very helpful.
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?
@Atif Pervaiz bro i need source code please
I don't have it anymore
Легендарно!!!
Попробуй в интернетах ещё найти что-то подобное!..
То ли я слишком глуп, а все уже знают, или просто никто таким уже не пользуется?...
i am unble to see any indian language when translated and pasted in android studio
SharePreferences not working at my side, after reopening the app it shows default value english. Please help me
One Word!! ........................................ Awesome. Really Useful. Thank You Bro
better getLocale = setLocale(getSharedPreferences("Settings",MODE_PRIVATE).getString("Lang","")); //one line
hi sir this code didnt work in 2020 what will i have to do
thanks you
sir, please attach the source code
i don't have it anymore
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?
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
i want implement this code into fragment not at mainactivity how?
wow thanks and nice
Most welcome
its very help ful bro 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
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.
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
Is this video no voice or it's just my earphone?
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