Skip to content

Commit

Permalink
Make public
Browse files Browse the repository at this point in the history
  • Loading branch information
levieggertcru committed Jul 16, 2024
1 parent ef7acca commit 0f2f568
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

extension Collection where Indices.Iterator.Element == Index {

subscript (safe index: Index) -> Iterator.Element? {
public subscript (safe index: Index) -> Iterator.Element? {
return indices.contains(index) ? self[index] : nil
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ import Foundation

extension Locale {

var isBaseLanguage: Bool {
public var isBaseLanguage: Bool {

let isBaseLanguage: Bool = isMissingRegionCode && isMissingScriptCode

return isBaseLanguage
}

var isEnglishLanguage: Bool {
public var isEnglishLanguage: Bool {
return languageCode == "en"
}

var isMissingRegionCode: Bool {
public var isMissingRegionCode: Bool {
return regionCode?.isEmpty ?? true
}

var isMissingScriptCode: Bool {
public var isMissingScriptCode: Bool {
return scriptCode?.isEmpty ?? true
}

Expand All @@ -43,15 +43,15 @@ extension Locale {
return languageCodesMatch
}

func scriptCodeIsEqualToLocaleScriptCode(locale: Locale) -> Bool {
public func scriptCodeIsEqualToLocaleScriptCode(locale: Locale) -> Bool {
return locale.scriptCode?.lowercased() == scriptCode?.lowercased()
}

func regionCodeIsEqualToLocaleRegionCode(locale: Locale) -> Bool {
public func regionCodeIsEqualToLocaleRegionCode(locale: Locale) -> Bool {
return locale.regionCode?.lowercased() == regionCode?.lowercased()
}

func isEqualTo(locale: Locale) -> Bool {
public func isEqualTo(locale: Locale) -> Bool {

let languageCodesMatch: Bool = languageCodeIsEqualToLocaleLanguageCode(locale: locale)
let scriptCodesMatch: Bool = scriptCodeIsEqualToLocaleScriptCode(locale: locale)
Expand All @@ -60,12 +60,12 @@ extension Locale {
return languageCodesMatch && scriptCodesMatch && regionCodesMatch
}

func baseLanguageIsEqualToLocaleBaseLanguage(locale: Locale) -> Bool {
public func baseLanguageIsEqualToLocaleBaseLanguage(locale: Locale) -> Bool {

return languageCodeIsEqualToLocaleLanguageCode(locale: locale)
}

func baseLanguageAndScriptCodesAreEqualTo(locale: Locale) -> Bool {
public func baseLanguageAndScriptCodesAreEqualTo(locale: Locale) -> Bool {

let baseLanguagesMatch: Bool = baseLanguageIsEqualToLocaleBaseLanguage(locale: locale)
let scriptCodesMatch: Bool = locale.scriptCode?.lowercased() == scriptCode?.lowercased()
Expand Down

0 comments on commit 0f2f568

Please sign in to comment.