From ebddbe9f4b16d302ea29b2145057603065678f80 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Fri, 26 Apr 2019 16:06:51 +0200 Subject: [PATCH] Fix language sorting Sorted by country, rendered by language. --- Passepartout-iOS/Scenes/About/CreditsViewController.swift | 2 +- Passepartout/Sources/Utils.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Passepartout-iOS/Scenes/About/CreditsViewController.swift b/Passepartout-iOS/Scenes/About/CreditsViewController.swift index a6591d2a..60ff1929 100644 --- a/Passepartout-iOS/Scenes/About/CreditsViewController.swift +++ b/Passepartout-iOS/Scenes/About/CreditsViewController.swift @@ -32,7 +32,7 @@ class CreditsViewController: UITableViewController, TableModelHost { private let notices = AppConstants.Notice.all private let languages = AppConstants.Translations.authorByLanguage.keys.sorted { - return Utils.localizedCountry($0) < Utils.localizedCountry($1) + return Utils.localizedLanguage($0) < Utils.localizedLanguage($1) } // MARK: TableModelHost diff --git a/Passepartout/Sources/Utils.swift b/Passepartout/Sources/Utils.swift index 5eee4c0b..5b4b11cd 100644 --- a/Passepartout/Sources/Utils.swift +++ b/Passepartout/Sources/Utils.swift @@ -137,8 +137,8 @@ public class Utils { return Locale.current.localizedString(forRegionCode: code) ?? code } - public static func localizedLanguage(_ code: String) -> String? { - return Locale.current.localizedString(forLanguageCode: code) + public static func localizedLanguage(_ code: String) -> String { + return Locale.current.localizedString(forLanguageCode: code) ?? code } private init() {