nicksnyder / go-i18n

Translate your Go program into multiple languages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Specifying the Tone (formal versus informal)

Dynom opened this issue · comments

Hi,

Mostly a question I think, but what would be the best approach to offer a formal and an informal variant of a given translation? Fluent recommends using the Tone, but I think this is a custom extension.

key = { TONE() ->
        [formal] ...
       *[informal] ...
    }

projectfluent/fluent#300

go-i18n doesn’t have any special handling for this so you would just treat these as two separate messages with two separate message ids.

localizer.Localize(&i18n.LocalizeConfig{
    DefaultMessage: &i18n.Message{
        ID: "HelloFormal",
        Other: "Hello",
    },
})

localizer.Localize(&i18n.LocalizeConfig{
    DefaultMessage: &i18n.Message{
        ID: "HelloInformal",
        Other: "Hi",
    },
})