<commit_before>//
//  BundleUtil.swift
//  PopupAlert-iOS
//
//  Created by darren on 2017/8/2.
//  Copyright © 2017年 陈亮陈亮. All rights reserved.
//

import UIKit
import Foundation

class BundleUtil {
    
    static func getCurrentBundle() -> Bundle{
                
        let podBundle = Bundle(for: CLImagePickersTool.self)
        
        if podBundle.bundlePath.contains(".framework") {   // carthage
            return podBundle
        }
        
        let bundleURL = podBundle.url(forResource: "CLImagePickerTool", withExtension: "bundle")
        if bundleURL != nil {
            let bundle = Bundle(url: bundleURL!)!
            return bundle
        }else{
            return Bundle.main
        }
    }
    
    static func cl_localizedStringForKey(key: String) -> String {
        return self.cl_localizedStringForKey(key: key, value: "")
    }
    
    static func cl_localizedStringForKey(key: String,value:String) -> String {
        var bundle: Bundle? = nil
        
        if bundle == nil {
            var language = NSLocale.preferredLanguages.first
            let r = language?.range(of: "zh-Hans")
            if r != nil {
                let nsr = "".nsRange(from: r!)
                if nsr.location != NSNotFound {
                    language = "zh-Hans"
                } else {
                    language = "en"
                }
            } else {
                language = "en"
            }
            
            
            bundle = Bundle(path: self.getCurrentBundle().path(forResource: language, ofType: "lproj")!)
        }
        
        let str = bundle?.localizedString(forKey: key, value: value, table: nil)
        return str ?? ""
    }
    
        
}
<commit_msg>fixs bugs<commit_after>//
//  BundleUtil.swift
//  PopupAlert-iOS
//
//  Created by darren on 2017/8/2.
//  Copyright © 2017年 陈亮陈亮. All rights reserved.
//

import UIKit
import Foundation

class BundleUtil {
    
    static func getCurrentBundle() -> Bundle{
                
        let podBundle = Bundle(for: CLImagePickersTool.self)
        
        let bundleURL = podBundle.url(forResource: "CLImagePickerTool", withExtension: "bundle")
        
        if bundleURL == nil {
            if podBundle.bundlePath.contains("ImagePickerTool.framework") {   // carthage
                return podBundle
            }
        }
        
        if bundleURL != nil {
            let bundle = Bundle(url: bundleURL!)!
            return bundle
        }else{
            return Bundle.main
        }
    }
    
    static func cl_localizedStringForKey(key: String) -> String {
        return self.cl_localizedStringForKey(key: key, value: "")
    }
    
    static func cl_localizedStringForKey(key: String,value:String) -> String {
        var bundle: Bundle? = nil
        
        if bundle == nil {
            var language = NSLocale.preferredLanguages.first
            let r = language?.range(of: "zh-Hans")
            if r != nil {
                let nsr = "".nsRange(from: r!)
                if nsr.location != NSNotFound {
                    language = "zh-Hans"
                } else {
                    language = "en"
                }
            } else {
                language = "en"
            }
            
            
            bundle = Bundle(path: self.getCurrentBundle().path(forResource: language, ofType: "lproj")!)
        }
        
        let str = bundle?.localizedString(forKey: key, value: value, table: nil)
        return str ?? ""
    }
    
        
}

{'fraction_non_alphanumeric': 0.10141643059490085, 'fraction_numerical': 0.0056657223796034, 'mean_word_length': 1.4744218640504556, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3949860', 'n_tokens_mistral': 1021, 'n_tokens_neox': 975, 'n_words': 232}