Skip to content

Android kotlin library for change ui language in android application on runtime.

Notifications You must be signed in to change notification settings

ninenox-dev/KotlinLocalization

Repository files navigation

Build Status Android

KotlinLocalization

Android kotlin library for change ui language in android application on runtime.

Alt Text

Installation

On your module app build.gradle add

dependencies {
     implementation 'com.ninenox.kotlinlocalemanager:kotlin-locale-manager:1.0.0'
}

Getting Started

  1. Create class and extend ApplicationLocale.
class App : ApplicationLocale() {

}
  1. In AndroidManifest.xml
<application
        android:name=".App"
        ...
        />
  1. In folder res add new locale.
values-th
   - strings.xml
values-en
   - strings.xml
  1. In any Activity extend AppCompatActivityBase on it.
class MainActivity : AppCompatActivityBase() {

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        
        ...
        
    }
    
}
  1. Call funtion setNewLocale("...") for set current language and refresh UI.

setNewLocale("EN") // Sample "EN","TH","DE"...
        
  1. Get current code language string.
LocaleManager(this).language.toString() // "EN"

Alt Text

Releases

No releases published

Packages

No packages published

Languages