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. Hence, as shown in the screenshot below, you need to add the localizations you want to support to the iOS project, which is required by iOS framework.
On Android, we have two behaviors for switching languages: RestartingActivity
and NotRestartingActivity
. Different behaviors have different setup steps. You could choose one of them.
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