[8.2.8][i18n] mogo-speech 中文抽取
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.mogo.mgintelligent.speech
|
||||
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||
import org.json.JSONObject
|
||||
|
||||
data class AsrResult(val type: AsrState, val content: String)
|
||||
@@ -35,7 +36,8 @@ fun parseAsrResult(asrResult: String): AsrResult {
|
||||
val bestResult = json.optString("best_result")
|
||||
|
||||
if (error != 0) {
|
||||
return AsrResult(AsrState.STATE_ERROR, "识别失败")
|
||||
// return AsrResult(AsrState.STATE_ERROR, "识别失败")
|
||||
return AsrResult(AsrState.STATE_ERROR, StringUtils.getString(R.string.module_speech_identification_failure))
|
||||
}
|
||||
|
||||
val state = when (resultType) {
|
||||
@@ -44,7 +46,8 @@ fun parseAsrResult(asrResult: String): AsrResult {
|
||||
else -> AsrState.STATE_ERROR
|
||||
}
|
||||
val content = if (state == AsrState.STATE_ERROR) {
|
||||
"识别错误"
|
||||
// "识别错误"
|
||||
StringUtils.getString(R.string.module_speech_state_error)
|
||||
} else bestResult
|
||||
return AsrResult(state, content)
|
||||
}
|
||||
@@ -11,8 +11,10 @@ import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.FileUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ResourceUtils
|
||||
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.mogo.mgintelligent.speech.R
|
||||
import java.io.File
|
||||
|
||||
object WakeManager {
|
||||
@@ -101,6 +103,7 @@ object WakeManager {
|
||||
AbsMogoApplication.getApp()?.let {
|
||||
return it.filesDir.path + File.separator + "iflytek" + File.separator
|
||||
}
|
||||
throw IllegalArgumentException("找不到 Application")
|
||||
// throw IllegalArgumentException("找不到 Application")
|
||||
throw IllegalArgumentException(StringUtils.getString(R.string.module_speech_not_find_application))
|
||||
}
|
||||
}
|
||||
5
libraries/mogo-speech/src/main/res/values/strings.xml
Normal file
5
libraries/mogo-speech/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<resources>
|
||||
<string name="module_speech_identification_failure">识别失败</string>
|
||||
<string name="module_speech_state_error">识别错误</string>
|
||||
<string name="module_speech_not_find_application">找不到 Application</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user