Panel Multilingual BizBundle

Last Updated on : 2024-04-01 06:51:24download

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 = ThingPanelI18nEntrance.getInstance();
  • Configure the following dependencies in build.gradle:

     dependencies {
        api enforcedPlatform("${biz_bom_version}")
        api enforcedPlatform("")
        implementation ""
        implementation ""
        // requested
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        api "${sdk_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, IThingResultCallback<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.
productVer String The product version (productVer).You can call DeviceBean#getProductVer to get the productVer.
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);
        ThingPanelI18nEntrance.getInstance().updateI18n(param, new IThingResultCallback<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 ,productVer 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 ,productVerand i18nTime must be set.


public void showI18n(){
        long homeId = 1L;
  	// Returns the data of `deviceBean`.
        DeviceBean deviceBean = ThingHomeSdk.newHomeInstance(homeId).getHomeBean().getDeviceList().get(0);
        // Returns the product ID that matches `deviceBean`.
        String productId = deviceBean.getProductId();
        //Returns the product version that matches `deviceBean`.
        String productVer = deviceBean.getProductVer();
        // 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 = ThingPanelI18nEntrance.getInstance().getI18nMap(new I18nRequestParam(productId, productVer,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",