
How to Dynamically Change App Language in Jetpack Compose (Modern Android Guide) 🚀🌏
Many apps today let users choose their preferred language directly inside the app — not just rely on the device language. For example: Someone learning a language may want the app in Spanish 🇪🇸 Or you might simply want to test translations during development Good news: modern Android provides a clean official way to change app language dynamically using AppCompat 1.6+ . Let's implement it step by step. 👇 🚀 Step 1 — Add AppCompat First, you need the AppCompat library because the locale API lives there. Add this dependency: implementation ( "androidx.appcompat:appcompat:1.6.1" ) If you're using Version Catalogs it may look like: implementation ( libs . androidx . appcompat ) 🧩 Step 2 — Use AppCompatActivity To enable the locale API, your MainActivity must extend AppCompatActivity . Replace this: class MainActivity : ComponentActivity () with this: class MainActivity : AppCompatActivity () { override fun onCreate ( savedInstanceState : Bundle ?) { super . onCreate ( savedInstanceState ) }
Continue reading on Dev.to
Opens in a new tab


