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

Function getSidebarLocale

assets/article-cards.js:259–288  ·  view source on GitHub ↗
(route)

Source from the content-addressed store, hash-verified

257 }
258
259 function getSidebarLocale(route) {
260 var normalizedRoute = normalizeRoute(route);
261
262 if (
263 normalizedRoute === 'README.zh-CN' ||
264 normalizedRoute === 'ai-articles' ||
265 normalizedRoute.indexOf('ai-articles/') === 0 ||
266 normalizedRoute === 'ai-resources' ||
267 normalizedRoute.indexOf('ai-resources/') === 0 ||
268 normalizedRoute === 'works' ||
269 normalizedRoute.indexOf('works/') === 0 ||
270 normalizedRoute === 'development-guidelines' ||
271 normalizedRoute.indexOf('development-guidelines/') === 0
272 ) {
273 activeSidebarLocale = 'zh';
274 return activeSidebarLocale;
275 }
276
277 if (
278 normalizedRoute === '' ||
279 normalizedRoute === '/' ||
280 normalizedRoute === 'README' ||
281 normalizedRoute.indexOf('en/') === 0
282 ) {
283 activeSidebarLocale = 'en';
284 return activeSidebarLocale;
285 }
286
287 return activeSidebarLocale;
288 }
289
290 function findSidebarLink(sidebar, item, handledLinks) {
291 var hrefs = [item.enHref, item.zhHref].map(normalizeHashHref);

Callers 1

localizeSidebarFunction · 0.85

Calls 1

normalizeRouteFunction · 0.85

Tested by

no test coverage detected