
Mini lesson · English
How to add another language to your website
Give an assistant equivalent text for a second language and check that switching preserves the full page meaning and useful links.
Who is this for?
People who want visitors to use the same website in another language. You provide or review the wording; a coding assistant edits the supplied pages. No HTML knowledge is required.
Before you start
The supplied English/Turkish practice site and a coding assistant to open an HTTP preview. Use the supplied project facts; you do not need a personal portfolio to start. Have a competent reader check language meaning when available.
Estimated time: 19–31 min
Estimates for the supplied starter files with prerequisite accounts and tools ready. Setup, deployment queues and delivery/DNS waits take additional time. Translation review is separate from routing. Do not publish unchecked automatic translations.
What you will learn
- Keep the same facts and actions in both languages.
- Open each language directly and switch to its equivalent page.
- Find untranslated or contradictory content.
Step 1
Compare the same page in two languages
A translated menu alone does not translate the experience.
Open the supplied English page and Turkish page. They currently introduce the site and offer contact; the project section is the part you will add. Use the supplied fictional Neighbourhood library project rather than inventing your own work history.
Both languages must describe the same project, its status and where its link goes. A visitor should be able to learn what it does and find the same contact address in either language.
A concrete example
English: “Neighbourhood library — A simple page that makes opening hours and the address easy to find.” Turkish: “Mahalle kütüphanesi — Çalışma saatlerini ve adresi kolayca bulmayı sağlayan sade bir sayfa.” Both describe the supplied fictional example, not a launched personal achievement.
Use the supplied two-language site and project facts. Add equivalent project sections in English and Turkish while preserving status, links and contact meaning. Handle page-language and routing code for me. Show both direct URLs and help test the language switch, full text and contact task. Do not change facts to make a translation sound more impressive.Files for this step
Open or download the files below. When saving a project, keep the folder paths shown in the filenames.
How it works (optional)
Add another language without changing the site's promise
Translate a complete visitor task, not just the navigation labels.
A multilingual site needs equivalent useful content. If the Turkish page has only a translated title while the article and instructions remain English, visitors have not received a Turkish experience.
This practice site has /en/ and /tr/ pages with the same purpose and contact action. The lesson itself remains English. We keep the example small enough to review every translated element.
Worked example
The English invitation says to see the work and find contact information. Its Turkish counterpart makes the same offer; it does not introduce a service absent from the English page.
Extra implementation exercise
The language switch changes the menu but leaves the main instructions unchanged. What is incomplete?
Show a worked solution
Translate the instructions, metadata and action labels too. Then test the same task in both languages; matching menu labels alone are insufficient.
- Includes body content and action labels in the translation scope.
- Preserves the same visitor task and meaning.
Step 2
Open each language directly
Respect the visitor’s explicit language choice.
Ask your assistant to serve the supplied public folder over HTTP and show the direct /en/ and /tr/ addresses. Open each in a new window, then use Türkçe or English to switch to the corresponding page.
The selected address should determine the page language. The supplied site has no country redirect; adding a location guess must not take an English-URL visitor away from the English page.
A concrete example
Starting at /en/ shows “A small website, clearly explained”; choosing Türkçe opens /tr/ and “Küçük bir site, açık bir anlatım”. English takes the visitor back to /en/.
Files for this step
Open or download the files below. When saving a project, keep the folder paths shown in the filenames.
How it works (optional)
Give each language a reliable address
A shared link should open the language its URL specifies.
Serve the supplied folders and open each language URL directly. The HTML lang attribute describes the page's actual language, helping assistive tools use appropriate pronunciation.
The visible language switch is a normal link to the equivalent page. In a larger system, the explicit URL should beat a saved preference or country guess. Automatic defaults may help unprefixed entry, but should not send an /en/ visitor away from the English link they chose.
Worked example
A visitor in Türkiye opening /en/ still gets English. Country is a possible default, not stronger evidence than an explicit choice.
<html lang="tr">
<a href="../en/" lang="en" hreflang="en">English</a>Extra implementation exercise
Should an English URL redirect to Turkish merely because the visitor's country is Türkiye?
Show a worked solution
No. Serve English for /en/. Apply a country/browser default only where the visitor has not already selected a language.
- Keeps explicit URL choice authoritative.
- Distinguishes defaults from forced language changes.
Step 3
Ask for a complete language pass
Let the assistant update the whole section, not only its heading.
Give the assistant the two supplied library descriptions. Ask it to add the whole project section in both pages, preserve the fictional label and link both to the supplied practice-project destination. Let the assistant handle page files and link paths.
Compare the project title, description, status and link label in both languages. Leave a proper project name unchanged only when that is intentional; do not leave an ordinary description untranslated.
A concrete example
A Turkish heading above “A simple page that makes opening hours and the address easy to find” is an incomplete translation. The body should use the supplied equivalent Turkish sentence too.
Google: localized page versions
Files for this step
Open or download the files below. When saving a project, keep the folder paths shown in the filenames.
How it works (optional)
Connect equivalent pages for search engines
Use correct language alternatives and each page's own canonical URL.
Inspect canonical and alternate links in both pages. Replace the reserved YOUR-SITE.example origin before a real deployment. Both pages list the same English and Turkish alternatives.
Each language page has its own canonical address. Pointing the Turkish canonical at English would send a conflicting signal about which content should be indexed. Language metadata helps discovery; it does not guarantee indexing or ranking.
Only the /en/ and /tr/ content pages in this example carry canonical and alternate links; the root is a language-choice page. Each content page lists both alternatives, including itself. Before deployment, replace the example origin in both files and verify all four alternate destinations and both self-canonicals.
Worked example
The /tr/ page points its canonical to /tr/ and its English alternate to /en/. A copied English canonical left in the Turkish file is a common silent mistake.
Google: localized page versions
Extra implementation exercise
What must change when copying the English page to create the Turkish version?
Show a worked solution
Translate the visible text and title, set lang=tr and the Turkish canonical, and check that both versions reference the matching pair of alternate URLs.
- Updates actual text, lang, title and canonical.
- Keeps reciprocal language alternatives correct.
Step 4
Finish the same visitor journey twice
Keep a short record of meaning and navigation.
Finish the two project sections. From each direct language page, open the practice-project link and return using its English or Türkçe link. Then try the email address under Contact or İletişim.
The supplied hello@example.com address is a placeholder. You may inspect that both pages use the same email target during practice; replace it with your chosen public contact address before sharing your own site. Opening a mail app does not send a message.
A concrete example
A useful record separates meaning from behavior: the project descriptions agree; both project links reach project.html; both contact links use the same address. A fluent-reader review is a separate check.
Files for this step
Open or download the files below. When saving a project, keep the folder paths shown in the filenames.
- translation-review.txtDownload this file
- public/en/index.htmlDownload this file
- public/tr/index.htmlDownload this file
- worksheet.htmlDownload this file
- reference/assignment-walkthrough.txtDownload this file
- reference/public/en/index.htmlDownload this file
- reference/public/tr/index.htmlDownload this file
- reference/public/project.htmlDownload this file
How it works (optional)
Your assignment: translate a second section
Review meaning and navigation with the same task in both versions.
Add a short project section to both pages. Name the project, describe the same outcome and provide the same destination link. Have a competent reader review the language naturally rather than matching words mechanically.
Open each direct URL in a fresh browser context, follow the language link and perform the contact task. Record any missing or contradictory text. Do not add more languages before this pair is coherent.
Worked example
A project described as a prototype in English must not become a launched product in Turkish. Translation quality includes factual consistency.
The complete reference walkthrough is available in reference/assignment-walkthrough.txt. Compare its steps with your own result; fill the test record from observations in your own project.
Extra implementation exercise
Add equivalent project sections and complete the meaning/navigation review.
Show a worked solution
Add the same project to both content pages: EN 'Neighbourhood library — A simple page that makes opening hours and the address easy to find.' TR 'Mahalle kütüphanesi — Çalışma saatlerini ve adresi kolayca bulmayı sağlayan sade bir sayfa.' Keep the project's status and destination the same.
Review both complete reference pages. Their page lang, title, body, contact label, self-canonical and reciprocal alternates agree with each language. Replace the reserved origin in both files before a real deployment.
Open /en/ directly and then /tr/ directly; neither may be overridden by a location guess. Switch using the visible equivalent-page links and perform the contact task in each language.
- Both languages communicate the same accurate project status.
- Direct URLs and equivalent-page language links remain stable.
Common mistake
Measuring translation completion by the number of filled strings.
Was this lesson useful?
Leave a like, or share it with someone who could use it.
Continue learning
- How to build your first personal website
- How to publish your website from GitHub
- How to connect a custom domain to your website
- How to set up email on your own domain
- How to make your website usable on phones
- How to make website images load faster
- How to get website feedback in your inbox
- How to add email subscriptions to your website
- How to send automated emails from your website
- How to save form submissions in a database
- How to let people sign in to your website
- How to keep a page private
- How to let users edit their profile information
- How to let users upload images
- How to keep API keys out of your frontend
- How to show data from an external API on your website
- How to add an AI chatbot to your website
- How to make a chatbot answer from your own content
- How to add a blog to your website
- How to add search to your website
- How to help Google find your website
- How to fix your website preview when sharing a link
- How to measure visits and useful actions on your website
- How to let visitors book an appointment
- How to accept a payment on your website
- How to preview website changes before publishing
- How to undo a broken website deployment
- How to back up and restore your website data
- How to find and fix errors on your live website