i18n

command
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2025 License: MIT Imports: 4 Imported by: 0

README

Internationalization (i18n) Example

This example demonstrates how to get localized validation error messages in different languages.

Running the Example

go run examples/i18n/main.go

Localization Setup

// Get i18n instance
i18n, err := jsonschema.GetI18n()
if err != nil {
    log.Fatal(err)
}

// Create localizer for Simplified Chinese
localizer := i18n.NewLocalizer("zh-Hans")

// Get localized error messages
errors := result.ToLocalizeList(localizer)

Example Output

Instead of technical English errors like:

"message": "Value must be at least 0"

You get localized messages like:

"message": "数值必须至少为 0"

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL