//  Created by Monte Hurd on 10/4/15.
//  Copyright (c) 2015 Wikimedia Foundation. Provided under MIT-style license; please copy and modify!

import Foundation

extension NSLocale {
    class func wmf_isCurrentLocaleEnglish() -> Bool {
        guard let langCode = NSLocale.currentLocale().objectForKey(NSLocaleLanguageCode) as? String else {
            return false
        }
        return (langCode == "en" || langCode.hasPrefix("en-")) ? true : false;
    }
    func wmf_localizedLanguageNameForCode(code: String) -> String? {
        var ISOLanguageCode:String
        switch code {
        case "als": //wiki language codes don't map 1:1 to ISOLanguageCodes
            ISOLanguageCode = "gsw"
        default:
            ISOLanguageCode = code
        }
        return self.displayNameForKey(NSLocaleLanguageCode, value: ISOLanguageCode)
    }
}

//  Created by Monte Hurd on 10/4/15.
//  Copyright (c) 2015 Wikimedia Foundation. Provided under MIT-style license; please copy and modify!

import Foundation

extension NSLocale {
    class func wmf_isCurrentLocaleEnglish() -> Bool {
        guard let langCode = NSLocale.currentLocale().objectForKey(NSLocaleLanguageCode) as? String else {
            return false
        }
        return (langCode == "en" || langCode.hasPrefix("en-")) ? true : false;
    }
    func wmf_localizedLanguageNameForCode(code: String) -> String? {
        return self.displayNameForKey(NSLocaleLanguageCode, value: code)
    }
}

Revert "add switch statement to handle mapping of wiki language to ISO language code"
Revert "add switch statement to handle mapping of wiki language to ISO language code"

This reverts commit 27f0d17aeee4312e497c7fa13ed48e539e2a1668.
