Categorygithub.com/hyperscale-stack/translation
modulepackage
1.0.0
Repository: https://github.com/hyperscale-stack/translation.git
Documentation: pkg.go.dev

# README

Hyperscale Translation Last release Documentation

Go Report Card

BranchStatusCoverage
masterBuild StatusCoveralls

The Hyperscale translation library provides a simple translation manager over x/text package.

Example

package main

import (
    "fmt"

    "github.com/hyperscale-stack/locale"
    "github.com/hyperscale-stack/translation"
    "golang.org/x/text/language"
    "golang.org/x/text/message/catalog"
)

func main() {
    c := catalog.NewBuilder(catalog.Fallback(language.English))
    c.SetString(language.English, "Hello World", "Hello World")
    c.SetString(language.French, "Hello World", "Bonjour le monde")

    // the default language is always language.English, for override use translation.WithDefaultLocale()
    trans := translation.New(
        []language.Tag{
            language.English,
            language.French,
        },
        translation.WithCatalog(c),
    )

    ctx := context.Background()

    ctx = locale.ToContext(ctx, language.French)

    trans.Translate(ctx, "Hello World") // return Bonjour le monde
}

License

Hyperscale Translation is licensed under the MIT license.

# Functions

No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author

# Type aliases

No description provided by the author