language.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. package types
  2. const (
  3. // SubNameKeywordChineseSimple 用于区分字幕是简体中文还是繁体中文
  4. SubNameKeywordChineseSimple = "chs"
  5. SubNameKeywordTraditional = "cht"
  6. )
  7. // Language 语言类型,注意,这里默认还是查找的是中文字幕,只不过下载的时候可能附带了其他的
  8. type Language int
  9. const (
  10. Unknow Language = iota // 未知语言
  11. ChineseSimple // 简体中文
  12. ChineseTraditional // 繁体中文
  13. ChineseSimpleEnglish // 简英双语字幕
  14. ChineseTraditionalEnglish // 繁英双语字幕
  15. English // 英文
  16. Japanese // 日语
  17. ChineseSimpleJapanese // 简日双语字幕
  18. ChineseTraditionalJapanese // 繁日双语字幕
  19. Korean // 韩语
  20. ChineseSimpleKorean // 简韩双语字幕
  21. ChineseTraditionalKorean // 繁韩双语字幕
  22. )
  23. // 参考 https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes 标准
  24. const (
  25. ChineseAbbr_639_1 = "zh"
  26. ChineseAbbr_639_2T = "zho"
  27. ChineseAbbr_639_2B = "chi"
  28. )
  29. const (
  30. Sub_Ext_Mark_Default = ".default" // 指定这个字幕是默认的
  31. Sub_Ext_Mark_Forced = ".forced" // 指定这个字幕是强制的
  32. )
  33. // 需要符合 emby_helper 的格式要求,在后缀名前面
  34. const (
  35. Emby_default = ".default" // 指定这个字幕是默认的
  36. Emby_unknow = ".unknow" // 未知语言
  37. Emby_chinese = ".chinese" // 中文
  38. Emby_chi = ".chi" // 简体
  39. Emby_chn = ".chn" // 中国国家代码
  40. Emby_chs = ".chs" // 简体
  41. Emby_cht = ".cht" // 繁体
  42. Emby_chs_en = ".chs_en" // 简英双语字幕
  43. Emby_cht_en = ".cht_en" // 繁英双语字幕
  44. Emby_en = ".en" // 英文
  45. Emby_jp = ".jp" // 日语
  46. Emby_chs_jp = ".chs_jp" // 简日双语字幕
  47. Emby_cht_jp = ".cht_jp" // 繁日双语字幕
  48. Emby_kr = ".kr" // 韩语
  49. Emby_chs_kr = ".chs_kr" // 简韩双语字幕
  50. Emby_cht_kr = ".cht_kr" // 繁韩双语字幕
  51. )
  52. const (
  53. MathLangChnUnknow = "未知语言"
  54. MatchLangDouble = "双语"
  55. MatchLangChs = "简"
  56. MatchLangCht = "繁"
  57. MatchLangChsEn = "简英"
  58. MatchLangChtEn = "繁英"
  59. MatchLangEn = "英"
  60. MatchLangJp = "日"
  61. MatchLangChsJp = "简日"
  62. MatchLangChtJp = "繁日"
  63. MatchLangKr = "韩"
  64. MatchLangChsKr = "简韩"
  65. MatchLangChtKr = "繁韩"
  66. )
  67. func (l Language) String() string {
  68. switch l {
  69. case ChineseSimple:
  70. return MatchLangChs
  71. case ChineseTraditional:
  72. return MatchLangCht
  73. case ChineseSimpleEnglish:
  74. return MatchLangChsEn
  75. case ChineseTraditionalEnglish:
  76. return MatchLangChtEn
  77. case English:
  78. return MatchLangEn
  79. case Japanese:
  80. return MatchLangJp
  81. case ChineseSimpleJapanese:
  82. return MatchLangChsJp
  83. case ChineseTraditionalJapanese:
  84. return MatchLangChtJp
  85. case Korean:
  86. return MatchLangKr
  87. case ChineseSimpleKorean:
  88. return MatchLangChsKr
  89. case ChineseTraditionalKorean:
  90. return MatchLangChtKr
  91. default:
  92. return MathLangChnUnknow
  93. }
  94. }