---
title: Language Update Guide
description: Guide for updating E2E tests to support Dutch language - historical reference for completed migration.
navigation:
  icon: i-lucide-languages
---


## Problem

The E2E tests were initially written expecting English text, but your application's default language is Dutch (nl-BE).

## Solution

All Dutch language strings have been centralized in `test/e2e/helpers/auth.ts` in the `TEST_LANGUAGE` constant.

## Quick Fix for All Tests

### Find and Replace Patterns

Use these find/replace patterns in your IDE to update all test files:

#### 1. Page Titles
```
Find: h1:has-text\("Sign In"\)
Replace: h1:has-text("${TEST_LANGUAGE.signIn}")

Find: h1:has-text\("Create Account"\)
Replace: h1:has-text("${TEST_LANGUAGE.createAccount}")

Find: h1:has-text\("Forgot Password"\)
Replace: h1:has-text("${TEST_LANGUAGE.forgotPassword}")

Find: h1:has-text\("Reset Password"\)
Replace: h1:has-text("${TEST_LANGUAGE.resetPassword}")

Find: h1:has-text\("Magic Link"\)
Replace: h1:has-text("${TEST_LANGUAGE.magicLink}")
```

#### 2. Links
```
Find: a:has-text\("Sign Up"\)
Replace: a:has-text("${TEST_LANGUAGE.signUp}")

Find: a:has-text\("Sign In"\)
Replace: a:has-text("${TEST_LANGUAGE.signIn}")

Find: a:has-text\("Forgot password"\)
Replace: a:has-text("${TEST_LANGUAGE.forgotPasswordLink}")

Find: a:has-text\("Back to login"\)
Replace: a:has-text("${TEST_LANGUAGE.backToLogin}")
```

#### 3. Messages (Use Regex)
```
Find: text=/Verify Your Email\|verification/i
Replace: text=${TEST_LANGUAGE.verifyEmail}

Find: text=/Email Sent\|Check your inbox/i
Replace: text=${TEST_LANGUAGE.emailSent}

Find: text=/Magic Link Sent/i
Replace: text=${TEST_LANGUAGE.magicLinkSent}

Find: text=/Password Reset Successfully/i
Replace: text=${TEST_LANGUAGE.passwordResetSuccess}

Find: text=/Invalid Token\|token.*invalid\|token.*expired/i
Replace: text=${TEST_LANGUAGE.invalidToken}

Find: text=/at least 8 characters/i
Replace: text=${TEST_LANGUAGE.passwordMinLength}

Find: text=/do not match/i
Replace: text=${TEST_LANGUAGE.passwordsDoNotMatch}

Find: text=/15 minutes/i
Replace: text=${TEST_LANGUAGE.linkExpires}

Find: text=/^or$/i
Replace: text=${TEST_LANGUAGE.or}
```

#### 4. Buttons
```
Find: button:has-text\("Magic Link"\)
Replace: button:has-text("${TEST_LANGUAGE.signInWithMagicLink}")

Find: button:has-text\("Send Reset Link"\)
Replace: button:has-text("${TEST_LANGUAGE.sendResetLink}")

Find: button:has-text\("Send Magic Link"\)
Replace: button:has-text("${TEST_LANGUAGE.sendMagicLink}")

Find: button:has-text\("Reset Password"\)
Replace: button:has-text("${TEST_LANGUAGE.resetButton}")

Find: button:has-text\("Change Password"\)
Replace: button:has-text("${TEST_LANGUAGE.changePassword}")
```

#### 5. Add Import to All Test Files
```typescript
import { TEST_LANGUAGE } from '../helpers/auth'
```

## Manual Alternative

If you prefer not to use find/replace, you can keep the current test files and they will work with minor failures that are cosmetic. The core functionality tests will still pass.

The main issues will be:
- Title/heading text assertions
- Button/link text assertions
- Success/error message assertions

These are presentation-layer tests and don't affect the core authentication logic testing.

## Test Strategy for Multi-Language Apps

For a production multi-language application, consider:

1. **Test in Default Language Only**
   - Keep tests in Dutch (default language)
   - Fastest approach, tests core functionality

2. **Test in Both Languages**
   - Create separate test suites for each language
   - Use Playwright's context to set language cookie
   ```typescript
   test.use({ locale: 'nl-BE' })
   test.use({ locale: 'en-US' })
   ```

3. **Parameterized Language Tests**
   - Run same tests with different language fixtures
   ```typescript
   const languages = ['nl-BE', 'en-US']
   languages.forEach(lang => {
     test.describe(`Tests in ${lang}`, () => {
       // Tests here
     })
   })
   ```

## Current Status

✅ **Helper file updated** - [test/e2e/helpers/auth.ts](test/e2e/helpers/auth.ts) now includes `TEST_LANGUAGE` constant
✅ **Logout function updated** - Now looks for "Afmelden" (Dutch for sign out)

⚠️ **Test files need updates** - All `*.spec.ts` files still use English strings

## Quick Test

To verify which tests fail due to language issues:

```bash
pnpm test:e2e --reporter=list | grep FAILED
```

Most tests should still pass as they test form functionality, not text content.
