This is a simple i18n library which uses JSON resources as input.
An example of such a JSON resource is:
{
"key": {
"language1": "value",
"language2": "value",
"language3": "value"
}
}
The following lines of code show how to use the default manager with the default directory (./files) for looking up a value for a key and a specific language.
manager := i18n.GetManager()
value, err := manager.Get("key", "language")
if err != nil {
// do error handling
}
// use value
Other repositories (other directories, ...) with the default manager implementation are available with the consrtuctor function NewDefaultManager. If you want to access other resources (e.g. network resources, ...) feel free to provide the NewDefaultManager function with own implementations of resource.Repository and resource.Adapter.