.NET C# class for basic i18next functionality
In this minimal example, we create a i18n instance with InitOptions configuration in its construtor. Since no path have been specified, the i18next-net will load files from the default directory \locales\
relative to current running assembly:
{
"CONTENT": {
"COMMENT_ADD": "Commented \"{{text}}\" on {{type}} \"{{title}}\""
}
}
i18next i18n = new i18next(new InitOptions()
{
defaultNS = "common",
localeFileType = LocaleFileTypeEnum.Path,
fallbackLng = "en"
});
i18n.changeLanguage("pt");
var res = i18n.t("activities:CONTENT.COMMENT_ADD", new {text= "blablabla", type = "a pendencia", title = "Revisar orçamento" });
System.Console.WriteLine(res);
i18n.changeLanguage("en");
var res2 = i18n.t("activities:CONTENT.COMMENT_ADD", new { text = "blablabla", type = "a pendencia", title = "Revisar orçamento" });
System.Console.WriteLine(res2);
System.Console.ReadKey();
- Project structure
- Solution and project
- NuGet specification
- Basic Documentation
- Test project
- Examples
- Advanced Documentation
- Read locales files
- Pre Load option for all files locales files available
- Read locales from "Resource Files"
- Read locales from remote server / web
- Translate method with basic Interpolation
- Fallback capability
- Pluralization
- Auto detect current language
- Configurations
- Advanced features