zipkin-server UI 404报错

本文探讨了Zipkin UI中出现404错误的原因,并深入分析了国际化语言加载机制导致的问题根源。通过解释jQuery.i18n.properties插件的工作原理,展示了如何根据浏览器语言设置动态加载相应语言文件的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

背景:
  • 在使用zipkin-server的UI的时候,发现页面上会报错从404问题:

zipkin语言报错

原因:
  • 这是因为使用了i18n的国际化语言加载能力,参见:
https://www.ibm.com/developerworks/cn/web/1305_hezj_jqueryi18n/  

其使用了jQuery.i18n.properties 插件,动态的根据浏览器的语言去加载相应的语言。
比如,浏览器是中文,它会去查找nav.properties、nav_zh.properties、nav_zh_CN.properties三个,其中,匹配顺序为:nav_zh>nav_zh_CN>nav,先匹配上后语言会应用,因此会出现404
* zipkin中的代码位置为:i18n.js

 export function i18nInit(file) {
  // https://github.com/jquery-i18n-properties/jquery-i18n-properties
  $.i18n.properties({
    name: file,
    path: contextRoot,
    mode: 'map',
    // do not append a unix timestamp when requesting the language (.properties) files
    // this allows them to be cached by the browser
    cache: true,
    // do not perform blocking XHR requests, as it blocks the entire browser, including
    // rendering
    async: true,
    callback: () => {
      $('[data-i18n]').each((index, item) => {
        if (item.tagName === 'INPUT' || item.tagName === 'SELECT') {
          $(item).attr('placeholder', $.i18n.prop($(item).attr('data-i18n')));
        } else {
          $(item).html($.i18n.prop($(item).attr('data-i18n')));
        }
      });
    }
  });
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值