Introduction
The GoFrame
framework provides a commonly used I18N
internationalization component, implemented by the gi18n
module.
Usage:
import "github.com/gogf/gf/v2/i18n/gi18n"
Interface Documentation:
https://pkg.go.dev/github.com/gogf/gf/v2/i18n/gi18n
Documents
📄️ I18N - Configuration
The I18N Internationalization component is one of the core components of the GoFrame framework, supporting multiple configuration file formats such as xml, ini, yaml, toml, etc., and compatible with multiple directory structures and file formats. Developers can achieve multilingual support through configuration. The system automatically recognizes language files and supports custom path settings. It is recommended to use standardized international language codes for file naming to ensure program multilingual compatibility.
📄️ I18N - Example
Using the i18n internationalization feature in the GoFrame framework, which includes object creation, language setting, commonly used methods, and integration with the view engine. It describes in detail how to manage language translation through singleton and independent objects, use SetLanguage and WithLanguage methods for language setting, and achieve keyword and template content translation through T and Tf methods. The article also demonstrates examples of performing internationalization operations through context settings and the view engine.