# Go JSON

> Localization of the go-i18n JSON files

URL: https://store.crowdin.com/go-json
Identifier: go-json
Category: File Formats
Type: System
Author: Crowdin

[go-i18n](https://github.com/nicksnyder/go-i18n) is one of the most popular internationalization (i18n) libraries for the Go programming language. Crowdin has native support for JSON files produced by go-i18n.



The placeholder syntax can be `{{ var }}`, `{var}`, or `%[1]d`. Crowdin will automatically detect the most widely used variable formats, and highlight and validate them in the editor.

## File Format Details

| Attribute | Value |
| --------- | ----- |
| File Extension | .json |
| [API Type](https://developer.crowdin.com/api/v2/#operation/api.projects.files.post) | go_json |
| Source can be edited in Crowdin | No |
| Generating translated files via [Bundles](https://support.crowdin.com/bundles/) | [Search Crowdin Store](https://store.crowdin.com/tags/string-exporter) |
| Supports pluralization | Yes |
| WYSIWYG Preview in the editor | No |
| Supported types of contextual information | Text comments, Screenshots, In-Context |
| Custom attributes | No |
| Existing translations import possibility | Key-value mapping |

## Sample File

```json
{
    "language": "en",
    "messages": [
        {
            "id": "Error",
            "message": "Error",
            "translation": "Error",
            "comment": "This is context",
            "fuzzy": true
        },
        {
            "id": "Invalid IP address",
            "message": "Invalid IP address",
            "translation": "Invalid IP address",
            "translatorComment": "Copied from source.",
            "fuzzy": true
        },
        {
            "id": "Invalid network prefix length",
            "message": "Invalid network prefix length",
            "translation": "Invalid network prefix length"
        },
        {
            "id": "Usage: {Args0} \n[{String}]",
            "message": "Usage: {Args0} \n[{String}]",
            "translation": "Usage: {Args0} \n[{String}]",
            "translatorComment": "Copied from source.",
            "placeholders": [
                {
                    "id": "Args0",
                    "string": "%[1]s",
                    "type": "string",
                    "underlyingType": "string",
                    "argNum": 1,
                    "expr": "os.Args[0]"
                },
                {
                    "id": "String",
                    "string": "%[2]s",
                    "type": "string",
                    "underlyingType": "string",
                    "argNum": 2,
                    "expr": "builder.String()"
                }
            ],
            "fuzzy": true
        },
        {
            "id": "{Years} year(s)",
            "message": "{Years} year(s)",
            "translation": {
                "select": {
                    "feature": "plural",
                    "arg": "Years",
                    "cases": {
                        "one": {
                            "msg": "{Years} year"
                        },
                        "other": {
                            "msg": "{Years} years"
                        }
                    }
                }
            },
            "placeholders": [
                {
                    "id": "Years",
                    "string": "%[1]d",
                    "type": "int64",
                    "underlyingType": "int64",
                    "argNum": 1,
                    "expr": "years"
                }
            ]
        },
        {
            "id": "{Hours} hour(s)",
            "message": "{Hours} hour(s)",
            "translation": {
                "select": {
                    "feature": "plural",
                    "arg": "Hours",
                    "cases": {
                        "one": {
                            "msg": "{Hours} hour"
                        },
                        "other": {
                            "msg": "{Hours} hours"
                        }
                    }
                }
            },
            "placeholders": [
                {
                    "id": "Hours",
                    "string": "%[1]d",
                    "type": "int64",
                    "underlyingType": "int64",
                    "argNum": 1,
                    "expr": "hours"
                }
            ]
        },
        {
            "id": "{Hours} hour(s)",
            "message": "{Hours} hour(s)",
            "translation": {
                "select": {
                    "feature": "plural",
                    "arg": "Hours",
                    "cases": {
                        "one": "{Hours} hour",
                        "other": "{Hours} hours"
                    }
                }
            },
            "placeholders": [
                {
                    "id": "Hours",
                    "string": "%[1]d",
                    "type": "int64",
                    "underlyingType": "int64",
                    "argNum": 1,
                    "expr": "hours"
                }
            ]
        }
    ]
}
```

## Translating Go JSON


**Note**: To upload Go JSON, use API or CLI specifying the localization type: “go_json”
