()
| 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); |
nothing calls this directly
no test coverage detected