Cakephp 3.4不承认中文

时间:2017-03-29 01:58:38

标签: php localization internationalization cakephp-3.0

终于在cakephp 3.4上进行了本地化和翻译工作,但是当谈到中文时,我只是碰到了一堵砖墙。我尽我所能并寻找更多信息来解决问题,但Stack是我最后的选择。

我有3种语言可以翻译,英语,法语和Chanese,英语和法语都像魅力一样。但不是中国人。我已经检查了我的数据库,并且是UTF-8默认c。我为中文' zh_CN,zh-cn,zh,zho,zho_CN,zho-cn'尝试不同的国际化代码。似乎没有一个蛋糕被识别出来。我甚至只是尝试将中文文本添加为​​主要语言,它只是不起作用。

我有另一个没有需要翻译的项目,它确实抓住了中文文本并将它放在数据库上没问题,一旦我使用I18n和I10n,它似乎会对数据库产生某种冲突。

我得到的错误代码如下......

Please try correcting the issue for the following table aliases:I18n,Bookmarks_title_translation,Bookmarks_description_translation,BookmarksTags

...并告诉我检查以下代码......

请尝试更正以下表别名的问题:

func getAnnotations(completion: @escaping (_ annotations: [ARAnnotation], _ error: Error?) -> Void) {

    //The php file connects the Database and Swift
    let request = NSMutableURLRequest(url: NSURL(string: "https://test.com/pull.php")! as URL)

    //Receiver's HTTP request method
    request.httpMethod = "POST"

    let task = URLSession.shared.dataTask(with: request as URLRequest) {
        old_data, response, error in

        //Error Checking
        if error != nil {
            print("error=\(error)")
            return
        }

        //Response string built up
        let responseString = NSString(data: old_data!, encoding: String.Encoding.utf8.rawValue)
        print("responseString = \(responseString)")

        //Manipulating JSON data
        do {
            if let new_data = old_data,
                let json = try JSONSerialization.jsonObject(with: new_data) as? [String: Any],
                let buildings = json["buildings"] as? [[String: Any]] {

                var annotations: [ARAnnotation] = []

                for building in buildings {

                    let BUILDING_ID = "BuildingID"
                    let BUILDING_NAME = "BuildingName"
                    let BUILDING_INFO = "BuildingInfo"
                    let BUILDING_LAT = "Latitude"
                    let BUILDING_LNG = "Longitude"

                    let IdString:String = building[BUILDING_ID] as! String
                    let NameString:String = building[BUILDING_NAME] as! String
                    let InfoString:String = building[BUILDING_INFO] as! String

                    let LatString:String = building[BUILDING_LAT] as! String
                    let LatDouble:Double = Double(LatString)!

                    let LngString:String = building[BUILDING_LNG] as! String
                    let LngDouble:Double = Double(LngString)!

                    let location:CLLocationCoordinate2D = CLLocationCoordinate2DMake(LatDouble, LngDouble)

                    let annotation = ARAnnotation()
                    annotation.location = CLLocation(latitude: LatDouble, longitude: LngDouble)
                    annotation.title = "POI: \(NameString)"
                    annotations.append(annotation)

                    completion(annotations, nil)
                    //error
                }  
            }     
        } catch {
            print(error)
            completion([], error)
        } 
    }
    task.resume()
}

对此的任何帮助都将深表感谢。

0 个答案:

没有答案