File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
FoundationEssentials/Locale
FoundationInternationalization/Locale Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -34,11 +34,11 @@ extension Locale {
3434 if let languageCode = languageCode {
3535 result += languageCode. _normalizedIdentifier
3636 }
37- if let script = script, script != " " {
37+ if let script = script, !script . identifier . isEmpty {
3838 result += " - "
3939 result += script. _normalizedIdentifier
4040 }
41- if let region = region, region != " " {
41+ if let region = region, !region . identifier . isEmpty {
4242 result += " _ "
4343 result += region. _normalizedIdentifier
4444 }
Original file line number Diff line number Diff line change @@ -525,7 +525,7 @@ extension Locale.Language {
525525 public var minimalIdentifier : String {
526526 let componentsIdentifier = components. identifier
527527
528- if componentsIdentifier == " " {
528+ guard ! componentsIdentifier. isEmpty else {
529529 // Just return "". Nothing to reduce.
530530 return componentsIdentifier
531531 }
@@ -548,7 +548,7 @@ extension Locale.Language {
548548 /// Returns a BCP-47 identifier that always includes the script: "zh-Hant-TW", "en-Latn-US"
549549 public var maximalIdentifier : String {
550550 let id = components. identifier
551- if id == " " {
551+ guard !id . isEmpty else {
552552 // Just return "" instead of trying to fill it up
553553 return id
554554 }
You can’t perform that action at this time.
0 commit comments