.NET C# class for basic i18next functionality
Switch branches/tags
Nothing to show
Clone or download
Latest commit febc7f7 Nov 11, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/i18next-net Initial version with very basic stuff Nov 11, 2017
.gitattributes 2 Oct 13, 2017
.gitignore 2 Oct 13, 2017
LICENSE Initial commit Oct 13, 2017
README.md Update README.md Nov 11, 2017

README.md

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