stringl10n

module
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2021 License: BSD-2-Clause

README

stringl10n

String localization tools for Go

Main use for these tools is the localization of error messages.

  • To create suitable errors use the type Err from package mistake.

  • To enrich errors with context, e.g. to build kind of trace, wrap them using fmt.Errorf and %w from the standard library.

  • To localize, use the translation tools, e.g. function L10nLocalizeError, generated by the l10n command.

  • To generate and to update the JSON input file for l10n use the l10nextract command.

OBSOLETE

The older package message and the older commands stringl10n and stringl10nextract are considered deprecated.

Install

Provided that your Go environment is ready, just do:

$ go get github.com/hwheinzen/stringl10n/...

Example

Some example code can be found in cmd/l10n/example.

Directories

Path Synopsis
cmd
l10nextract
Command stringl10nextract generates output data that can be used as input to the string localization tool stringl10n.
Command stringl10nextract generates output data that can be used as input to the string localization tool stringl10n.
stringl10n
Command stringl10n (string localization) generates two go source files that can be included in a Go project.
Command stringl10n (string localization) generates two go source files that can be included in a Go project.
stringl10nextract
Command stringl10nextract generates output data that can be used as input to the string localization tool stringl10n.
Command stringl10nextract generates output data that can be used as input to the string localization tool stringl10n.
Package message provides a message type that keeps fix and variable parts of a text message apart.
Package message provides a message type that keeps fix and variable parts of a text message apart.

Jump to

Keyboard shortcuts

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