MCPcopy Index your code
hub / github.com/crisxuan/bestJavaer / localizeSidebar

Function localizeSidebar

assets/article-cards.js:233–257  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

231 }
232
233 function localizeSidebar() {
234 var sidebar = document.querySelector('.sidebar-nav');
235 var route = getCurrentRoute();
236 var locale = getSidebarLocale(route);
237 var handledLinks = [];
238
239 if (!sidebar) {
240 return;
241 }
242
243 sidebarLinks.forEach(function (item) {
244 var link = findSidebarLink(sidebar, item, handledLinks);
245
246 if (!link) {
247 return;
248 }
249
250 link.textContent = locale === 'zh' ? item.zhText : item.enText;
251 link.setAttribute('href', locale === 'zh' ? item.zhHref : item.enHref);
252 handledLinks.push(link);
253 });
254
255 localizeSidebarGroupLabels(sidebar, locale);
256 syncSidebarActiveState(sidebar, route, locale);
257 }
258
259 function getSidebarLocale(route) {
260 var normalizedRoute = normalizeRoute(route);

Callers

nothing calls this directly

Calls 5

getCurrentRouteFunction · 0.85
getSidebarLocaleFunction · 0.85
findSidebarLinkFunction · 0.85
syncSidebarActiveStateFunction · 0.85

Tested by

no test coverage detected