mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-11 18:42:54 +00:00
no message
This commit is contained in:
parent
1702aab538
commit
e956a03098
@ -269,32 +269,12 @@ class Doo
|
||||
/**
|
||||
* 翻译
|
||||
* @param $text
|
||||
* @param string $type
|
||||
* @return string
|
||||
*/
|
||||
public static function translate($text): string
|
||||
public static function translate($text, string $type = ""): string
|
||||
{
|
||||
// 存在版本号 且 低于0.38.28时 使用原文
|
||||
$version = Base::headerOrInput('version');
|
||||
if ($version && !Base::judgeClientVersion('0.38.28', $version)) {
|
||||
return $text;
|
||||
}
|
||||
|
||||
if (is_string($text)) {
|
||||
// 等于success、error、warning、info、(为空)时不处理
|
||||
if (in_array($text, ['success', 'error', 'warning', 'info', ''])) {
|
||||
return $text;
|
||||
}
|
||||
// 以__L(开头,)__结尾的不处理
|
||||
if (str_starts_with($text, "__L(") && str_ends_with($text, ")__")) {
|
||||
return $text;
|
||||
}
|
||||
$text = "__L(" . $text . ")__";
|
||||
} elseif (is_array($text)) {
|
||||
foreach ($text as $key => $val) {
|
||||
$text[$key] = self::translate($val);
|
||||
}
|
||||
}
|
||||
return $text;
|
||||
return self::string(self::doo()->translate($text, $type));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
19
resources/assets/js/app.js
vendored
19
resources/assets/js/app.js
vendored
@ -229,25 +229,6 @@ $A.bindScreenshotKey = (data) => {
|
||||
$A.Electron.sendMessage('bindScreenshotKey', {key});
|
||||
};
|
||||
|
||||
// 翻译
|
||||
$A.apiTranslate = (data) => {
|
||||
if ($A.isJson(data)) {
|
||||
for (let key in data) {
|
||||
if (!data.hasOwnProperty(key)) continue;
|
||||
data[key] = $A.apiTranslate(data[key]);
|
||||
}
|
||||
} else if ($A.isArray(data)) {
|
||||
data.forEach((val, index) => {
|
||||
data[index] = $A.apiTranslate(val);
|
||||
});
|
||||
} else if (typeof data === 'string' && /__L\((.*?)\)__/.test(data)) {
|
||||
data = data.replace(/__L\((.*?)\)__/g, (match, p1) => {
|
||||
return $L(p1)
|
||||
})
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
Vue.prototype.$A = $A;
|
||||
Vue.prototype.$L = $L;
|
||||
Vue.prototype.$Electron = $A.Electron;
|
||||
|
||||
3
resources/assets/js/store/actions.js
vendored
3
resources/assets/js/store/actions.js
vendored
@ -167,7 +167,6 @@ export default {
|
||||
if (params.encrypt === true && result.encrypted) {
|
||||
result = await dispatch("pgpDecryptApi", result.encrypted)
|
||||
}
|
||||
result = $A.apiTranslate(result)
|
||||
const {ret, data, msg} = result
|
||||
if (ret === -1) {
|
||||
state.userId = 0
|
||||
@ -3541,7 +3540,7 @@ export default {
|
||||
if (result.type === "encrypt" && result.encrypted) {
|
||||
result = await dispatch("pgpDecryptApi", result.encrypted)
|
||||
}
|
||||
const msgDetail = $A.apiTranslate($A.formatMsgBasic(result));
|
||||
const msgDetail = $A.formatMsgBasic(result);
|
||||
const {type, msgId} = msgDetail;
|
||||
switch (type) {
|
||||
case "open":
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user