[{"data":1,"prerenderedAt":628},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fsite-kit\u002Flanguages":3,"docs-navigation":478,"docs-surround-\u002Fdocs\u002Fsite-kit\u002Flanguages":625},{"id":4,"title":5,"body":6,"description":470,"extension":471,"icon":472,"meta":473,"navigation":472,"path":474,"seo":475,"stem":476,"__hash__":477},"docs\u002Fdocs\u002F4.site-kit\u002F05.languages.md","Languages",{"type":7,"value":8,"toc":466},"minimark",[9,13,22,57,75,80,162,166,169,434,445,462],[10,11,5],"h1",{"id":12},"languages",[14,15,16,17,21],"p",{},"Every kit site lists its languages, its locales, in ",[18,19,20],"code",{},"src\u002Fsite.config.ts",", the default first. A site in one language lists one:",[23,24,29],"pre",{"className":25,"code":26,"language":27,"meta":28,"style":28},"language-ts shiki shiki-themes github-dark","locales: [{ code: \"en\", tag: \"en-US\" }],\n","ts","",[18,30,31],{"__ignoreMap":28},[32,33,36,40,44,48,51,54],"span",{"class":34,"line":35},"line",1,[32,37,39],{"class":38},"svObZ","locales",[32,41,43],{"class":42},"s95oV",": [{ code: ",[32,45,47],{"class":46},"sU2Wk","\"en\"",[32,49,50],{"class":42},", tag: ",[32,52,53],{"class":46},"\"en-US\"",[32,55,56],{"class":42}," }],\n",[14,58,59,60,62,63,66,67,70,71,74],{},"The ",[18,61,18],{}," is the suffix in content file names, such as ",[18,64,65],{},"about.en.md",". The ",[18,68,69],{},"tag"," sets the pages' ",[18,72,73],{},"lang"," attribute and the format of dates and numbers.",[76,77,79],"h2",{"id":78},"how-a-site-in-several-languages-works","How a site in several languages works",[81,82,83,105,127,137,146,156],"ul",{},[84,85,86,90,91,93,94,97,98,93,101,104],"li",{},[87,88,89],"strong",{},"Files."," A translation sits beside its source, with the same name and its own code: ",[18,92,65],{}," and ",[18,95,96],{},"about.de.md",". Every locale has its own settings, ",[18,99,100],{},"home",[18,102,103],{},"404"," page. Any other page or entry can exist in some locales only.",[84,106,107,110,111,114,115,118,119,122,123,126],{},[87,108,109],{},"URLs."," The default locale is served at the root and every other one under its path, such as ",[18,112,113],{},"\u002Fde",". A translated page can give its own URL segment with ",[18,116,117],{},"localSlug",", so ",[18,120,121],{},"services\u002Fpainting.de.md"," can be served at ",[18,124,125],{},"\u002Fde\u002Fleistungen\u002Fmalerarbeiten",".",[84,128,129,132,133,136],{},[87,130,131],{},"Links."," Content writes an internal link as the page's path in the default locale, such as ",[18,134,135],{},"\u002Fcontact",", in every locale. On a German page, the kit turns it into the German page's URL, when that page has a translation.",[84,138,139,142,143,145],{},[87,140,141],{},"The language switcher."," The ",[18,144,39],{}," header action or footer block links each page to its translations, or to the other locale's home page.",[84,147,148,151,152,155],{},[87,149,150],{},"Search engines."," Each page links its translations with ",[18,153,154],{},"hreflang",", and the sitemap lists every locale's URLs.",[84,157,158,161],{},[87,159,160],{},"The CMS config"," shows each locale side by side.",[76,163,165],{"id":164},"add-a-language","Add a language",[14,167,168],{},"To add German to a site in English:",[170,171,172,284,335,349,364],"ol",{},[84,173,174,175,177,178],{},"Add the locale to ",[18,176,20],{},", and give each collection whose German path differs a path per locale:",[23,179,181],{"className":25,"code":180,"language":27,"meta":28,"style":28},"locales: [\n  { code: \"en\", tag: \"en-US\" },\n  { code: \"de\", tag: \"de-DE\", path: \"\u002Fde\" },\n],\ncollections: {\n  news: { basePath: { en: \"\u002Fblog\", de: \"\u002Faktuelles\" } },\n},\n",[18,182,183,190,205,226,232,241,278],{"__ignoreMap":28},[32,184,185,187],{"class":34,"line":35},[32,186,39],{"class":38},[32,188,189],{"class":42},": [\n",[32,191,193,196,198,200,202],{"class":34,"line":192},2,[32,194,195],{"class":42},"  { code: ",[32,197,47],{"class":46},[32,199,50],{"class":42},[32,201,53],{"class":46},[32,203,204],{"class":42}," },\n",[32,206,208,210,213,215,218,221,224],{"class":34,"line":207},3,[32,209,195],{"class":42},[32,211,212],{"class":46},"\"de\"",[32,214,50],{"class":42},[32,216,217],{"class":46},"\"de-DE\"",[32,219,220],{"class":42},", path: ",[32,222,223],{"class":46},"\"\u002Fde\"",[32,225,204],{"class":42},[32,227,229],{"class":34,"line":228},4,[32,230,231],{"class":42},"],\n",[32,233,235,238],{"class":34,"line":234},5,[32,236,237],{"class":38},"collections",[32,239,240],{"class":42},": {\n",[32,242,244,247,250,253,255,258,261,264,267,270,272,275],{"class":34,"line":243},6,[32,245,246],{"class":38},"  news",[32,248,249],{"class":42},": { ",[32,251,252],{"class":38},"basePath",[32,254,249],{"class":42},[32,256,257],{"class":38},"en",[32,259,260],{"class":42},": ",[32,262,263],{"class":46},"\"\u002Fblog\"",[32,265,266],{"class":42},", ",[32,268,269],{"class":38},"de",[32,271,260],{"class":42},[32,273,274],{"class":46},"\"\u002Faktuelles\"",[32,276,277],{"class":42}," } },\n",[32,279,281],{"class":34,"line":280},7,[32,282,283],{"class":42},"},\n",[84,285,286,287,290,291,294,295,298,299],{},"In ",[18,288,289],{},"src\u002Fcontent\u002Fsettings\u002Fsite.en.yml",", name the language switcher under ",[18,292,293],{},"ui",", such as ",[18,296,297],{},"locales: Language",", and add the switcher to the header:",[23,300,304],{"className":301,"code":302,"language":303,"meta":28,"style":28},"language-yaml shiki shiki-themes github-dark","header:\n  actions:\n    - type: locales\n","yaml",[18,305,306,315,322],{"__ignoreMap":28},[32,307,308,312],{"class":34,"line":35},[32,309,311],{"class":310},"s4JwU","header",[32,313,314],{"class":42},":\n",[32,316,317,320],{"class":34,"line":192},[32,318,319],{"class":310},"  actions",[32,321,314],{"class":42},[32,323,324,327,330,332],{"class":34,"line":207},[32,325,326],{"class":42},"    - ",[32,328,329],{"class":310},"type",[32,331,260],{"class":42},[32,333,334],{"class":46},"locales\n",[84,336,337,338,341,342,345,346,348],{},"Copy ",[18,339,340],{},"site.en.yml"," to ",[18,343,344],{},"site.de.yml",", and translate it: the navigation, the interface strings under ",[18,347,293],{},", and the facts' values, under the same names.",[84,350,337,351,93,354,341,357,93,360,363],{},[18,352,353],{},"pages\u002Fhome.en.md",[18,355,356],{},"pages\u002F404.en.md",[18,358,359],{},"home.de.md",[18,361,362],{},"404.de.md",", and translate them. Translate the other pages and entries the German site should have the same way, keeping their section ids.",[84,365,366,367,370,371],{},"Rebuild the CMS config and the description of the site's content, ",[18,368,369],{},".hostsmith\u002Fschema.json",", which now lists German, then build and check:",[23,372,376],{"className":373,"code":374,"language":375,"meta":28,"style":28},"language-bash shiki shiki-themes github-dark","npm run decap-config\nnpx site-kit schema\nnpm run build\nnpm run check:urls\nnpm run check:styles -- --built\n","bash",[18,377,378,389,400,409,418],{"__ignoreMap":28},[32,379,380,383,386],{"class":34,"line":35},[32,381,382],{"class":38},"npm",[32,384,385],{"class":46}," run",[32,387,388],{"class":46}," decap-config\n",[32,390,391,394,397],{"class":34,"line":192},[32,392,393],{"class":38},"npx",[32,395,396],{"class":46}," site-kit",[32,398,399],{"class":46}," schema\n",[32,401,402,404,406],{"class":34,"line":207},[32,403,382],{"class":38},[32,405,385],{"class":46},[32,407,408],{"class":46}," build\n",[32,410,411,413,415],{"class":34,"line":228},[32,412,382],{"class":38},[32,414,385],{"class":46},[32,416,417],{"class":46}," check:urls\n",[32,419,420,422,424,427,431],{"class":34,"line":234},[32,421,382],{"class":38},[32,423,385],{"class":46},[32,425,426],{"class":46}," check:styles",[32,428,430],{"class":429},"sDLfK"," --",[32,432,433],{"class":429}," --built\n",[14,435,436,437,440,441,444],{},"The default locale's URLs don't change, so the old site's URLs still pass ",[18,438,439],{},"check:urls",". A theme from a release before 0.6 doesn't style the switcher yet: ",[18,442,443],{},"check:styles -- --built"," names its hooks.",[14,446,447,448,455,456,461],{},"The README's ",[449,450,454],"a",{"href":451,"rel":452},"https:\u002F\u002Fgithub.com\u002Fhostsmith\u002Fsite-kit-astro\u002Fblob\u002Fmain\u002FREADME.md#locales",[453],"nofollow","Locales"," has every option, and the full ",[449,457,460],{"href":458,"rel":459},"https:\u002F\u002Fgithub.com\u002Fhostsmith\u002Fsite-kit-astro\u002Fblob\u002Fmain\u002FREADME.md#adding-a-language",[453],"steps",", including a site's own templates.",[463,464,465],"style",{},"html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .s4JwU, html code.shiki .s4JwU{--shiki-default:#85E89D}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}",{"title":28,"searchDepth":192,"depth":192,"links":467},[468,469],{"id":78,"depth":192,"text":79},{"id":164,"depth":192,"text":165},"How a kit site serves several languages - file names per language, URLs per locale, links, the language switcher, and adding a language.","md",null,{},"\u002Fdocs\u002Fsite-kit\u002Flanguages",{"title":5,"description":470},"docs\u002F4.site-kit\u002F05.languages","2mPhyibRIyC5D2TL-5w7N-U8P3M3-eHXvpH3x3nOBhg",[479],{"title":480,"path":481,"stem":482,"children":483,"page":624},"Docs","\u002Fdocs","docs",[484,511,523,558,606],{"title":485,"path":486,"stem":487,"children":488,"page":-1,"icon":490},"Getting Started","\u002Fdocs\u002Fgetting-started","docs\u002F1.getting-started\u002Findex",[489,491,495,499,503,507],{"title":485,"path":486,"stem":487,"icon":490},"solar:rocket-bold",{"title":492,"path":493,"stem":494},"Introduction","\u002Fdocs\u002Fgetting-started\u002Fintroduction","docs\u002F1.getting-started\u002F1.introduction",{"title":496,"path":497,"stem":498},"Quick Start","\u002Fdocs\u002Fgetting-started\u002Fquick-start","docs\u002F1.getting-started\u002F2.quick-start",{"title":500,"path":501,"stem":502},"Sites","\u002Fdocs\u002Fgetting-started\u002Fsites","docs\u002F1.getting-started\u002F3.sites",{"title":504,"path":505,"stem":506},"Custom Domains","\u002Fdocs\u002Fgetting-started\u002Fcustom-domains","docs\u002F1.getting-started\u002F4.custom-domains",{"title":508,"path":509,"stem":510},"Support","\u002Fdocs\u002Fgetting-started\u002Fsupport","docs\u002F1.getting-started\u002F5.support",{"title":512,"path":513,"stem":514,"children":515,"page":-1,"icon":517},"Integrations","\u002Fdocs\u002Fintegrations","docs\u002F2.integrations\u002Findex",[516,518],{"title":512,"path":513,"stem":514,"icon":517},"ph:usb-bold",{"title":519,"path":520,"stem":521,"icon":522},"n8n","\u002Fdocs\u002Fintegrations\u002Fn8n","docs\u002F2.integrations\u002F1.n8n","simple-icons:n8n",{"title":524,"path":525,"stem":526,"children":527,"page":-1,"icon":529},"MCP","\u002Fdocs\u002Fmcp","docs\u002F3.mcp\u002Findex",[528,530,534,538,542,546,550,554],{"title":524,"path":525,"stem":526,"icon":529},"solar:plug-circle-bold",{"title":531,"path":532,"stem":533},"Quick start","\u002Fdocs\u002Fmcp\u002Fquick-start","docs\u002F3.mcp\u002F1.quick-start",{"title":535,"path":536,"stem":537},"Clients","\u002Fdocs\u002Fmcp\u002Fclients","docs\u002F3.mcp\u002F2.clients",{"title":539,"path":540,"stem":541},"Authentication","\u002Fdocs\u002Fmcp\u002Fauthentication","docs\u002F3.mcp\u002F3.authentication",{"title":543,"path":544,"stem":545},"Tools","\u002Fdocs\u002Fmcp\u002Ftools","docs\u002F3.mcp\u002F4.tools",{"title":547,"path":548,"stem":549},"Recipes","\u002Fdocs\u002Fmcp\u002Frecipes","docs\u002F3.mcp\u002F5.recipes",{"title":551,"path":552,"stem":553},"Limits and errors","\u002Fdocs\u002Fmcp\u002Flimits-and-errors","docs\u002F3.mcp\u002F6.limits-and-errors",{"title":555,"path":556,"stem":557},"FAQ","\u002Fdocs\u002Fmcp\u002Ffaq","docs\u002F3.mcp\u002F7.faq",{"title":559,"path":560,"stem":561,"children":562,"page":-1,"icon":564},"Site kit","\u002Fdocs\u002Fsite-kit","docs\u002F4.site-kit\u002Findex",[563,565,569,573,577,581,582,586,590,594,598,602],{"title":559,"path":560,"stem":561,"icon":564},"solar:layers-bold",{"title":566,"path":567,"stem":568},"Overview","\u002Fdocs\u002Fsite-kit\u002Foverview","docs\u002F4.site-kit\u002F01.overview",{"title":570,"path":571,"stem":572},"Start a site","\u002Fdocs\u002Fsite-kit\u002Fstart-a-site","docs\u002F4.site-kit\u002F02.start-a-site",{"title":574,"path":575,"stem":576},"Content","\u002Fdocs\u002Fsite-kit\u002Fcontent","docs\u002F4.site-kit\u002F03.content",{"title":578,"path":579,"stem":580},"Design","\u002Fdocs\u002Fsite-kit\u002Fdesign","docs\u002F4.site-kit\u002F04.design",{"title":5,"path":474,"stem":476},{"title":583,"path":584,"stem":585},"Deploy with Hostsmith","\u002Fdocs\u002Fsite-kit\u002Fdeploy","docs\u002F4.site-kit\u002F06.deploy",{"title":587,"path":588,"stem":589},"Keep old URLs","\u002Fdocs\u002Fsite-kit\u002Fold-urls","docs\u002F4.site-kit\u002F07.old-urls",{"title":591,"path":592,"stem":593},"Work with an AI agent","\u002Fdocs\u002Fsite-kit\u002Fai-agents","docs\u002F4.site-kit\u002F08.ai-agents",{"title":595,"path":596,"stem":597},"Kit updates","\u002Fdocs\u002Fsite-kit\u002Fupdates","docs\u002F4.site-kit\u002F09.updates",{"title":599,"path":600,"stem":601},"Existing Astro sites","\u002Fdocs\u002Fsite-kit\u002Fexisting-astro-sites","docs\u002F4.site-kit\u002F10.existing-astro-sites",{"title":603,"path":604,"stem":605},"External CMS","\u002Fdocs\u002Fsite-kit\u002Fexternal-cms","docs\u002F4.site-kit\u002F11.external-cms",{"title":607,"path":608,"stem":609,"children":610,"page":-1,"icon":612},"Developers","\u002Fdocs\u002Fdevelopers","docs\u002F5.developers\u002Findex",[611,613,616,620],{"title":607,"path":608,"stem":609,"icon":612},"solar:code-bold",{"title":539,"path":614,"stem":615},"\u002Fdocs\u002Fdevelopers\u002Fauthentication","docs\u002F5.developers\u002F1.authentication",{"title":617,"path":618,"stem":619},"API Explorer","\u002Fdocs\u002Fdevelopers\u002Fapi-explorer","docs\u002F5.developers\u002F2.api-explorer",{"title":621,"path":622,"stem":623},"Node.js SDK","\u002Fdocs\u002Fdevelopers\u002Fsdk","docs\u002F5.developers\u002F3.sdk",false,[626,627],{"title":578,"path":579,"stem":580,"children":-1},{"title":583,"path":584,"stem":585,"children":-1},1792842401835]