Using Locales
Pseudata generates culturally appropriate data for multiple languages and regions. Names, addresses, phone numbers, and other data vary by locale to ensure your test data looks authentic for users in different countries.
How Locale Support Works
Section titled “How Locale Support Works”Pseudata organizes locale data into bundles—collections of related locales grouped by geography or business regions. Instead of loading all locale data at once, you choose which bundle to use based on your application’s target markets.
Key benefits:
- Small footprint: Only load the locales you need
- Tree-shaking optimized: Build tools automatically eliminate unused locale data
- Culturally authentic: Names and addresses match real-world patterns per locale
- Easy to expand: Start with one region, add more as you grow
What varies by locale:
- Person names (e.g., “John Smith” vs “田中 太郎” vs “محمد العلي”)
- Addresses (cities, states, street names, postal codes)
- Phone number formats
- Month and weekday names
What stays the same:
- Email domains (gmail.com, yahoo.com, etc.)
- Generated IDs and UUIDs
- Numeric values
Default Behavior
Section titled “Default Behavior”By default, Pseudata loads only the US bundle (which currently contains only en_us locale). This means you can start using Pseudata immediately without any configuration:
package main
import ( "fmt" "github.com/pseudata/pseudata")
func main() { users := pseudata.NewUserArray(42) user := users.At(1000) fmt.Println(user.Name) // → "John Smith"}import dev.pseudata.UserArray;
public class Example { public static void main(String[] args) { UserArray users = new UserArray(42); User user = users.at(1000); System.out.println(user.getName()); // → "John Smith" }}from pseudata import UserArray
users = UserArray(42)user = users.at(1000)print(user.name) # → "John Smith"import { UserArray } from "@pseudata/core";
const users = new UserArray(42n);const user = users.at(1000);console.log(user.name); // → "John Smith"When to Use Different Bundles
Section titled “When to Use Different Bundles”Use the default US bundle for:
- MVPs and prototypes
- US-only applications
- Development and demos
- Minimal footprint
Switch to a different bundle when:
- Targeting multiple countries or regions
- Building enterprise applications with regional divisions
- Supporting international markets
- Testing locale-specific features
Choosing a Bundle
Section titled “Choosing a Bundle”Starting a new project?
- Stick with the default US bundle (no imports needed)
- Upgrade to a different bundle when you expand
Need a specific country?
- Use single-country bundles (e.g.,
CA,BR,JP) - Automatically available for all supported countries
Expanding to a region?
- North America: Import NA bundle (US, Canada, Mexico)
- South America: Import SA bundle (Brazil)
- Europe: Import EU bundle (6 locales)
- Asia-Pacific: Import APAC bundle (4 locales)
- Middle East & Africa: Import MEA bundle (2 locales)
Enterprise with regional divisions?
- Americas: Import AMER bundle (covers NA + SA)
- EMEA: Import EMEA bundle (covers EU + MEA)
Need maximum coverage?
- Import World bundle (all supported locales)
See complete bundle list and locale details →
Using a Different Bundle
Section titled “Using a Different Bundle”Import a bundle and pass it via options to use locales from that region.
import ( "github.com/pseudata/pseudata" "github.com/pseudata/pseudata/resources/bundles/na")
users := pseudata.NewUserArray(42, pseudata.WithResources(na.Resources))import dev.pseudata.UserArray;import dev.pseudata.resources.bundles.na.Resources;
UserArray users = new UserArray(42, Resources.INSTANCE);from pseudata import UserArrayfrom pseudata.resources.bundles.na import Resources
users = UserArray(42, resources=Resources)import { UserArray } from '@pseudata/core';import { Resources } from '@pseudata/core/resources/bundles/na';
const users = new UserArray(42n, { resources: Resources });Available Bundles
Section titled “Available Bundles”For complete bundle information, locale details, and advanced usage patterns, see the Locales Reference.
© 2025 Pseudata Project. Open Source under Apache License 2.0. · RSS Feed