新增投票观众端的中英文切换

This commit is contained in:
zlzw 2023-06-02 09:56:24 +08:00
parent 26ec74932f
commit a01ddd310b
3 changed files with 26 additions and 11 deletions

View File

@ -1,8 +1,8 @@
package com.yunbao.common.bean; package com.yunbao.common.bean;
import com.alibaba.fastjson.annotation.JSONField;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.WordUtil;
import java.util.List; import java.util.List;
@ -36,8 +36,10 @@ public class LiveRoomVoteModel extends BaseModel {
private String answer1; private String answer1;
@SerializedName("option_content_second") @SerializedName("option_content_second")
private String answer2; private String answer2;
@SerializedName("result") @SerializedName("result_zh")
private String result; private String resultZh;
@SerializedName("result_en")
private String resultEn;
@SerializedName("option_text") @SerializedName("option_text")
private String optionText; private String optionText;
@SerializedName("option_content_key") @SerializedName("option_content_key")
@ -126,11 +128,23 @@ public class LiveRoomVoteModel extends BaseModel {
} }
public String getResult() { public String getResult() {
return result; return WordUtil.isZh() ? resultZh : resultEn;
} }
public void setResult(String result) { public String getResultZh() {
this.result = result; return resultZh;
}
public void setResultZh(String resultZh) {
this.resultZh = resultZh;
}
public String getResultEn() {
return resultEn;
}
public void setResultEn(String resultEn) {
this.resultEn = resultEn;
} }
public String getOptionText() { public String getOptionText() {
@ -153,7 +167,8 @@ public class LiveRoomVoteModel extends BaseModel {
", userIds=" + userIds + ", userIds=" + userIds +
", answer1='" + answer1 + '\'' + ", answer1='" + answer1 + '\'' +
", answer2='" + answer2 + '\'' + ", answer2='" + answer2 + '\'' +
", result='" + result + '\'' + ", resultZh='" + resultZh + '\'' +
", resultEn='" + resultEn + '\'' +
", optionText='" + optionText + '\'' + ", optionText='" + optionText + '\'' +
", vote='" + vote + '\'' + ", vote='" + vote + '\'' +
", liveUid='" + liveUid + '\'' + ", liveUid='" + liveUid + '\'' +

View File

@ -3,6 +3,7 @@ package com.yunbao.common.utils;
import android.content.res.Resources; import android.content.res.Resources;
import com.yunbao.common.CommonAppContext; import com.yunbao.common.CommonAppContext;
import com.yunbao.common.manager.IMLoginManager;
import java.util.Locale; import java.util.Locale;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -26,9 +27,7 @@ public class WordUtil {
} }
public static boolean isZh() { public static boolean isZh() {
Locale locale = sResources.getConfiguration().locale; return IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE;
String language = locale.getLanguage();
return language.endsWith("zh");
} }
/** /**

View File

@ -1365,7 +1365,8 @@ public class LiveAudienceActivity extends LiveActivity {
voteModel.setAnswer2(map.getString("answer2")); voteModel.setAnswer2(map.getString("answer2"));
voteModel.setAnswer1Num(map.getInteger("num1")); voteModel.setAnswer1Num(map.getInteger("num1"));
voteModel.setAnswer2Num(map.getInteger("num2")); voteModel.setAnswer2Num(map.getInteger("num2"));
voteModel.setResult(map.getString("result")); voteModel.setResultZh(map.getString("result_zh"));
voteModel.setResultEn(map.getString("result_en"));
voteModel.setOptionText(map.getString("option_text")); voteModel.setOptionText(map.getString("option_text"));
System.out.println(">>>" + voteModel); System.out.println(">>>" + voteModel);
String content = voteModel.getResult(); String content = voteModel.getResult();