Files
OrderScheduling/Pods/ZLPhotoBrowser/Sources/General/ZLLanguageDefine.swift
DDIsFriend f0e8a1709d initial
2023-08-18 17:28:57 +08:00

323 lines
12 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// ZLLanguageDefine.swift
// ZLPhotoBrowser
//
// Created by long on 2020/8/17.
//
// Copyright (c) 2020 Long Zhang <495181165@qq.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import Foundation
@objc public enum ZLLanguageType: Int {
case system
case chineseSimplified
case chineseTraditional
case english
case japanese
case french
case german
case russian
case vietnamese
case korean
case malay
case italian
case indonesian
case portuguese
case spanish
case turkish
case arabic
var key: String {
var key = "en"
switch self {
case .system:
key = Locale.preferredLanguages.first ?? "en"
if key.hasPrefix("zh") {
if key.range(of: "Hans") != nil {
key = "zh-Hans"
} else {
key = "zh-Hant"
}
} else if key.hasPrefix("ja") {
key = "ja-US"
} else if key.hasPrefix("fr") {
key = "fr"
} else if key.hasPrefix("de") {
key = "de"
} else if key.hasPrefix("ru") {
key = "ru"
} else if key.hasPrefix("vi") {
key = "vi"
} else if key.hasPrefix("ko") {
key = "ko"
} else if key.hasPrefix("ms") {
key = "ms"
} else if key.hasPrefix("it") {
key = "it"
} else if key.hasPrefix("id") {
key = "id"
} else if key.hasPrefix("pt") {
key = "pt-BR"
} else if key.hasPrefix("es") {
key = "es-419"
} else if key.hasPrefix("tr") {
key = "tr"
} else if key.hasPrefix("ar") {
key = "ar"
} else {
key = "en"
}
case .chineseSimplified:
key = "zh-Hans"
case .chineseTraditional:
key = "zh-Hant"
case .english:
key = "en"
case .japanese:
key = "ja-US"
case .french:
key = "fr"
case .german:
key = "de"
case .russian:
key = "ru"
case .vietnamese:
key = "vi"
case .korean:
key = "ko"
case .malay:
key = "ms"
case .italian:
key = "it"
case .indonesian:
key = "id"
case .portuguese:
key = "pt-BR"
case .spanish:
key = "es-419"
case .turkish:
key = "tr"
case .arabic:
key = "ar"
}
return key
}
}
public struct ZLLocalLanguageKey: Hashable {
public let rawValue: String
public init(rawValue: String) {
self.rawValue = rawValue
}
/// Camera ()
public static let previewCamera = ZLLocalLanguageKey(rawValue: "previewCamera")
/// Record ()
public static let previewCameraRecord = ZLLocalLanguageKey(rawValue: "previewCameraRecord")
/// Album ()
public static let previewAlbum = ZLLocalLanguageKey(rawValue: "previewAlbum")
/// Cancel ()
public static let cancel = ZLLocalLanguageKey(rawValue: "cancel")
/// No Photo ()
public static let noPhotoTips = ZLLocalLanguageKey(rawValue: "noPhotoTips")
/// waiting... (...)
public static let hudLoading = ZLLocalLanguageKey(rawValue: "hudLoading")
/// Done ()
public static let done = ZLLocalLanguageKey(rawValue: "done")
/// OK ()
public static let ok = ZLLocalLanguageKey(rawValue: "ok")
/// Request timed out ()
public static let timeout = ZLLocalLanguageKey(rawValue: "timeout")
/// Please Allow %@ to access your album in \"Settings\"->\"Privacy\"->\"Photos\"
/// (iPhone\"--\"%@访)
public static let noPhotoLibratyAuthority = ZLLocalLanguageKey(rawValue: "noPhotoLibratyAuthority")
/// Please allow %@ to access your device's camera in \"Settings\"->\"Privacy\"->\"Camera\"
/// (iPhone\"--\"%@访)
public static let noCameraAuthority = ZLLocalLanguageKey(rawValue: "noCameraAuthority")
/// Unable to record audio. Go to \"Settings\" > \"%@\" and enable microphone access.
/// (\" > %@\")
public static let noMicrophoneAuthority = ZLLocalLanguageKey(rawValue: "noMicrophoneAuthority")
/// Camera is unavailable ()
public static let cameraUnavailable = ZLLocalLanguageKey(rawValue: "cameraUnavailable")
/// Keep Recording ()
public static let keepRecording = ZLLocalLanguageKey(rawValue: "keepRecording")
/// Go to Settings ()
public static let gotoSettings = ZLLocalLanguageKey(rawValue: "gotoSettings")
/// Photos ()
public static let photo = ZLLocalLanguageKey(rawValue: "photo")
/// Full Image ()
public static let originalPhoto = ZLLocalLanguageKey(rawValue: "originalPhoto")
/// Back ()
public static let back = ZLLocalLanguageKey(rawValue: "back")
/// Edit ()
public static let edit = ZLLocalLanguageKey(rawValue: "edit")
/// Done ()
public static let editFinish = ZLLocalLanguageKey(rawValue: "editFinish")
/// Undo ()
public static let revert = ZLLocalLanguageKey(rawValue: "revert")
/// Brightness ()
public static let brightness = ZLLocalLanguageKey(rawValue: "brightness")
/// Contrast ()
public static let contrast = ZLLocalLanguageKey(rawValue: "contrast")
/// Saturation ()
public static let saturation = ZLLocalLanguageKey(rawValue: "saturation")
/// Preview ()
public static let preview = ZLLocalLanguageKey(rawValue: "preview")
/// Save ()
public static let save = ZLLocalLanguageKey(rawValue: "save")
/// Failed to save the image ()
public static let saveImageError = ZLLocalLanguageKey(rawValue: "saveImageError")
/// Failed to save the video ()
public static let saveVideoError = ZLLocalLanguageKey(rawValue: "saveVideoError")
/// Max select count: %ld (%ld)
public static let exceededMaxSelectCount = ZLLocalLanguageKey(rawValue: "exceededMaxSelectCount")
/// Max count for video selection: %ld (%ld)
public static let exceededMaxVideoSelectCount = ZLLocalLanguageKey(rawValue: "exceededMaxVideoSelectCount")
/// Min count for video selection: %ld (%ld)
public static let lessThanMinVideoSelectCount = ZLLocalLanguageKey(rawValue: "lessThanMinVideoSelectCount")
/// Can't select videos longer than %lds
/// (%ld)
public static let longerThanMaxVideoDuration = ZLLocalLanguageKey(rawValue: "longerThanMaxVideoDuration")
/// Can't select videos shorter than %lds
/// (%ld)
public static let shorterThanMinVideoDuration = ZLLocalLanguageKey(rawValue: "shorterThanMinVideoDuration")
/// Can't select videos larger than %@MB
/// (%@MB)
public static let largerThanMaxVideoDataSize = ZLLocalLanguageKey(rawValue: "largerThanMaxVideoDataSize")
/// Can't select videos smaller than %@MB
/// (%@MB)
public static let smallerThanMinVideoDataSize = ZLLocalLanguageKey(rawValue: "smallerThanMinVideoDataSize")
/// Unable to sync from iCloud (iCloud)
public static let iCloudVideoLoadFaild = ZLLocalLanguageKey(rawValue: "iCloudVideoLoadFaild")
/// loading failed ()
public static let imageLoadFailed = ZLLocalLanguageKey(rawValue: "imageLoadFailed")
/// Tap to take photo and hold to record video ()
public static let customCameraTips = ZLLocalLanguageKey(rawValue: "customCameraTips")
/// Tap to take photo ()
public static let customCameraTakePhotoTips = ZLLocalLanguageKey(rawValue: "customCameraTakePhotoTips")
/// hold to record video ()
public static let customCameraRecordVideoTips = ZLLocalLanguageKey(rawValue: "customCameraRecordVideoTips")
/// Record at least %lds (%ld)
public static let minRecordTimeTips = ZLLocalLanguageKey(rawValue: "minRecordTimeTips")
/// Recents ()
public static let cameraRoll = ZLLocalLanguageKey(rawValue: "cameraRoll")
/// Panoramas ()
public static let panoramas = ZLLocalLanguageKey(rawValue: "panoramas")
/// Videos ()
public static let videos = ZLLocalLanguageKey(rawValue: "videos")
/// Favorites ()
public static let favorites = ZLLocalLanguageKey(rawValue: "favorites")
/// Time-Lapse ()
public static let timelapses = ZLLocalLanguageKey(rawValue: "timelapses")
/// Recently Added ()
public static let recentlyAdded = ZLLocalLanguageKey(rawValue: "recentlyAdded")
/// Bursts ()
public static let bursts = ZLLocalLanguageKey(rawValue: "bursts")
/// Slo-mo ()
public static let slomoVideos = ZLLocalLanguageKey(rawValue: "slomoVideos")
/// Selfies ()
public static let selfPortraits = ZLLocalLanguageKey(rawValue: "selfPortraits")
/// Screenshots ()
public static let screenshots = ZLLocalLanguageKey(rawValue: "screenshots")
/// Portrait ()
public static let depthEffect = ZLLocalLanguageKey(rawValue: "depthEffect")
/// Live Photo
public static let livePhotos = ZLLocalLanguageKey(rawValue: "livePhotos")
/// Animated ()
public static let animated = ZLLocalLanguageKey(rawValue: "animated")
/// My Photo Stream ()
public static let myPhotoStream = ZLLocalLanguageKey(rawValue: "myPhotoStream")
/// All Photos ()
public static let noTitleAlbumListPlaceholder = ZLLocalLanguageKey(rawValue: "noTitleAlbumListPlaceholder")
/// Unable to access all photos, go to settings (访)
public static let unableToAccessAllPhotos = ZLLocalLanguageKey(rawValue: "unableToAccessAllPhotos")
/// Drag here to remove ()
public static let textStickerRemoveTips = ZLLocalLanguageKey(rawValue: "textStickerRemoveTips")
}
func localLanguageTextValue(_ key: ZLLocalLanguageKey) -> String {
if let value = ZLCustomLanguageDeploy.deploy[key] {
return value
}
return Bundle.zlLocalizedString(key.rawValue)
}