项目作者: exomia

项目描述 :
support different languages in your application
高级语言: C#
项目地址: git://github.com/exomia/language.git
创建时间: 2018-03-25T21:35:39Z
项目社区:https://github.com/exomia/language

开源协议:BSD 3-Clause "New" or "Revised" License

下载


Information

exomia/language support different languages in your application








Installing

  1. [Package Manager]
  2. PM> Install-Package Exomia.Language

Example

  1. static void Main(string[] args)
  2. {
  3. ITranslator translator = new Translator(".", "en");
  4. translator.Load("example.phrases");
  5. //translator.Load("example2.phrases");
  6. Console.WriteLine(translator.Format("here we go... %t", "hello world")); //here we go... Hello World
  7. Console.WriteLine(translator.Format("%T", "say", "exomia", "hello world")); //exomia say: 'Hello World'
  8. Console.WriteLine(translator.Format("%t", "say2", "exomia")); //exomia say: 'this is an example'
  9. Console.ReadKey();
  10. }

example.phrases

  1. "phrases"
  2. {
  3. "hello world"
  4. {
  5. "en" "Hello World"
  6. "de" "Hallo Welt"
  7. }
  8. "say"
  9. {
  10. "en" "{0} say: '{1:T}'"
  11. "de" "{0} sagt: '{1:T}'"
  12. }
  13. "say2"
  14. {
  15. "en" "{0} say: '{1:example}'"
  16. "de" "{0} sagt: '{1:example}'"
  17. }
  18. "example"
  19. {
  20. "en" "this is an example"
  21. "de" "dies ist ein Beispiel"
  22. }
  23. }

Social

Discord
Twitch