Skip to content
This repository was archived by the owner on Dec 31, 2024. It is now read-only.

Commit 168a97c

Browse files
committed
⚡ improvement(extend): disable no translation warning when set missingHandler
Closes #96
1 parent 3590f6d commit 168a97c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/extend.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,14 @@ export default function (Vue) {
9090

9191
function warnDefault (lang, key, vm, result) {
9292
if (!isNil(result)) { return result }
93-
if (process.env.NODE_ENV !== 'production') {
94-
warn('Cannot translate the value of keypath "' + key + '". '
95-
+ 'Use the value of keypath as default')
93+
if (Vue.config.missingHandler) {
94+
Vue.config.missingHandler.apply(null, [lang, key, vm])
95+
} else {
96+
if (process.env.NODE_ENV !== 'production') {
97+
warn('Cannot translate the value of keypath "' + key + '". '
98+
+ 'Use the value of keypath as default')
99+
}
96100
}
97-
Vue.config.missingHandler && Vue.config.missingHandler.apply(null, [lang, key, vm])
98101
return key
99102
}
100103

0 commit comments

Comments
 (0)