mirror of
https://gitee.com/wot-design-uni/wot-design-uni.git
synced 2025-12-06 09:08:51 +08:00
fix: 🐛 修复部分国际化文本不正确的问题 (#970)
This commit is contained in:
parent
49fe25a99b
commit
4319fa9bad
@ -1,13 +1,4 @@
|
||||
/*
|
||||
* @Author: weisheng
|
||||
* @Date: 2024-01-25 23:06:48
|
||||
* @LastEditTime: 2025-02-14 11:20:02
|
||||
* @LastEditors: 810505339
|
||||
* @Description:
|
||||
* @FilePath: \wot-design-uni\src\uni_modules\wot-design-uni\components\composables\useTranslate.ts
|
||||
* 记得注释
|
||||
*/
|
||||
import { camelCase, getPropByPath, isFunction } from '../common/util'
|
||||
import { camelCase, getPropByPath, isDef, isFunction } from '../common/util'
|
||||
import Locale from '../../locale'
|
||||
|
||||
export const useTranslate = (name?: string) => {
|
||||
@ -15,8 +6,7 @@ export const useTranslate = (name?: string) => {
|
||||
const translate = (key: string, ...args: unknown[]) => {
|
||||
const currentMessages = Locale.messages()
|
||||
const message = getPropByPath(currentMessages, prefix + key)
|
||||
return isFunction(message) ? message(...args) : message
|
||||
return isFunction(message) ? message(...args) : isDef(message) ? message : `${prefix}${key}`
|
||||
}
|
||||
|
||||
return { translate }
|
||||
}
|
||||
|
||||
@ -79,8 +79,8 @@ export default {
|
||||
pagination: {
|
||||
prev: 'Previous',
|
||||
next: 'Next',
|
||||
page: (value: number) => `Page:${value}`,
|
||||
total: (total: number) => `Total:${total}`,
|
||||
page: (value: number) => `Page: ${value}`,
|
||||
total: (total: number) => `Total: ${total}`,
|
||||
size: (size: number) => `${size}/page`
|
||||
},
|
||||
picker: {
|
||||
|
||||
@ -75,8 +75,8 @@ export default {
|
||||
pagination: {
|
||||
prev: 'Précédent',
|
||||
next: 'Suivant',
|
||||
page: (value: number) => `Page : ${value}`,
|
||||
total: (total: number) => `Total : ${total}`,
|
||||
page: (value: number) => `Page: ${value}`,
|
||||
total: (total: number) => `Total: ${total}`,
|
||||
size: (size: number) => `${size}/Page`
|
||||
},
|
||||
picker: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user