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...

Комментарии • 256

  • @invanemay6814
    @invanemay6814 3 года назад +3

    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?

  • @ElCucut
    @ElCucut 4 года назад +2

    Many thanks. April 2020 and stills working. I could manage to make it work on my app. Thanks!

  • @tulioperez6011
    @tulioperez6011 2 года назад +1

    Thank you for this perfect walk-through - saved me so much time!

  • @bartomiejdziao9594
    @bartomiejdziao9594 5 лет назад +13

    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!

    • @AtifSayings
      @AtifSayings  5 лет назад

      You're welcome 😊

    • @Minutemovie20
      @Minutemovie20 4 года назад +1

      @bartlomiej can you provide source code to me

    • @iftekharulhaque2697
      @iftekharulhaque2697 2 года назад +1

      @@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?

  • @ivboogy4735
    @ivboogy4735 7 месяцев назад +1

    thsnk you sooooooo much even after 6 years it works

  • @iannzioka2307
    @iannzioka2307 3 года назад +1

    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

  • @sritikamanjrekar
    @sritikamanjrekar 3 года назад +1

    Thank you for the tutorial...Run Successfully💖

  • @uzzalcontact981
    @uzzalcontact981 5 лет назад +1

    Your Tutorial is always well sir, please give us some project tutorial.

  • @anaisliu6709
    @anaisliu6709 2 года назад +1

    This is so helpful!! Thanks a lot!! Finally understand!

  • @tayseersawaftah5378
    @tayseersawaftah5378 Год назад

    i have a problem the list of language appear to me in horizanl view , not verical and i can't chose one of them

  • @mustafayildirim7619
    @mustafayildirim7619 5 лет назад +1

    It is not working for API level 23 and below (Android version 6.0 and lower). Do you have any idea?

    • @ArifRahman-ce7bf
      @ArifRahman-ce7bf 5 лет назад

      Same Problem. It is not working for API level 21.

  • @vhichams1031
    @vhichams1031 3 года назад +1

    Nice

  • @hazemtv630
    @hazemtv630 3 года назад +1

    Please help don't work idont know why ever think is good and when i click the botton nothing happened

    • @CamboTutorial
      @CamboTutorial 3 года назад

      You may not work because of Android Version, he implemented only support some version. There is another way to do.

  • @geniousitywave1871
    @geniousitywave1871 6 лет назад +5

    At last! I got the simplest tutorial.

  • @helenh2442
    @helenh2442 4 года назад

    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

  • @sh5068
    @sh5068 3 года назад +1

    Hello sir , isn't working for me in the phone should I change the getsharedprefrences name into another name please help

    • @sh5068
      @sh5068 3 года назад +1

      Thanks a lot it's worked great , there is a little problem changing language change my textview directions and margin

    • @AtifSayings
      @AtifSayings  3 года назад

      Sounds good

  • @shreyasdeshmukh3301
    @shreyasdeshmukh3301 4 года назад +1

    not working for me the language dosent change

  • @Alihaider-rs8is
    @Alihaider-rs8is 3 года назад +2

    Jazak Allah

  • @MOHAMMADKHAN-et7rg
    @MOHAMMADKHAN-et7rg Год назад +1

    bro . changing languages is not working after uploading it in play store

    • @AtifSayings
      @AtifSayings  Год назад

      In debug mode is it working? Issue is on release apk?

    • @AtifSayings
      @AtifSayings  Год назад

      @cemilerdem2685 make sure you've set minifyEnabled false

  • @hamzachohan9268
    @hamzachohan9268 5 лет назад +1

    is there any method that change app data language at realtime and data is coming from firebase ???

    • @AtifSayings
      @AtifSayings  5 лет назад

      May be.... but i don't know yet

    • @hamzachohan9268
      @hamzachohan9268 5 лет назад

      @@AtifSayings hmmm thanx sir
      and sir is there any method to use single recyclerview + cardview for different data coming from firebase

  • @kanankarimov5676
    @kanankarimov5676 4 года назад +1

    That was awesome. Thanks broo. It works for me

  • @AbdulQadirghayour
    @AbdulQadirghayour 5 лет назад +2

    Works , just api level 24 and above , what to do with api level 21 and other, pleas if you can help;

  • @sssninja101
    @sssninja101 Год назад +1

    Okay great😊.... but what if i wanted to ask the user which language they want when they first launch the app?!

    • @AtifSayings
      @AtifSayings  Год назад

      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

  • @qubee-tech
    @qubee-tech 2 года назад +1

    Nice work!

  • @UzairAmirs
    @UzairAmirs 6 лет назад +1

    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?

    • @AtifSayings
      @AtifSayings  6 лет назад

      Thaks you....
      If the method is depreciated it still should work. ok, send your screenshot on email, ill check it out

    • @UzairAmirs
      @UzairAmirs 6 лет назад

      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.

  • @shay-cohen
    @shay-cohen 6 лет назад +1

    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?

  • @mohammedtalhaoui1872
    @mohammedtalhaoui1872 4 года назад +1

    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

    • @walidpivano117
      @walidpivano117 4 года назад

      Hi sir please if you find a solution tell le please!

    • @mohammedtalhaoui1872
      @mohammedtalhaoui1872 4 года назад

      @@walidpivano117 i found a soulution , you have to set local in OnCreate before setContentView

  • @jayashrees6538
    @jayashrees6538 6 лет назад +2

    Hi thanks for this video. But this is not working in Android 8 mobiles how can I fix it can you help me.

  • @rehamabdo7526
    @rehamabdo7526 5 лет назад +1

    It is the best tutorial !! Thanks a lot !

  • @linko-tan
    @linko-tan 2 года назад +1

    Thanks,
    This video made me do a subscribe .

  • @sonechak
    @sonechak 4 года назад

    Hi have a book app in English but I would like to add another language using Sqlite.

  • @michaelshh
    @michaelshh 6 лет назад +1

    Thank you, it was very helpful video.

  • @xazai_
    @xazai_ 6 лет назад +1

    Good job dude!!! Thanks a lot :)

  • @surinderbns
    @surinderbns 3 года назад +1

    sir video is very informative and useful. can you please share the link of code of the same programme?

    • @AtifSayings
      @AtifSayings  3 года назад

      Thanks You. I don't have code 😕

  • @fekedewhailemariam5979
    @fekedewhailemariam5979 4 года назад +1

    good work

    • @fekedewhailemariam5979
      @fekedewhailemariam5979 4 года назад

      How to make navigation have an option to select language with out opening any fragment or activity, Please
      with best regards

  • @themostlistenedsongsonyout6016
    @themostlistenedsongsonyout6016 3 года назад +1

    Thank you. It's very help me.

  • @misharosni6842
    @misharosni6842 2 года назад +1

    what if i dont use action bar on any of my activity?

    • @AtifSayings
      @AtifSayings  2 года назад

      This is up to you. all strings in strings.xml of each language will be translated.

    • @misharosni6842
      @misharosni6842 2 года назад

      @@AtifSayings but when i code the ActionBar actionBar = getSupportActionBar();
      actionBar.setTitle(getResources().getString(R.string.app_name)); on my activity the activity keep crashing

    • @AtifSayings
      @AtifSayings  2 года назад

      @@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

  • @amirinyoutube
    @amirinyoutube 4 года назад

    this code just only change with language OS, the alertdialog language not work! please help me

    • @AtifSayings
      @AtifSayings  4 года назад

      have you used recreate() after changing via dialog?

  • @ayushigupta3673
    @ayushigupta3673 5 лет назад

    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

    • @ailing21
      @ailing21 3 года назад

      did you manage to solve it?

  • @mtoheed1085
    @mtoheed1085 5 лет назад

    Very useful tutorial

  • @ijazahmed6277
    @ijazahmed6277 4 года назад +1

    Assalam eo alaikum atif bhai meri app ma change language wala buttton language change ni kr rha

    • @AtifSayings
      @AtifSayings  4 года назад

      WaAlaikumAssalam
      Code ni h is ka ab mere pas

  • @richmangroup
    @richmangroup 4 года назад

    Thank you so much. Verry helped!

  • @parthanarra6335
    @parthanarra6335 5 лет назад

    It wasn't working on recyclerview items.

  • @mrgpspoetry196
    @mrgpspoetry196 5 лет назад

    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..

    • @AtifSayings
      @AtifSayings  5 лет назад

      it will change the language of the strings in strings.xml whether being used in one activity or whole application (multiple activities)

    • @mrgpspoetry196
      @mrgpspoetry196 5 лет назад

      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

    • @mrgpspoetry196
      @mrgpspoetry196 5 лет назад

      Reply asap

    • @AtifSayings
      @AtifSayings  5 лет назад

      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

  • @aky9810
    @aky9810 3 года назад +1

    Really Helpful!

  • @dyari009
    @dyari009 3 года назад

    Jazaka Allah , how can use for all activities ?

  • @muneeburrehman8188
    @muneeburrehman8188 5 лет назад +1

    finally something useful thanks

  • @umerhayyat7818
    @umerhayyat7818 5 лет назад

    atif bhai keyboard bhi change ho ga ?

  • @HarisBukhari-bm7eh
    @HarisBukhari-bm7eh 2 года назад +1

    Thanks a Lot man !!!!!!!

  • @devmoonstar1151
    @devmoonstar1151 6 лет назад +1

    will this make the full app changes, or just that activity only ?
    please reply anyone !

    • @AtifSayings
      @AtifSayings  6 лет назад +2

      Everything string written in strings.xml either of one activity or all activities of complete app will be changed.

    • @devmoonstar1151
      @devmoonstar1151 6 лет назад

      Thank You ♥

    • @jitendrapratap9667
      @jitendrapratap9667 5 лет назад

      @@AtifSayings but u did write all the languages separately.

  • @lollol-qk7mw
    @lollol-qk7mw 5 лет назад +6

    best! dislikers have no life

  • @tarikaws173
    @tarikaws173 3 года назад +1

    please Source Code

  • @robertoacosta9788
    @robertoacosta9788 4 года назад

    Hello friend, a question how could I change the language for all the activities and not in one?

    • @sivakumarb8286
      @sivakumarb8286 4 года назад

      hello friend ...did you get the answer please share me.. im also having the same doubt

  • @carlos50965
    @carlos50965 4 года назад +1

    Thank you very much!!! You help my life! haha

  • @jitendrapratap9667
    @jitendrapratap9667 5 лет назад

    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.

    • @AtifSayings
      @AtifSayings  5 лет назад

      i think you have to write separate data for each language

  • @KurdishAppsTM
    @KurdishAppsTM 4 года назад

    i set language code form setting activity how to load class loadlocal form mainactivity?

    • @KurdishAppsTM
      @KurdishAppsTM 4 года назад

      i have problem with sharedPreferenece in main activity

  • @path_ethics
    @path_ethics 5 лет назад

    Some deprecated code but works for now. Thanks

  • @Anilkumar-ec8sj
    @Anilkumar-ec8sj 4 года назад

    How to add English option?

  • @ijazahmed6277
    @ijazahmed6277 4 года назад

    bhai koi help kr do ap i m beginner in this field

  • @amitghosh3938
    @amitghosh3938 4 года назад

    why are we using recreate instead of return; please help

    • @AtifSayings
      @AtifSayings  4 года назад

      Recreate is used to restart activity which is here required to apply changes
      Return just stops executing code that is after return

    • @amitghosh3938
      @amitghosh3938 4 года назад +1

      @@AtifSayings Thankyou sir

  • @NationalCyberCell
    @NationalCyberCell 5 лет назад +1

    Is this possible in app inventor

    • @AtifSayings
      @AtifSayings  5 лет назад

      I don't know about app inventor

  • @admniyeokuyorsun...3044
    @admniyeokuyorsun...3044 5 лет назад +1

    Lol, honestly I was expecting someting much more smaller in code but I forgot that this is java :D

    • @AtifSayings
      @AtifSayings  5 лет назад +1

      :D

    • @mmkamal
      @mmkamal 5 лет назад

      The code is quite small which was written in java :/

    • @mmkamal
      @mmkamal 5 лет назад

      What he did in java? Made Dialogue and just two methods. That's all. :D How is this not small?

  • @FireMix
    @FireMix 6 лет назад +1

    Thank you brother :D

  • @ayoubanbara1685
    @ayoubanbara1685 6 лет назад +1

    updateConfiguration is deprecated

  • @ademmehdioui6111
    @ademmehdioui6111 6 лет назад +1

    thanks a lot

  • @Vijaykumar-ww6vu
    @Vijaykumar-ww6vu 5 лет назад +1

    Thank u so much bro

  • @pramodamarasinghe5175
    @pramodamarasinghe5175 5 лет назад

    Thank you it's working

  • @samirdesigner3324
    @samirdesigner3324 6 лет назад

    Very very thanks
    But my bro how work save for some activities by Shared preferences

    • @AtifSayings
      @AtifSayings  6 лет назад +1

      what you want to save

    • @samirdesigner3324
      @samirdesigner3324 6 лет назад

      Atif Pervaiz if we select language en save to all activity
      Simple. If we use settings from here select language

    • @AtifSayings
      @AtifSayings  6 лет назад +2

      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);

    • @dope_gadget
      @dope_gadget 6 лет назад

      Both functions, you meant loadLocale() and setLocale() ?

  • @SunnyKumar-tu5hp
    @SunnyKumar-tu5hp 6 лет назад +1

    thanks a lot.

  • @zafarturgunboev7261
    @zafarturgunboev7261 5 лет назад

    thanks bro!

  • @ronirusmayadi9253
    @ronirusmayadi9253 5 лет назад

    Thx brother

  • @MDYeasin-vy8vu
    @MDYeasin-vy8vu 4 года назад +1

    why language not changes ???????? 😡

  • @MeeketTank
    @MeeketTank 3 года назад

    please help me

  • @sindhub8013
    @sindhub8013 4 года назад

    magic

  • @ahuynh359
    @ahuynh359 6 лет назад

    How to make default language on radio button ?

  • @nasrullahhaq3426
    @nasrullahhaq3426 6 лет назад +1

    a a w w bro
    you implement private mode
    i dont want that can i do

    • @AtifSayings
      @AtifSayings  6 лет назад

      i'm not clear what you wanna say

    • @nasrullahhaq3426
      @nasrullahhaq3426 6 лет назад

      @@AtifSayings can i say in urdu sir

    • @nasrullahhaq3426
      @nasrullahhaq3426 6 лет назад

      after selecting urdu or arabic then layout changes to right. so i dont want that... plz sir help me

    • @AtifSayings
      @AtifSayings  6 лет назад

      yeah u can say in Urdu
      layout changes to right because the arabic and urdu starts from right

    • @nasrullahhaq3426
      @nasrullahhaq3426 6 лет назад

      lakin items ki direction change nahi honi chaiyay sir

  • @ijazahmed6277
    @ijazahmed6277 4 года назад

    koi dependencies tu add ni krni

  • @jonathanpincay656
    @jonathanpincay656 6 лет назад +6

    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.

    • @invanemay6814
      @invanemay6814 3 года назад

      it has been 2 years but i need to ask. did you solve the issue and how :(

  • @muhammadfarhad8682
    @muhammadfarhad8682 Год назад +1

    great Atif ,application is working but drawer layout item not change the language

    • @AtifSayings
      @AtifSayings  Год назад

      Make sure you've put its strings to their respective localized strings.xml files

  • @androidcodingworld
    @androidcodingworld 8 месяцев назад +1

    tnx for make this tutorial

  • @FortniteALArabgamers
    @FortniteALArabgamers 4 года назад +2

    Thank you.
    This video is very helpful.

  • @azizullahsamim9924
    @azizullahsamim9924 5 лет назад +3

    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?

    • @AtifSayings
      @AtifSayings  5 лет назад +1

      May be u haf made some mistake.
      Because im using same some of my apps on playstore

    • @farahnazreza984
      @farahnazreza984 5 лет назад +1

      @@AtifSayings i copied the exact same code.but the language is not changing.can you help?

    • @andrecaires3784
      @andrecaires3784 4 года назад +1

      ​@@farahnazreza984 I have the same problem, i tried for APK and it´s work fine but when i publish (PlayStore) nothing do it.

    • @nishasudani86
      @nishasudani86 2 года назад

      @@AtifSayings same problem

    • @hazelkaya9668
      @hazelkaya9668 2 года назад

      @@AtifSayings is it working offline?

  • @tarikaws173
    @tarikaws173 3 года назад +1

    @Atif Pervaiz bro i need source code please

  • @Viktorr_Trr
    @Viktorr_Trr Год назад

    Легендарно!!!
    Попробуй в интернетах ещё найти что-то подобное!..
    То ли я слишком глуп, а все уже знают, или просто никто таким уже не пользуется?...

  • @MeeketTank
    @MeeketTank 3 года назад

    i am unble to see any indian language when translated and pasted in android studio

  • @rupalimandlik2924
    @rupalimandlik2924 Год назад

    SharePreferences not working at my side, after reopening the app it shows default value english. Please help me

  • @bottrahan2022
    @bottrahan2022 5 лет назад +2

    One Word!! ........................................ Awesome. Really Useful. Thank You Bro

  • @xTStockTx
    @xTStockTx 4 года назад +1

    better getLocale = setLocale(getSharedPreferences("Settings",MODE_PRIVATE).getString("Lang","")); //one line

    • @walidpivano117
      @walidpivano117 4 года назад

      hi sir this code didnt work in 2020 what will i have to do
      thanks you

  • @ethiotechmediaetm6918
    @ethiotechmediaetm6918 4 года назад +1

    sir, please attach the source code

  • @arvindreddypeddireddy7630
    @arvindreddypeddireddy7630 5 лет назад +2

    so if I change the language in one activity, will it be followed by all activities?

    • @razushikh4553
      @razushikh4553 4 года назад

      Is it possible?I need it!!!"

    • @ailing21
      @ailing21 3 года назад

      @@razushikh4553 did you manage to solve it?

  • @PeeyuSquad
    @PeeyuSquad 4 года назад +1

    bro Can u pls share me your this Source code im facing some issues not able to switch language

  • @tampankami7185
    @tampankami7185 4 года назад +1

    i want implement this code into fragment not at mainactivity how?

  • @mahbuburrahmankhan973
    @mahbuburrahmankhan973 3 года назад +1

    wow thanks and nice

  • @sardarsaqibkhan4911
    @sardarsaqibkhan4911 5 лет назад +2

    its very help ful bro thanks a lot

  • @Aaditya_singhXz
    @Aaditya_singhXz 3 года назад +1

    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

    • @AtifSayings
      @AtifSayings  3 года назад

      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

  • @MrIMacro
    @MrIMacro 4 года назад +1

    Could you please share with us the code. I want to change the language of my weather app to Arabic.

    • @AtifSayings
      @AtifSayings  4 года назад

      Actually i don't have code of this project :(

    • @entertechinc
      @entertechinc 4 года назад

      You can share what you are coding , Thank you.

  • @shivaniingale3734
    @shivaniingale3734 6 лет назад +1

    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

  • @HY-du5nt
    @HY-du5nt 3 года назад

    Is this video no voice or it's just my earphone?

  • @thearithsok6504
    @thearithsok6504 6 лет назад +1

    It did not change during I changed I need to refresh. Why did I get this I was following you all?
    pls help dear.