我正在尝试根据服务器返回的值显示通知。我不知道如何使用刚收到的键值动态检索翻译值。
例如,值为error.response.data.errorDetailsCode
“invalid_credentials”,翻译为“Invalid credentials provided”
import i18n from './i18n';
$.notify({message: i18n.t("error.response.data.errorDetailsCode")}, options);
我在控制台上收到此警告:
vue-i18n.esm.js?a925:14 [vue-i18n] Cannot translate the value of keypath 'invalid_credentials'. Use the value of keypath as default.