Skip to content

Commit

Permalink
Allow excluding base from availableLanguages
Browse files Browse the repository at this point in the history
  • Loading branch information
marmelroy committed Jun 18, 2016
1 parent 3ec6c27 commit b3d20da
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Sources/Localize.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,13 @@ public class Localize: NSObject {
List available languages
- Returns: Array of available languages.
*/
public class func availableLanguages() -> [String] {
return NSBundle.mainBundle().localizations
public class func availableLanguages(excludeBase: Bool = false) -> [String] {
var availableLanguages = NSBundle.mainBundle().localizations
// If excludeBase = true, don't include "Base" in available languages
if let indexOfBase = availableLanguages.indexOf("Base") where excludeBase == true {
availableLanguages.removeAtIndex(indexOfBase)
}
return availableLanguages
}

/**
Expand Down

0 comments on commit b3d20da

Please sign in to comment.