Use Case

Generate Test Data in Multiple Locales with MockHero

The Problem

If your application serves users internationally, you need test data that reflects that. English-only test data hides bugs: names with accents break sorting, Japanese addresses overflow address fields, and German phone numbers fail your validation regex.

Most Faker libraries support locales, but you have to configure each field individually. Want French names with German addresses? You are writing custom logic for every combination.

The Solution: MockHero API

MockHero supports a locale parameter that applies to all locale-sensitive field types. Generate French names, Japanese addresses, or Brazilian phone numbers with a single parameter change.

Quick Setup

curl -X POST https://api.mockhero.dev/api/v1/generate \
  -H "x-api-key: mh_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "tables": [
    {
      "name": "users",
      "count": 10,
      "fields": [
        { "name": "id", "type": "uuid" },
        { "name": "name", "type": "full_name" },
        { "name": "email", "type": "email" },
        { "name": "phone", "type": "phone" },
        { "name": "address", "type": "street_address" },
        { "name": "city", "type": "city" }
      ]
    }
  ],
  "locale": "fr",
  "format": "json"
}'

Step-by-Step Guide

1. Choose your locales

MockHero supports locales like en, fr, de, ja, pt_BR, es, and many more.

2. Get your MockHero API key

Sign up at mockhero.dev/sign-up.

3. Generate data for multiple locales

Loop through your target locales, calling MockHero's API with a different locale parameter each time. Combine the results into a single dataset.

4. Insert into your database

Combine all locale arrays into a single users table, or keep them separate for locale-specific testing.

5. Test internationalization

Verify that your UI handles accented characters, different address formats, varying name lengths, and locale-specific phone number patterns.

Complete Example

Generate users in 5 different locales with a simple loop. Extend it by adding more tables or increasing counts for comprehensive i18n testing.

Why MockHero vs Faker / Manual Seeds

  • One parameter — set locale once and all fields adapt automatically.
  • Real locale data — names, cities, and addresses from actual locale dictionaries.
  • Mix and match — generate different locales for different tables in the same request.

Get Started

Free tier, no credit card. Sign up at mockhero.dev and test your app with truly international data.

M

MockHero Team

Guides and tutorials for generating realistic test data with the MockHero API.

Start generating test data for free

1,000 rows/month on the free tier. No credit card required.

Get Your API Key

Related Articles