Soluling home   Document home

Go Localization and Internationalization

Go Localization and Internationalization

Go (Wikipedia) is a popular programming language. Soluling localization tool and service support go resource files.

The end of the document contains links to get the full source code of the samples. After reading this document, we recommend reading a tutorial about how to use Soluling.


Use go-i18n (homepage) package to internationalize your code. Start by installing go-i18n.

go get -u

Import go-i18n into your code.

import ""

Create a localization bundle.

bundle := i18n.NewBundle(language.English)

Load translations into your bundle.

bundle.RegisterUnmarshalFunc("json", json.Unmarshal)
// Add your language(s) here. This loads English, German and Finnish. 

Set the active language.

localizer := i18n.NewLocalizer(bundle, "fi")  // Select Finnish

Use the localizer to translate strings.

fmt.Println("Hello World")

Change the above line.

    DefaultMessage: &i18n.Message{
      ID: "HelloWorld",
      Other: "Hello World"},

The syntax go-i18n uses, is a bit verbose, but it is also very flexible.

You can use interpolated strings.

    DefaultMessage: &i18n.Message{
      ID: "HelloName",
      Other: "Hello {{.name}}!",
  TemplateData: map[string]interface{}{
    "name": "John",

You can use plural enabled messages.

    DefaultMessage: &i18n.Message{
      ID: "Skis",
      One: "I have {{.ski}} ski.",
      Other: "I have {{.ski}} skis.",
    TemplateData: map[string]interface{}{
      "ski": 2,
    PluralCount: 2,

Once you have internationalized your code run the extractor tool. go-i18n supports three resource file formats: JSON, YAML, and TOML. Soluling supports JSON.

goi18n extract -format json

The extractor creates a resource file called active.en.json.

Create a Soluling project

Now it is time to create a Soluling project for our resource file. Start Soluling. Drag and drop active.en.json file into Soluling or click New from File or Files and browse the active.en.json file. The project wizard shows the Select File Type dialog.

Localized options

Select go-i18n file and click OK. Select Languages page appears. Add the languages you want to support and also select the original language.

Select languages

We added Finnish and German as target languages and English as the original language. Complete the wizard by clicking Finish. A new project appears.

New project

Next, translate the strings.

Translated project

Finally, click Build All to build the localized resource files ( and in the same directory as the original active.en.json.


GitHub and <data-dir>\Samples\Go contains following Go samples:

Directory Description
Simple A simple sample that uses go-i18n package and shows how to localize plain, interpolated, and plural messages.

Configuring Go Localization

You create a resource file localization project by adding an Go resource file (e.g. D:\Sample\active.en.json) into your Soluling project. You can configure how to localize your Go resource file by selecting the item in the project tree, right-clicking, and choosing the Options menu. A source dialog appears that lets you edit the options. This source uses the following option sheets.