Configuration and Internationalization (i18n)
Configuration and Internationalization (i18n)
1. Configuration Files
Application configuration should live in conf/config.yaml at the root of the app:
app:
name: "demo-app"
version: "1.0.0"
env: "production"
log:
level: "info"
output: "stdout"
features:
enable_terminal: true
max_concurrency: 5The Go backend reads and parses it into strongly typed structs with gopkg.in/yaml.v3.
2. Internationalization
Micro-apps on GM Desktop need to adapt to different languages.
package i18n
import "embed"
//go:embed locales/*.json
var localeFS embed.FS
type I18n struct {
lang string
}
func (i *I18n) T(key string) string {
// Return the translation for the current locale
return translate(i.lang, key)
}