From 2d43a115e364e3c886dfde195339572eb079880e Mon Sep 17 00:00:00 2001 From: Jonathan Cobb Date: Fri, 20 Dec 2019 12:10:21 -0500 Subject: [PATCH] add messageNotFoundHandler to show missing string resource keys --- src/_store/system.module.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/_store/system.module.js b/src/_store/system.module.js index 9f5c2d9..4a87ecb 100644 --- a/src/_store/system.module.js +++ b/src/_store/system.module.js @@ -140,6 +140,15 @@ const getters = { } }; +const messageNotFoundHandler = { + get: function (target, name) { + if (typeof name === 'undefined') return '???undefined'; + if (name === null) return '???null'; + if (name === '') return '???empty'; + return target.hasOwnProperty(name) ? target[name] : '???'+name.toString(); + } +}; + const mutations = { loadSystemConfigsRequest(state) {}, loadSystemConfigsSuccess(state, configs) { @@ -151,7 +160,7 @@ const mutations = { loadMessagesRequest(state) {}, loadMessagesSuccess(state, {group, messages}) { // console.log('loadMessages (group='+group+'), messages='+JSON.stringify(messages)); - state.messages = Object.assign({}, state.messages, messages); + state.messages = new Proxy(Object.assign({}, state.messages, messages), messageNotFoundHandler); if (messages.country_codes) { const countries = []; const codes = messages.country_codes.split(',');