mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-11-15 08:12:23 +00:00
Merge a9f1db3d35a9caf37a2888fee4380db10805559b into 04995f68e470a18d1fc99f86fa326c2a87bab4f2
This commit is contained in:
commit
ec088319b4
File diff suppressed because it is too large
Load Diff
@ -94,7 +94,7 @@
|
||||
"ko" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "공유된 링크",
|
||||
"value" : "공유 링크",
|
||||
"comment" : "Fallback title when saving a shared link"
|
||||
}
|
||||
},
|
||||
@ -657,7 +657,7 @@
|
||||
"id" : { "stringUnit" : { "state" : "needs_review", "value" : "✓ Disimpan di bitchat — buka aplikasi untuk meninjau" } },
|
||||
"it" : { "stringUnit" : { "state" : "needs_review", "value" : "✓ Salvato in bitchat — apri l’app per controllare" } },
|
||||
"ja" : { "stringUnit" : { "state" : "needs_review", "value" : "✓ bitchat に保存しました — アプリを開いて確認してください" } },
|
||||
"ko" : { "stringUnit" : { "state" : "needs_review", "value" : "✓ bitchat에 저장됨 — 앱을 열어 검토하세요" } },
|
||||
"ko" : { "stringUnit" : { "state" : "needs_review", "value" : "✓ bitchat에 저장되었습니다. 앱을 열어 확인하세요" } },
|
||||
"ms" : { "stringUnit" : { "state" : "needs_review", "value" : "✓ Disimpan dalam bitchat — buka aplikasi untuk menyemak" } },
|
||||
"ne" : { "stringUnit" : { "state" : "needs_review", "value" : "✓ bitchat मा सुरक्षित गरियो — समीक्षा गर्न एप खोल्नुहोस्" } },
|
||||
"nl" : { "stringUnit" : { "state" : "needs_review", "value" : "✓ Opgeslagen in bitchat — open de app om te bekijken" } },
|
||||
|
||||
48
bitchatTests/KoreanLocalizationFormatTests.swift
Normal file
48
bitchatTests/KoreanLocalizationFormatTests.swift
Normal file
@ -0,0 +1,48 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
|
||||
/// Regression coverage for the positional-placeholder mismatch found during
|
||||
/// the Korean localization review.
|
||||
struct KoreanLocalizationFormatTests {
|
||||
private static let repoRoot = URL(fileURLWithPath: #filePath)
|
||||
.deletingLastPathComponent()
|
||||
.deletingLastPathComponent()
|
||||
|
||||
private static let positionalObjectPlaceholder = try! NSRegularExpression(
|
||||
pattern: #"%\d+\$@"#
|
||||
)
|
||||
|
||||
private static func placeholders(in value: String) -> [String] {
|
||||
let range = NSRange(value.startIndex..<value.endIndex, in: value)
|
||||
return positionalObjectPlaceholder.matches(in: value, range: range).compactMap { match in
|
||||
guard let tokenRange = Range(match.range, in: value) else { return nil }
|
||||
return String(value[tokenRange])
|
||||
}
|
||||
}
|
||||
|
||||
@Test func locationChannelSubtitlePreservesPositionalArguments() throws {
|
||||
let catalogURL = Self.repoRoot.appendingPathComponent("bitchat/Localizable.xcstrings")
|
||||
let data = try Data(contentsOf: catalogURL)
|
||||
let root = try #require(
|
||||
try JSONSerialization.jsonObject(with: data) as? [String: Any]
|
||||
)
|
||||
let strings = try #require(root["strings"] as? [String: Any])
|
||||
let entry = try #require(
|
||||
strings["location_channels.subtitle_prefix"] as? [String: Any]
|
||||
)
|
||||
let localizations = try #require(entry["localizations"] as? [String: Any])
|
||||
|
||||
func value(for locale: String) throws -> String {
|
||||
let localization = try #require(localizations[locale] as? [String: Any])
|
||||
let unit = try #require(localization["stringUnit"] as? [String: Any])
|
||||
return try #require(unit["value"] as? String)
|
||||
}
|
||||
|
||||
let english = try value(for: "en")
|
||||
let korean = try value(for: "ko")
|
||||
let expected = ["%1$@", "%2$@"]
|
||||
|
||||
#expect(Self.placeholders(in: english) == expected)
|
||||
#expect(Self.placeholders(in: korean) == expected)
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user