XCSAnalytics provides read-only reporting helpers for catalogs. It computes key lists, locale lists, stale entries, key coverage, per-language progress, and overall statistics from the shared Catalog model.
Fields:
keylocalesourceLeafCounttranslatedLeafCountmissingLeafCountuntranslatedLeafCount
Computed property:
coverage: translated leaf ratio for that key and locale scope
Fields:
localesourceLeafCounttranslatedLeafCountmissingLeafCountuntranslatedLeafCountneedsReviewLeafCount
Computed property:
progress: completed-key ratio for that locale
Important detail: the leaf counts remain leaf-based, but progress is computed from completed translatable keys, not raw translated-leaf totals.
Fields:
sourceLanguagekeyCounttargetLanguagesstaleKeyCounttotalSourceLeafCounttranslatedLeafCountmissingLeafCountuntranslatedLeafCountlanguageProgress
Computed property:
overallCoverage: completed key-locale ratio across the catalog
public static func keys(in catalog: Catalog) -> [String]
public static func sourceLanguage(in catalog: Catalog) -> String
public static func targetLanguages(in catalog: Catalog) -> [String]
public static func localizations(forKey key: String, in catalog: Catalog) -> [String: Localization]
public static func translations(forKey key: String, in catalog: Catalog) -> [String: Localization]
public static func localization(forKey key: String, locale: String, in catalog: Catalog) -> Localization?
public static func sourceLocalization(forKey key: String, in catalog: Catalog) -> Localization?
public static func untranslatedKeys(in catalog: Catalog, locale: String) -> [String]
public static func staleKeys(in catalog: Catalog) -> [String]
public static func keyCoverage(forKey key: String, in catalog: Catalog) -> KeyCoverageSummary?
public static func keyCoverage(forKey key: String, locale: String, in catalog: Catalog) -> KeyCoverageSummary?
public static func languageProgress(in catalog: Catalog) -> [LanguageProgress]
public static func statistics(in catalog: Catalog) -> CatalogStatisticsimport XCSAnalytics
let keys = XCSAnalytics.keys(in: catalog)
let targetLocales = XCSAnalytics.targetLanguages(in: catalog)
let stale = XCSAnalytics.staleKeys(in: catalog)
let frenchGaps = XCSAnalytics.untranslatedKeys(in: catalog, locale: "fr")
let coverage = XCSAnalytics.keyCoverage(forKey: "Hello", locale: "fr", in: catalog)
let progress = XCSAnalytics.languageProgress(in: catalog)
let stats = XCSAnalytics.statistics(in: catalog)- Analytics synthesize a direct source leaf from
entry.keywhen an entry has no explicit source-language localization. - Entries with
shouldTranslate == falseare excluded from analytics coverage and progress denominators. - Variant trees are flattened into leaf paths so plural and device leaves participate in coverage and progress.
- Stale entries are reported by
staleKeys(in:)and treated as incomplete for progress calculations. targetLanguages(in:)excludes the source locale and returns a sorted list.
Use XCSAnalytics when you want reporting only. If you need to change the catalog, use XCSTranslator and XCSWriter.