Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions GdeiAssistant-iOS/Core/Config/AppLanguage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ enum AppLanguage: String, CaseIterable, Identifiable {
switch lowercaseIdentifier {
case "zh-cn", "zh-hans", "zh-hans-cn", "zh":
return .simplifiedChinese
case "zh-hk", "zh-hant-hk":
case "zh-hk", "zh-mo", "zh-hant-hk", "zh-hant-mo":
return .traditionalChineseHongKong
case "zh-tw", "zh-hant", "zh-hant-tw":
return .traditionalChineseTaiwan
Expand All @@ -97,7 +97,7 @@ enum AppLanguage: String, CaseIterable, Identifiable {
}

if segments.first == "zh" {
if segments.contains("hk") {
if segments.contains("hk") || segments.contains("mo") {
return .traditionalChineseHongKong
Comment on lines +100 to 101

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve explicit Hans in Macau locales

When iOS supplies a script-qualified simplified Macau locale such as zh-Hans-MO, this new segments.contains("mo") check runs before the existing script check, so normalizedIdentifier(from:) now returns zh-HK and the app loads Traditional Chinese despite the identifier explicitly requesting Hans. The change is intended for Macau Traditional Chinese, but this branch also captures Simplified Chinese Macau variants; handle hans before the Macau region fallback or special-case zh-Hans-MO as simplified.

Useful? React with 👍 / 👎.

}

Expand Down
3 changes: 2 additions & 1 deletion GdeiAssistant-iOSTests/Localization/AppLanguageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ final class AppLanguageTests: XCTestCase {
XCTAssertEqual(AppLanguage.normalizedIdentifier(from: "zh-Hans-SG"), "zh-CN")
XCTAssertEqual(AppLanguage.normalizedIdentifier(from: "zh-Hant-HK"), "zh-HK")
XCTAssertEqual(AppLanguage.normalizedIdentifier(from: "zh-Hant-TW"), "zh-TW")
XCTAssertEqual(AppLanguage.normalizedIdentifier(from: "zh-Hant-MO"), "zh-TW")
XCTAssertEqual(AppLanguage.normalizedIdentifier(from: "zh-Hant-MO"), "zh-HK")
XCTAssertEqual(AppLanguage.normalizedIdentifier(from: "zh-MO"), "zh-HK")
XCTAssertEqual(AppLanguage.normalizedIdentifier(from: "en-US"), "en")
XCTAssertEqual(AppLanguage.normalizedIdentifier(from: "ja-JP"), "ja")
XCTAssertEqual(AppLanguage.normalizedIdentifier(from: "ko-KR"), "ko")
Expand Down