testflight: description keys by language id or App Store locale, unknown keys are a config error, primary-locale check before Beta App Review
This commit is contained in:
parent
e185b61c8e
commit
1abd0936c3
6 changed files with 35 additions and 3 deletions
|
|
@ -54,9 +54,14 @@ export const groupFromApi = (g: { id: string; attributes: Record<string, unknown
|
|||
});
|
||||
|
||||
/** Problems with the testflight config. Pure. */
|
||||
export function validateTestflight(t: TfConfig | undefined): string[] {
|
||||
export function validateTestflight(t: TfConfig | undefined, langs: { id: string; apple?: string }[] = []): string[] {
|
||||
if (!t) return [];
|
||||
const e: string[] = [];
|
||||
if (t.description && typeof t.description === 'object' && langs.length) {
|
||||
const known = new Set(langs.flatMap(l => [l.id, ...(l.apple ? [l.apple] : [])]));
|
||||
const bad = Object.keys(t.description).filter(k => !known.has(k));
|
||||
if (bad.length) e.push(`apple.testflight.description: ${bad.map(k => `'${k}'`).join(', ')} is not a language of the config (use a language id or its App Store locale: ${langs.filter(l => l.apple).map(l => `${l.id} / ${l.apple}`).join(', ')})`);
|
||||
}
|
||||
const names = new Set<string>();
|
||||
for (const [i, g] of (t.groups ?? []).entries()) {
|
||||
const at = `apple.testflight.groups[${i}]`;
|
||||
|
|
@ -315,7 +320,8 @@ export function betaDescriptions(t: TfConfig | undefined, langs: { id: string; a
|
|||
const out: Record<string, string> = {};
|
||||
for (const l of langs) {
|
||||
if (!l.apple) continue;
|
||||
const d = typeof t.description === 'string' ? t.description : t.description[l.id];
|
||||
// a language id ('en') or its App Store locale ('en-US'): an 'en-US' key was silently skipped (Acme 2026-10-29)
|
||||
const d = typeof t.description === 'string' ? t.description : (t.description[l.id] ?? t.description[l.apple]);
|
||||
if (d) out[l.apple] = d;
|
||||
}
|
||||
return out;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue