This commit is contained in:
锦恢 2025-06-11 22:36:00 +08:00
parent 0ea7e1053c
commit 1a11ca64e5
10 changed files with 24 additions and 13 deletions

View File

@ -8,8 +8,9 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, onMounted, watch, type PropType } from 'vue' import { ref, onMounted, watch, type PropType } from 'vue';
import { EditorView, basicSetup } from 'codemirror' import { useI18n } from 'vue-i18n';
import { EditorView, basicSetup } from 'codemirror';
import type { Completion, CompletionContext } from "@codemirror/autocomplete" import type { Completion, CompletionContext } from "@codemirror/autocomplete"
import { jsonLanguage } from "@codemirror/lang-json" import { jsonLanguage } from "@codemirror/lang-json"
@ -45,7 +46,8 @@ const props = defineProps({
} }
}) })
const emit = defineEmits(['update:modelValue', 'parse-error']) const emit = defineEmits(['update:modelValue', 'parse-error']);
const { t } = useI18n();
const editorContainer = ref<any>(null); const editorContainer = ref<any>(null);
const editorView = ref<EditorView | null>(null); const editorView = ref<EditorView | null>(null);
@ -69,7 +71,7 @@ const debouncedParse = debounce((value: string) => {
emit('update:modelValue', parsed); emit('update:modelValue', parsed);
} catch (error) { } catch (error) {
isInvalid.value = true; isInvalid.value = true;
errorMessage.value = 'JSON 解析错误: ' + (error as Error).message; errorMessage.value = t('error-parse-json') + (error as Error).message;
emit('parse-error', error); emit('parse-error', error);
} }
}, props.debounceTime); }, props.debounceTime);

View File

@ -184,5 +184,6 @@
"document": "الوثائق الرسمية", "document": "الوثائق الرسمية",
"join-discussion": "انضم إلى مجموعة النقاش", "join-discussion": "انضم إلى مجموعة النقاش",
"comment-for-us": "اكتب تقييمًا لنا!", "comment-for-us": "اكتب تقييمًا لنا!",
"openmcp-developed-by": "OpenMCP Client {version} تم تطويره بواسطة {author}" "openmcp-developed-by": "OpenMCP Client {version} تم تطويره بواسطة {author}",
"error-parse-json": "خطأ في تحليل JSON:"
} }

View File

@ -184,5 +184,6 @@
"document": "Offizielle Dokumentation", "document": "Offizielle Dokumentation",
"join-discussion": "Diskussionsgruppe beitreten", "join-discussion": "Diskussionsgruppe beitreten",
"comment-for-us": "Schreiben Sie eine Bewertung für uns!", "comment-for-us": "Schreiben Sie eine Bewertung für uns!",
"openmcp-developed-by": "OpenMCP Client {version} entwickelt von {author}" "openmcp-developed-by": "OpenMCP Client {version} entwickelt von {author}",
"error-parse-json": "JSON-Parsing-Fehler:"
} }

View File

@ -170,5 +170,6 @@
"document": "Official documentation", "document": "Official documentation",
"join-discussion": "Join the discussion group", "join-discussion": "Join the discussion group",
"comment-for-us": "Write a review for us!", "comment-for-us": "Write a review for us!",
"openmcp-developed-by": "OpenMCP Client {version} developed by {author}" "openmcp-developed-by": "OpenMCP Client {version} developed by {author}",
"error-parse-json": "JSON parsing error:"
} }

View File

@ -184,5 +184,6 @@
"document": "Documentation officielle", "document": "Documentation officielle",
"join-discussion": "Rejoindre le groupe de discussion", "join-discussion": "Rejoindre le groupe de discussion",
"comment-for-us": "Écrivez un avis pour nous !", "comment-for-us": "Écrivez un avis pour nous !",
"openmcp-developed-by": "OpenMCP Client {version} développé par {author}" "openmcp-developed-by": "OpenMCP Client {version} développé par {author}",
"error-parse-json": "Erreur d'analyse JSON :"
} }

View File

@ -170,5 +170,6 @@
"document": "公式ドキュメント", "document": "公式ドキュメント",
"join-discussion": "ディスカッショングループに参加", "join-discussion": "ディスカッショングループに参加",
"comment-for-us": "私たちのためにレビューを書いてください!", "comment-for-us": "私たちのためにレビューを書いてください!",
"openmcp-developed-by": "OpenMCP Client {version} は {author} によって開発されました" "openmcp-developed-by": "OpenMCP Client {version} は {author} によって開発されました",
"error-parse-json": "JSON解析エラー:"
} }

View File

@ -184,5 +184,6 @@
"document": "공식 문서", "document": "공식 문서",
"join-discussion": "토론 그룹에 참여", "join-discussion": "토론 그룹에 참여",
"comment-for-us": "우리를 위해 리뷰를 작성해 주세요!", "comment-for-us": "우리를 위해 리뷰를 작성해 주세요!",
"openmcp-developed-by": "OpenMCP Client {version}은 {author}에 의해 개발되었습니다" "openmcp-developed-by": "OpenMCP Client {version}은 {author}에 의해 개발되었습니다",
"error-parse-json": "JSON 구문 분석 오류:"
} }

View File

@ -184,5 +184,6 @@
"document": "Официальная документация", "document": "Официальная документация",
"join-discussion": "Присоединиться к дискуссионной группе", "join-discussion": "Присоединиться к дискуссионной группе",
"comment-for-us": "Напишите отзыв для нас!", "comment-for-us": "Напишите отзыв для нас!",
"openmcp-developed-by": "OpenMCP Client {version} разработан {author}" "openmcp-developed-by": "OpenMCP Client {version} разработан {author}",
"error-parse-json": "Ошибка разбора JSON:"
} }

View File

@ -170,5 +170,6 @@
"document": "官方文档", "document": "官方文档",
"join-discussion": "加入讨论群", "join-discussion": "加入讨论群",
"comment-for-us": "为我们撰写评价!", "comment-for-us": "为我们撰写评价!",
"openmcp-developed-by": "OpenMCP Client {version} 由 {author} 开发" "openmcp-developed-by": "OpenMCP Client {version} 由 {author} 开发",
"error-parse-json": "JSON 解析错误:"
} }

View File

@ -184,5 +184,6 @@
"document": "官方文件", "document": "官方文件",
"join-discussion": "加入討論群", "join-discussion": "加入討論群",
"comment-for-us": "為我們撰寫評價!", "comment-for-us": "為我們撰寫評價!",
"openmcp-developed-by": "OpenMCP Client {version} 由 {author} 開發" "openmcp-developed-by": "OpenMCP Client {version} 由 {author} 開發",
"error-parse-json": "JSON解析錯誤:"
} }