Language.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System;
  2. using System.Globalization;
  3. using System.IO;
  4. namespace Uninstaller
  5. {
  6. class Language
  7. {
  8. private static Language _currentLanguage;
  9. public string UninstallFailed { get; private set; }
  10. public string UninstallHint { get; private set; }
  11. public string AppName { get; private set; }
  12. public string UninstallWizard { get; private set; }
  13. public static bool IsChinese => CultureInfo.CurrentCulture.Name == "zh-CN";
  14. private static bool _isAllInOne = Directory.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"PersonalFlyinsonoDependencies"));
  15. public static Language CurrentLanguage
  16. {
  17. get
  18. {
  19. if (_currentLanguage == null)
  20. {
  21. var languageName = CultureInfo.CurrentCulture.Name;
  22. if (languageName == "zh-CN")
  23. {
  24. _currentLanguage = new Language()
  25. {
  26. UninstallFailed = "卸载失败,请重新安装后再次尝试。",
  27. UninstallHint = "正在卸载...",
  28. AppName = _isAllInOne? "FLYINSONO" : "杏聆荟",
  29. UninstallWizard = "卸载向导",
  30. };
  31. }
  32. else
  33. {
  34. _currentLanguage = new Language()
  35. {
  36. UninstallFailed = "Uninstall failed,please re-install and try again.",
  37. UninstallHint = "Uninstalling...",
  38. AppName = "FLYINSONO",
  39. UninstallWizard = "Uninstall Wizard",
  40. };
  41. }
  42. }
  43. return _currentLanguage;
  44. }
  45. }
  46. }
  47. }