@@ -207,24 +207,26 @@ export interface ComposerOptions<Message = VueMessageType> {
207207 * @remarks
208208 * Whether suppress warnings outputted when localization fails.
209209 *
210- * If `true `, suppress localization fail warnings.
210+ * If `false `, suppress localization fail warnings.
211211 *
212212 * If you use regular expression, you can suppress localization fail warnings that it match with translation key (e.g. `t`).
213213 *
214214 * @VueI 18nSee [Fallbacking](../../guide/essentials/fallback)
215215 *
216- * @defaultValue `false `
216+ * @defaultValue `true `
217217 */
218218 missingWarn ?: boolean | RegExp
219219 /**
220220 * @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 .
222222 *
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`).
224226 *
225227 * @VueI 18nSee [Fallbacking](../../guide/essentials/fallback)
226228 *
227- * @defaultValue `false `
229+ * @defaultValue `true `
228230 */
229231 fallbackWarn ?: boolean | RegExp
230232 /**
@@ -240,7 +242,9 @@ export interface ComposerOptions<Message = VueMessageType> {
240242 fallbackRoot ?: boolean
241243 /**
242244 * @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.
244248 *
245249 * @VueI 18nSee [Fallbacking](../../guide/essentials/fallback)
246250 *
@@ -399,14 +403,14 @@ export interface Composer<
399403 missingWarn : boolean | RegExp
400404 /**
401405 * @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)
403409 */
404410 fallbackWarn : boolean | RegExp
405411 /**
406412 * @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.
410414 *
411415 * @VueI 18nSee [Fallbacking](../../guide/essentials/fallback)
412416 */
@@ -1071,9 +1075,12 @@ export function createComposer<
10711075 ? options . fallbackWarn
10721076 : true
10731077
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
10771084
10781085 // configure fall bakck to root
10791086 let _fallbackFormat = ! ! options . fallbackFormat
@@ -1221,13 +1228,15 @@ export function createComposer<
12211228 const ret = fn ( context ) // track reactive dependency, see the getRuntimeContext
12221229 if ( isNumber ( ret ) && ret === NOT_REOSLVED ) {
12231230 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+ }
12311240 // for vue-devtools timeline event
12321241 if ( __DEV__ ) {
12331242 const {
@@ -1243,7 +1252,7 @@ export function createComposer<
12431252 }
12441253 }
12451254 }
1246- return _fallbackRoot && __root
1255+ return __root && _fallbackRoot
12471256 ? fallbackSuccess ( ( __root as unknown ) as Composer < T > & ComposerInternal )
12481257 : fallbackFail ( key )
12491258 } else if ( successCondition ( ret ) ) {
0 commit comments