String i18n utilities for the Go Programming Language

Overview

About polyglot

polyglot is a String translation package and tool for Go.

Setup

Make sure you have a working Go installation. See Getting Started

Now run go get github.com/lxn/polyglot and go get github.com/lxn/polyglot/polyglot.

How does it work?

  1. It's pretty simple. Wrap translatable strings in your code in a call to a func tr(source string, context ...string) string, e.g. tr("bla"). You have to provide this function for every package you wish to use polyglot from.
  2. After adding new translatable strings to your code, run the polyglot command, which scans your Go code for calls to a tr function. It will create or update JSON .tr files, adding new translatable strings that it finds.
  3. Translate the strings.

Please see the hellopolyglot example for more details.

You might also like...
Package strit introduces a new type of string iterator, along with a number of iterator constructors, wrappers and combinators.

strit Package strit (STRing ITerator) assists in development of string processing pipelines by providing a simple iteration model that allows for easy

User agent string parser in golang

User agent parsing useragent is a library written in golang to parse user agent strings. Usage First install the library with: go get xojoc.pw/userage

Lingo - Literate Programming with Go + Markdown

lingo: literate programming with Go + Markdown lingo is a simple tool for litera

Go library for the TOML language

go-toml Go library for the TOML format. This library supports TOML version v1.0.0-rc.3 Features Go-toml provides the following features for using data

Parses the Graphviz DOT language in golang

Parses the Graphviz DOT language and creates an interface, in golang, with which to easily create new and manipulate existing graphs which can be writ

Guess the natural language of a text in Go

guesslanguage This is a Go version of python guess-language. guesslanguage provides a simple way to detect the natural language of unicode string and

Unified text diffing in Go (copy of the internal diffing packages the officlal Go language server uses)

gotextdiff - unified text diffing in Go This is a copy of the Go text diffing packages that the official Go language server gopls uses internally to g

Simple HCL (HashiCorp Configuration Language) parser for your vars.

HCL to Markdown About To write a good documentation for terraform module, quite often we just need to print all our input variables as a fancy table.

An anthology of a variety of tools for the Persian language in Golang
An anthology of a variety of tools for the Persian language in Golang

Persian tools An anthology of a variety of tools for the Persian language in Golang Todos Bill calculator Digits Validate Bank card number. Find Bank'

Owner
Alexander Neumann
Alexander Neumann
Package i18n is a middleware that provides internationalization and localization for Flamego

i18n Package i18n is a middleware that provides internationalization and localization for Flamego. Installation The minimum requirement of Go is 1.16.

Flamego 4 Dec 14, 2022
The Freetype font rasterizer in the Go programming language.

The Freetype font rasterizer in the Go programming language. To download and install from source: $ go get github.com/golang/freetype It is an incom

Go 699 Dec 25, 2022
A simple programming language with emojis only

MOGEE mogee (pronounced ēˈmōjē) is an extremely simple interpreted programming language that consists solely of emojis. Similar to Brainfuck, mogee is

Barış İnandıoğlu 1 Nov 15, 2021
Interpreted Programming Language built in Go. Lexer, Parser, AST, VM.

Gago | Programming Language Built in Go if you are looking for the docs, go here Gago is a interpreted programming language. It is fully written in Go

Glaukio 4 May 6, 2022
Go (Golang) GNU gettext utilities package

Gotext GNU gettext utilities for Go. Features Implements GNU gettext support in native Go. Complete support for PO files including: Support for multil

Leonel Quinteros 363 Dec 18, 2022
Decode / encode XML to/from map[string]interface{} (or JSON); extract values with dot-notation paths and wildcards. Replaces x2j and j2x packages.

mxj - to/from maps, XML and JSON Decode/encode XML to/from map[string]interface{} (or JSON) values, and extract/modify values from maps by key or key-

Charles Banning 537 Dec 29, 2022
A Go slugify application that handles string

slugify A Go slugify application that handles string Example: package main import ( "fmt" "github.com/avelino/slugify" ) func main() { text := "E

Avelino 32 Sep 27, 2022
A fast string sorting algorithm (MSD radix sort)

Your basic radix sort A fast string sorting algorithm This is an optimized sorting algorithm equivalent to sort.Strings in the Go standard library. Fo

Algorithms to Go 181 Dec 18, 2022
A collection of well-known string hash functions, implemented in Go

This library is a collection of "well-known" 32-bit string hashes, implemented in Go. It includes: Java string hash ELF-32 Jenkins' One-A

Damian Gryski 64 Mar 3, 2022
String-matching in Golang using the Knuth–Morris–Pratt algorithm (KMP)

gokmp String-matching in Golang using the Knuth–Morris–Pratt algorithm (KMP). Disclaimer This library was written as part of my Master's Thesis and sh

Patrick-Ranjit D. Madsen 41 Dec 8, 2022