MCPcopy
hub / github.com/github/docs / getPathWithLanguage

Function getPathWithLanguage

lib/path-utils.js:12–17  ·  view source on GitHub ↗
(href, languageCode)

Source from the content-addressed store, hash-verified

10// Add the language to the given HREF
11// /articles/foo -> /en/articles/foo
12export function getPathWithLanguage(href, languageCode) {
13 return slash(path.posix.join('/', languageCode, getPathWithoutLanguage(href))).replace(
14 patterns.trailingSlash,
15 '$1'
16 )
17}
18
19// Remove the language from the given HREF
20// /en/articles/foo -> /articles/foo

Callers 1

getRedirectFunction · 0.90

Calls 1

getPathWithoutLanguageFunction · 0.85

Tested by

no test coverage detected