@@ -207,24 +207,26 @@ export interface ComposerOptions<Message = VueMessageType> {
207
207
* @remarks
208
208
* Whether suppress warnings outputted when localization fails.
209
209
*
210
- * If `true `, suppress localization fail warnings.
210
+ * If `false `, suppress localization fail warnings.
211
211
*
212
212
* If you use regular expression, you can suppress localization fail warnings that it match with translation key (e.g. `t`).
213
213
*
214
214
* @VueI 18nSee [Fallbacking](../../guide/essentials/fallback)
215
215
*
216
- * @defaultValue `false `
216
+ * @defaultValue `true `
217
217
*/
218
218
missingWarn ?: boolean | RegExp
219
219
/**
220
220
* @remarks
221
- * Whether do template interpolation on translation keys when your language lacks a translation for a key .
221
+ * Whether suppress warnings when falling back to either `fallbackLocale` or root .
222
222
*
223
- * If `true`, skip writing templates for your "base" language; the keys are your templates.
223
+ * If `false`, suppress fall back warnings.
224
+ *
225
+ * If you use regular expression, you can suppress fallback warnings that it match with translation key (e.g. `t`).
224
226
*
225
227
* @VueI 18nSee [Fallbacking](../../guide/essentials/fallback)
226
228
*
227
- * @defaultValue `false `
229
+ * @defaultValue `true `
228
230
*/
229
231
fallbackWarn ?: boolean | RegExp
230
232
/**
@@ -240,7 +242,9 @@ export interface ComposerOptions<Message = VueMessageType> {
240
242
fallbackRoot ?: boolean
241
243
/**
242
244
* @remarks
243
- * Whether suppress warnings when falling back to either `fallbackLocale` or root.
245
+ * Whether do template interpolation on translation keys when your language lacks a translation for a key.
246
+ *
247
+ * If `true`, skip writing templates for your "base" language; the keys are your templates.
244
248
*
245
249
* @VueI 18nSee [Fallbacking](../../guide/essentials/fallback)
246
250
*
@@ -399,14 +403,14 @@ export interface Composer<
399
403
missingWarn : boolean | RegExp
400
404
/**
401
405
* @remarks
402
- * Whether suppress fallback warnings when localization fails.
406
+ * Whether suppress fall back warnings when localization fails.
407
+ *
408
+ * @VueI 18nSee [Fallbacking](../../guide/essentials/fallback)
403
409
*/
404
410
fallbackWarn : boolean | RegExp
405
411
/**
406
412
* @remarks
407
- * Whether to fallback to root level (global) localization when localization fails.
408
- *
409
- * If `false`, it's warned, and is returned the key.
413
+ * Whether to fall back to root level (global) localization when localization fails.
410
414
*
411
415
* @VueI 18nSee [Fallbacking](../../guide/essentials/fallback)
412
416
*/
@@ -1071,9 +1075,12 @@ export function createComposer<
1071
1075
? options . fallbackWarn
1072
1076
: true
1073
1077
1074
- let _fallbackRoot = isBoolean ( options . fallbackRoot )
1075
- ? options . fallbackRoot
1076
- : true
1078
+ // prettier-ignore
1079
+ let _fallbackRoot = __root
1080
+ ? __root . fallbackRoot
1081
+ : isBoolean ( options . fallbackRoot )
1082
+ ? options . fallbackRoot
1083
+ : true
1077
1084
1078
1085
// configure fall bakck to root
1079
1086
let _fallbackFormat = ! ! options . fallbackFormat
@@ -1221,13 +1228,15 @@ export function createComposer<
1221
1228
const ret = fn ( context ) // track reactive dependency, see the getRuntimeContext
1222
1229
if ( isNumber ( ret ) && ret === NOT_REOSLVED ) {
1223
1230
const key = argumentParser ( )
1224
- if ( __DEV__ && _fallbackRoot && __root ) {
1225
- warn (
1226
- getWarnMessage ( I18nWarnCodes . FALLBACK_TO_ROOT , {
1227
- key,
1228
- type : warnType
1229
- } )
1230
- )
1231
+ if ( __DEV__ && __root ) {
1232
+ if ( ! _fallbackRoot ) {
1233
+ warn (
1234
+ getWarnMessage ( I18nWarnCodes . FALLBACK_TO_ROOT , {
1235
+ key,
1236
+ type : warnType
1237
+ } )
1238
+ )
1239
+ }
1231
1240
// for vue-devtools timeline event
1232
1241
if ( __DEV__ ) {
1233
1242
const {
@@ -1243,7 +1252,7 @@ export function createComposer<
1243
1252
}
1244
1253
}
1245
1254
}
1246
- return _fallbackRoot && __root
1255
+ return __root && _fallbackRoot
1247
1256
? fallbackSuccess ( ( __root as unknown ) as Composer < T > & ComposerInternal )
1248
1257
: fallbackFail ( key )
1249
1258
} else if ( successCondition ( ret ) ) {
0 commit comments