ZLLanguageDefine.swift 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. //
  2. // ZLLanguageDefine.swift
  3. // ZLPhotoBrowser
  4. //
  5. // Created by long on 2020/8/17.
  6. //
  7. // Copyright (c) 2020 Long Zhang <495181165@qq.com>
  8. //
  9. // Permission is hereby granted, free of charge, to any person obtaining a copy
  10. // of this software and associated documentation files (the "Software"), to deal
  11. // in the Software without restriction, including without limitation the rights
  12. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13. // copies of the Software, and to permit persons to whom the Software is
  14. // furnished to do so, subject to the following conditions:
  15. //
  16. // The above copyright notice and this permission notice shall be included in
  17. // all copies or substantial portions of the Software.
  18. //
  19. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  25. // THE SOFTWARE.
  26. import Foundation
  27. @objc public enum ZLLanguageType: Int {
  28. case system
  29. case chineseSimplified
  30. case chineseTraditional
  31. case english
  32. case japanese
  33. case french
  34. case german
  35. case russian
  36. case vietnamese
  37. case korean
  38. case malay
  39. case italian
  40. }
  41. public struct ZLLocalLanguageKey: Hashable {
  42. public let rawValue: String
  43. public init(rawValue: String) {
  44. self.rawValue = rawValue
  45. }
  46. /// Camera (拍照)
  47. public static let previewCamera = ZLLocalLanguageKey(rawValue: "previewCamera")
  48. /// Record (拍摄)
  49. public static let previewCameraRecord = ZLLocalLanguageKey(rawValue: "previewCameraRecord")
  50. /// Album (相册)
  51. public static let previewAlbum = ZLLocalLanguageKey(rawValue: "previewAlbum")
  52. /// Cancel (取消)
  53. public static let cancel = ZLLocalLanguageKey(rawValue: "cancel")
  54. /// No Photo (无照片)
  55. public static let noPhotoTips = ZLLocalLanguageKey(rawValue: "noPhotoTips")
  56. /// loading, waiting please (加载中,请稍后)
  57. public static let loading = ZLLocalLanguageKey(rawValue: "loading")
  58. /// waiting... (正在处理...)
  59. public static let hudLoading = ZLLocalLanguageKey(rawValue: "hudLoading")
  60. /// Done (确定)
  61. public static let done = ZLLocalLanguageKey(rawValue: "done")
  62. /// OK (确定)
  63. public static let ok = ZLLocalLanguageKey(rawValue: "ok")
  64. /// Request timed out (请求超时)
  65. public static let timeout = ZLLocalLanguageKey(rawValue: "timeout")
  66. /// Allow %@ to access your album in \"Settings\"->\"Privacy\"->\"Photos\"
  67. /// (请在iPhone的\"设置-隐私-照片\"选项中,允许%@访问你的照片)
  68. public static let noPhotoLibratyAuthority = ZLLocalLanguageKey(rawValue: "noPhotoLibratyAuthority")
  69. /// Please allow %@ to access your device's camera in \"Settings\"->\"Privacy\"->\"Camera\"
  70. /// (请在iPhone的\"设置-隐私-相机\"选项中,允许%@访问你的相机)
  71. public static let noCameraAuthority = ZLLocalLanguageKey(rawValue: "noCameraAuthority")
  72. /// Please allow %@ to access your device's microphone in \"Settings\"->\"Privacy\"->\"Microphone\"
  73. /// (请在iPhone的\"设置-隐私-麦克风\"选项中,允许%@访问你的麦克风)
  74. public static let noMicrophoneAuthority = ZLLocalLanguageKey(rawValue: "noMicrophoneAuthority")
  75. /// Camera is unavailable (相机不可用)
  76. public static let cameraUnavailable = ZLLocalLanguageKey(rawValue: "cameraUnavailable")
  77. /// Photos (照片)
  78. public static let photo = ZLLocalLanguageKey(rawValue: "photo")
  79. /// Full Image (原图)
  80. public static let originalPhoto = ZLLocalLanguageKey(rawValue: "originalPhoto")
  81. /// Back (返回)
  82. public static let back = ZLLocalLanguageKey(rawValue: "back")
  83. /// Edit (编辑)
  84. public static let edit = ZLLocalLanguageKey(rawValue: "edit")
  85. /// Done (完成)
  86. public static let editFinish = ZLLocalLanguageKey(rawValue: "editFinish")
  87. /// Undo (还原)
  88. public static let revert = ZLLocalLanguageKey(rawValue: "revert")
  89. /// Preview (预览)
  90. public static let preview = ZLLocalLanguageKey(rawValue: "preview")
  91. /// Unable to select video (不能同时选择照片和视频)
  92. public static let notAllowMixSelect = ZLLocalLanguageKey(rawValue: "notAllowMixSelect")
  93. /// Save (保存)
  94. public static let save = ZLLocalLanguageKey(rawValue: "save")
  95. /// Failed to save the image (图片保存失败)
  96. public static let saveImageError = ZLLocalLanguageKey(rawValue: "saveImageError")
  97. /// Failed to save the video (视频保存失败)
  98. public static let saveVideoError = ZLLocalLanguageKey(rawValue: "saveVideoError")
  99. /// Max select count: %ld (最多只能选择%ld张图片)
  100. public static let exceededMaxSelectCount = ZLLocalLanguageKey(rawValue: "exceededMaxSelectCount")
  101. /// Max count for video selection: %ld (最多只能选择%ld个视频)
  102. public static let exceededMaxVideoSelectCount = ZLLocalLanguageKey(rawValue: "exceededMaxVideoSelectCount")
  103. /// Min count for video selection: %ld (最少选择%ld个视频)
  104. public static let lessThanMinVideoSelectCount = ZLLocalLanguageKey(rawValue: "lessThanMinVideoSelectCount")
  105. /// Unable to select video with a duration longer than %lds
  106. /// (不能选择超过%ld秒的视频)
  107. public static let longerThanMaxVideoDuration = ZLLocalLanguageKey(rawValue: "longerThanMaxVideoDuration")
  108. /// Unable to select video with a duration shorter than %lds
  109. /// (不能选择低于%ld秒的视频)
  110. public static let shorterThanMaxVideoDuration = ZLLocalLanguageKey(rawValue: "shorterThanMaxVideoDuration")
  111. /// Unable to sync from iCloud (iCloud无法同步)
  112. public static let iCloudVideoLoadFaild = ZLLocalLanguageKey(rawValue: "iCloudVideoLoadFaild")
  113. /// loading failed (图片加载失败)
  114. public static let imageLoadFailed = ZLLocalLanguageKey(rawValue: "imageLoadFailed")
  115. /// Tap to take photo and hold to record video (轻触拍照,按住摄像)
  116. public static let customCameraTips = ZLLocalLanguageKey(rawValue: "customCameraTips")
  117. /// Tap to take photo (轻触拍照)
  118. public static let customCameraTakePhotoTips = ZLLocalLanguageKey(rawValue: "customCameraTakePhotoTips")
  119. /// hold to record video (按住摄像)
  120. public static let customCameraRecordVideoTips = ZLLocalLanguageKey(rawValue: "customCameraRecordVideoTips")
  121. /// Record at least %lds (至少录制%ld秒)
  122. public static let minRecordTimeTips = ZLLocalLanguageKey(rawValue: "minRecordTimeTips")
  123. /// Recents (所有照片)
  124. public static let cameraRoll = ZLLocalLanguageKey(rawValue: "cameraRoll")
  125. /// Panoramas (全景照片)
  126. public static let panoramas = ZLLocalLanguageKey(rawValue: "panoramas")
  127. /// Videos (视频)
  128. public static let videos = ZLLocalLanguageKey(rawValue: "videos")
  129. /// Favorites (个人收藏)
  130. public static let favorites = ZLLocalLanguageKey(rawValue: "favorites")
  131. /// Time-Lapse (延时摄影)
  132. public static let timelapses = ZLLocalLanguageKey(rawValue: "timelapses")
  133. /// Recently Added (最近添加)
  134. public static let recentlyAdded = ZLLocalLanguageKey(rawValue: "recentlyAdded")
  135. /// Bursts (连拍快照)
  136. public static let bursts = ZLLocalLanguageKey(rawValue: "bursts")
  137. /// Slo-mo (慢动作)
  138. public static let slomoVideos = ZLLocalLanguageKey(rawValue: "slomoVideos")
  139. /// Selfies (自拍)
  140. public static let selfPortraits = ZLLocalLanguageKey(rawValue: "selfPortraits")
  141. /// Screenshots (屏幕快照)
  142. public static let screenshots = ZLLocalLanguageKey(rawValue: "screenshots")
  143. /// Portrait (人像)
  144. public static let depthEffect = ZLLocalLanguageKey(rawValue: "depthEffect")
  145. /// Live Photo
  146. public static let livePhotos = ZLLocalLanguageKey(rawValue: "livePhotos")
  147. /// Animated (动图)
  148. public static let animated = ZLLocalLanguageKey(rawValue: "animated")
  149. /// My Photo Stream (我的照片流)
  150. public static let myPhotoStream = ZLLocalLanguageKey(rawValue: "myPhotoStream")
  151. /// All Photos (所有照片)
  152. public static let noTitleAlbumListPlaceholder = ZLLocalLanguageKey(rawValue: "noTitleAlbumListPlaceholder")
  153. /// Unable to access all photos, go to settings (无法访问所有照片,前往设置)
  154. public static let unableToAccessAllPhotos = ZLLocalLanguageKey(rawValue: "unableToAccessAllPhotos")
  155. /// Drag here to remove (拖到此处删除)
  156. public static let textStickerRemoveTips = ZLLocalLanguageKey(rawValue: "textStickerRemoveTips")
  157. }
  158. func localLanguageTextValue(_ key: ZLLocalLanguageKey) -> String {
  159. if let value = ZLCustomLanguageDeploy.deploy[key] {
  160. return value
  161. }
  162. return Bundle.zlLocalizedString(key.rawValue)
  163. }