y***@163.com
y***@163.com
  • 发布:2025-01-06 11:33
  • 更新:2025-01-06 11:33
  • 阅读:113

【报Bug】原生安卓使用uni小程序SDK加载的uniapp程序,在uniapp程序内使用uni.setLocale('en'), picker组件切换成英文不成功

分类:uni小程序sdk

产品分类: uni小程序SDK

手机系统: Android

手机系统版本号: Android 11

手机机型: CRUISE Ge2

页面类型: vue

SDK版本号: SDK-Android@4.29-20241008

操作步骤:

在切换语言的回调函数中, 手动指定setLocale的语言

  const setCurrentLanguage = async (locale: string) => {  
    console.log('lang', locale);  
    await clientAccess.postLanguage({ currentLocaleString: locale });  
    await clientAccess.refreshLanguage();  
    if (locale === 'en-US') {  
      uni.setLocale?.('en');  
    }  
    // 页面重载  
    const pages = getCurrentPages();  
    const currentPage = pages[pages.length - 1];  
    const url = currentPage.route;  
    uni.reLaunch({  
      url: `/${url}`,  
    });  
  };

调用的picker组件传入了fields属性

<template>  
  <view>  
    <picker  
      mode="date"  
      :value="value"  
      :disabled="disabled"  
      @change="onDateChange"  
      fields="day"  
    >  
      <view class="flex justify-between">  
        <view>  
          <text v-if="value">{{ value }}</text>  
          <text  
            class="placeholder"  
            v-else  
            >{{ i18next.t('components.DatePicker.810deae9', { defaultValue: '请选择' }) }}</text  
          >  
        </view>  
        <GProIcon name="Right" />  
      </view>  
    </picker>  
  </view>  
</template>

预期结果:

picker组件会显示成英文

实际结果:

picker组件仍然显示中文

bug描述:

原生安卓使用uni小程序SDK加载的uniapp程序,在uniapp程序内使用uni.setLocale('en'), picker组件切换成英文不成功, 仍然显示的是中文

2025-01-06 11:33 负责人:无 分享
已邀请:

要回复问题请先登录注册