Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

i18next-net

.NET C# class for basic i18next functionality

Basic usage

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:

Locale file

{
  "CONTENT": {
    "COMMENT_ADD": "Commented \"{{text}}\" on {{type}} \"{{title}}\""
  }
}

Code

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();

Output

image

To-do

  • 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

About

.NET C# class for basic i18next functionality

Resources

License

Releases

No releases published

Packages

No packages published