Links

In-app language(Only supported on Android)

JS Integration

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. 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. 2.
    Users change the app language manually
  3. 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();

Android

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));
}
}