App-level Language Setting (Flutter)
Last updated
Was this helpful?
Last updated
Was this helpful?
Please refer to the to learn the languages we supported.
Firework SDK widgets are based on native views. Thus, as depicted in the screenshot below, you must add all the language localizations you wish to support to the iOS project, as required by Apple.
We also require some additional setup steps on Android. On Android, there are two behaviors for switching languages: RestartingActivity
and NotRestartingActivity
. Each behavior involves different setup steps, and you can choose either one.
RestartingActivity
RestartingActivity
option will restart the Android activity when changing the app language.
Currently, FireworkSDK.getInstance().changeAppLanguage
will recreate the activity by default on Android. Therefore, we need to follow the calling sequence.
Generally, you also have codes for switching languages, such as the codes of caching the language. Please call FireworkSDK.getInstance().changeAppLanguage
after all your codes for switching languages. For example:
To be able to use the in-app language feature, the following configuration needs to be added to the app project.
attachBaseContext
method in your MainActivity
.attachBaseContext
method in your MainApplication
.AndroidManifest.xml
NotRestartingActivity
NotRestartingActivity
option won't restart the Android activity when changing the app language.
To be able to use the in-app language feature, the following configuration needs to be added to the app project.
FWFlutterFragmentActivity
class in your MainActivity
.Configure the theme in your MainActivity
add android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"
to the file app/src/Androidmanifest.xml
Override the attachBaseContext
method in your MainApplication
.
Set NotRestartingActivity
behavior for language-switching in your MainApplication
Add androidx.appcompat:appcompat
library in app/firework.gradle
AndroidManifest.xml
English
en
Arabic
ar
Arabic (Saudi Arabia)
ar-SA
Arabic (United Arab Emirates)
ar-AE
German
de
Italian
it
Japanese
ja
Polish
pl
Portuguese (Brazil)
pt-BR
Russian
ru
Spanish
es
Spanish (Mexico)
es-MX
Spanish (Colombia)
es-CO
Vietnamese
vi
Thailand
th
Hungarian
hu
Turkish
tr
French
fr
Portuguese
pt