In-app language(Only supported on Android)
import FireworkSDK from 'react-native-firework-sdk';
FireworkSDK.getInstance().changeAppLanguage('ar'); // format: ar or ar-JO
Generally, the
changeAppLanguage
API should be called in the following cases:- 1.The App is launched. The host app may not sync the app language to Firework SDK before. Therefore, the host app should call this API when the app is launched.
- 2.Users change the app language manually
- 3.Other cases that changing app language
If there is a react-native restart code in your app. Please add the code before the react-native restart code. Such as:
await FireworkSDK.getInstance().changeAppLanguage(language);
RNRestart.Restart();
Please add the code to your MainActivity.java file.
import com.fireworksdk.bridge.utils.FWLanguageUtil;
public class MainActivity extends ReactActivity {
...
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(FWLanguageUtil.INSTANCE.updateBaseContextLocale(newBase));
}
}
Last modified 9d ago