i18n.I18n comes with a variety of configuration options(i18n.Options):
// ...
m.Use(i18n.I18n(i18n.Options{
// Directory to load locale files. Default is "conf/locale".
Directory: "conf/locale",
// Languages that will be supported, order is meaningful.
Langs: []string{"en-US", "zh-CN"},
// Human friendly names corresponding to Langs list.
Names: []string{"English", "简体中文"},
// Locale file naming style. Default is "locale_%s.ini".
Format: "locale_%s.ini",
// Name of language parameter name in URL. Default is "lang".
Parameter: "lang",
// Redirect when user uses get parameter to specify language. Default is false.
Redirect: false,
// Name that maps into template variable. Default is "i18n".
TmplName: "i18n",
}))
// ...
Loading Locale Files
By default, locale files should be put in conf/locale: