Search code examples
htmlweblang

html page, changing language


Question about Language Settings for Website

For Example: I have 3 web pages connected with hyperlinks(from page01 --> page02/page03 and back) . I want to change the language on page 1. (i. e. with a Select Button).
After the language change , all 3 pages should show the content in the new language.

Can the Server send a kind of language file which each Website can search for the language tags?


Solution

  • Provide different URLs for different languages.

    /en-us/page1
    /en-us/page2
    /en-us/page3
    /es-es/page1
    /es-es/page2
    /es-es/page3
    

    Then just use relative URLs between them.

    <ul>
        <li> <a href="page1">Page 1</a> </li>
        <li> <a href="page2">Page 2</a> </li>
        <li> <a href="page3">Page 3</a> </li>
    </ul>
    
    <a href="../es-es/page1" lang="es-es" hreflang="es-es">español</a>