This commit is contained in:
2025-10-17 14:34:31 +08:00
parent 7ddaeb4bf8
commit a9074aca30
10 changed files with 290 additions and 54 deletions

View File

@@ -14,7 +14,7 @@ import { defineProps, defineEmits, computed } from 'vue';
const props = withDefaults(defineProps<TextProps & {
modelValue: string;
}>(), {
// 布尔值的默认值处理,设置为 undefined 表示未定义
// 布尔值的默认值处理,设置为 undefined 表示未定义,否则默认会是 false
disabled: undefined,
requiredIcon: undefined,
visible: undefined,
@@ -25,7 +25,7 @@ const emit = defineEmits<{
}>();
/**
* 计算属性:生成传递给 KUC Text 组件的属性对象
* 生成传递给 KUC Text 组件的属性对象
* 过滤掉未定义的属性,避免传递无效值
*/
const textProps = computed<TextProps>(() => {

View File

@@ -20,7 +20,8 @@ for (const path in modules) {
// 创建 i18n 实例配置
const i18n = createI18n({
legacy: false, // 使用 Composition API 模式
locale: kintone.getLoginUser().language || 'ja',
locale: kintone.getLoginUser().language,
fallbackLocale: 'ja',
messages,
});

View File

@@ -1,6 +1,7 @@
// 英语语言包配置
// 包含配置页面相关的翻译文本
export default {
hello: "Hello! ",
config: {
title: 'kintone Vue template',
desc: 'kintone Vue template for creating plugin',

View File

@@ -1,6 +1,7 @@
// 日语语言包配置
// 包含配置页面相关的翻译文本
export default {
hello: 'こんにちは!',
config: {
title: 'kintone Vue テンプレート',
desc: 'kintoneプラグイン作成用 Vue テンプレート',

View File

@@ -1,3 +1,4 @@
import i18n from '@/i18n';
import type { Setting } from '@/types';
import { KintoneRestAPIClient } from '@kintone/rest-api-client';
@@ -27,6 +28,9 @@ import { Button } from 'kintone-ui-component/lib/button';
throw new Error('このページではヘッダー要素が利用できません。');
}
// 测试 i18n
const { t } = i18n.global;
// 创建按钮
const button = new Button({
text: setting.buttonName,
@@ -42,7 +46,7 @@ import { Button } from 'kintone-ui-component/lib/button';
});
const pluginsInfo = plugins.map((p) => p.name).join('、');
const message = setting.message + '\n--------\n【Plugins】 ' + pluginsInfo;
const message = t('hello') + "\n" + setting.message + '\n--------\n【Plugins】 ' + pluginsInfo;
alert(message);
} catch (error) {
console.error('Failed to fetch plugins:', error);

View File

@@ -1,3 +1,4 @@
import i18n from '@/i18n';
import type { Setting } from '@/types';
import { KintoneRestAPIClient } from '@kintone/rest-api-client';
@@ -27,6 +28,9 @@ import { MobileButton } from 'kintone-ui-component/lib/mobile/button';
throw new Error('このページではヘッダー要素が利用できません。');
}
// 测试 i18n
const { t } = i18n.global;
// 创建按钮
const button = new MobileButton({
text: setting.buttonName,
@@ -42,7 +46,7 @@ import { MobileButton } from 'kintone-ui-component/lib/mobile/button';
});
const pluginsInfo = plugins.map((p) => p.name).join('、');
const message = setting.message + '\n--------\n【Plugins】 ' + pluginsInfo;
const message = t('hello') + "\n" + setting.message + '\n--------\n【Plugins】 ' + pluginsInfo;
alert(message);
} catch (error) {
console.error('Failed to fetch plugins:', error);