Contact Us
Log In

Panel Multilingual BizBundle

Last Updated on : 2022-02-22 02:44:09download

Panel Multilingual BizBundle provides the capabilities to update and get panel language packs for smart products based on the integration with Smart Life App SDK. In the left-side navigation pane of Tuya IoT Development Platform, you can choose App > Multi-language > Product Language to manage multilingual entries of smart products.

Functional description

  • Query the capabilities of the panel multilingual SDKs:

    IPanelI18n i18nManager = TuyaPanelI18nEntrance.getInstance();
  • Configure the following dependencies in build.gradle:

    dependencies {
    		// for panel i18n
    		implementation "com.tuya.smart:tuyasmart-sdk-i18n:1.0.0"
    		// requested
    		implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    $kotlin_version indicates that you must customize the Kotlin version by yourself.

Update panel multilingual content

Updates the multilingual content of specific panels. A callback is executed to send a notification on a failed request.

API description

void updateI18n(I18nRequestParam requestParam, ITuyaResultCallback<Object> listener)


Parameter Description
requestParam The parameters of the requested package. productId and i18nTime must be set.
listener The success or failure callback.

Fields of I18nRequestParam

Field Type Description
productId String The product ID (PID). The devices with the same PID have the same schema data. You can call DeviceBean#getProductId to get the PID.
i18nTime Long The multilingual timestamp of a product. You can call DeviceBean#getI18nTime to get the value.


public void updateI18n(String productId, long i18nTime){
        I18nRequestParam param = new I18nRequestParam(productId, i18nTime);
        TuyaPanelI18nEntrance.getInstance().updateI18n(param, new ITuyaResultCallback<Object>() {
            public void onSuccess(Object result) {
              // The success callback.

            public void onError(String errorCode, String errorMessage) {
              // The failure callback.

Query panel multilingual content

Returns the cached panel multilingual content based on productId and i18nTime. For example, to process multilingual content for a smart product, you can call multilingual API methods of the SDK to get multilingual content for all languages. After a panel is started, you can specify the target language and entry codes to get the desired multilingual content. Before the initial query of panel multilingual content, you must make API requests to update the content first.

API description

The data of Map is returned in the key-value pair format. The primary key indicates the language, such as en. The value of the primary key is still represented in the key-value pair format. The secondary key identifies an entry and its value is the text of the entry in the specified language.

Map<String, Map<String, Object>> getI18nMap(I18nRequestParam requestParam)


Parameter Description
requestParam The parameters of the requested package. productId and i18nTime must be set.


public void showI18n(){
        long homeId = 1L;
  	// Returns the data of `deviceBean`.
        DeviceBean deviceBean = TuyaHomeSdk.newHomeInstance(homeId).getHomeBean().getDeviceList().get(0);
        // Returns the product ID that matches `deviceBean`.
        String productId = deviceBean.getProductId();
        // Returns the timestamp of the language pack.
        long i18nTime = deviceBean.getI18nTime();
  	// Returns the map of the language pack for the specified PID.
        Map<String, Map<String, Object>> contentMap = TuyaPanelI18nEntrance.getInstance().getI18nMap(new I18nRequestParam(productId, i18nTime));
        for (Map.Entry<String, Map<String, Object>> langEntry : contentMap.entrySet()) {
          	// `key` indicates the language.
            String lang = langEntry.getKey();
            for(Map.Entry<String, Object> entry : langEntry.getValue().entrySet()){
                // `key` indicates the key of the target entry.
                String key = entry.getKey();
              	// `value` indicates the multilingual content of the target entry in the specified language
                String i18nValue = (String) entry.getValue();
  	// The following example shows the `power_tip` entry in English.
  	String lang = "en";
        String key = "power_tip";
        String i18nValue = (String) contentMap.get(lang).get(key);

Sample response

        "removeFailed":"Failed to remove the device",
        "TYTimer_endTimeTilte":"End Time",
        "power_tip":"Tap to start",
        "openBle":"Open Bluetooth",
        "mode_white":"White Mode",
        "quickop_dp_temp_value":"Color Temp",
        "backToHome":"Back Home",