fix: name the calendar description field plainly instead of the desktop help text

This commit is contained in:
Linus Rath
2026-10-31 13:24:22 +01:00
parent 75513969ef
commit 8626cd11ef
4 changed files with 35 additions and 2 deletions
+1
View File
@@ -78,6 +78,7 @@
"clear_title": "Alle Termine entfernen?",
"delete_description": "Der Kalender und alle seine Termine werden gelöscht. Dies kann nicht rückgängig gemacht werden.",
"delete_title": "Kalender löschen?",
"description_field": "Beschreibung",
"description_placeholder": "Optional",
"edit_calendar": "Kalender bearbeiten",
"new_calendar": "Neuer Kalender"
+1
View File
@@ -99,6 +99,7 @@
"custom_color": "Custom color (hex)",
"delete_description": "The calendar and all of its events will be deleted. This cannot be undone.",
"delete_title": "Delete calendar?",
"description_field": "Description",
"description_placeholder": "Optional",
"edit_calendar": "Edit calendar",
"fewer_colors": "Fewer colors",
@@ -307,9 +307,11 @@ export function CalendarEditSheet({ visible, calendar, onSave, onClose }: Calend
))}
</View>
)}
<Text style={styles.label}>{t('calendar.management.description', 'Description')}</Text>
{/* Not calendar.management.description: in the webmail's
catalog that is the management page's desktop help text. */}
<Text style={styles.label}>{t('calendar.management.description_field', 'Description')}</Text>
<TextInput
accessibilityLabel={t('calendar.management.description', 'Description')}
accessibilityLabel={t('calendar.management.description_field', 'Description')}
value={description}
onChangeText={setDescription}
placeholder={t('calendar.management.description_placeholder', 'Optional')}
@@ -0,0 +1,29 @@
import { describe, expect, it } from 'vitest';
import fs from 'node:fs';
import path from 'node:path';
const root = path.resolve(__dirname, '../../../..');
const source = fs.readFileSync(path.resolve(__dirname, '../CalendarEditSheet.tsx'), 'utf8');
const catalog = (file: string) => JSON.parse(fs.readFileSync(path.join(root, file), 'utf8'));
const common = catalog('locales/en/common.json');
const overlay = catalog('locales/rn/en.json');
function lookup(tree: Record<string, unknown>, key: string): unknown {
return key.split('.').reduce<unknown>((node, part) => (node as Record<string, unknown> | undefined)?.[part], tree);
}
// The app reads the overlay over the webmail's catalog.
const english = (key: string) => (lookup(overlay, key) ?? lookup(common, key)) as string | undefined;
describe('the calendar sheet’s description field', () => {
it('is named "Description", not by the webmail’s desktop help text', () => {
const before = source.slice(0, source.indexOf('value={description}'));
const input = before.slice(before.lastIndexOf('<TextInput'));
const key = input.match(/accessibilityLabel=\{t\('([^']+)'/)?.[1];
expect(key).toBeTruthy();
expect(english(key!)).toBe('Description');
const labels = [...before.matchAll(/<Text style=\{styles\.label\}>\{t\('([^']+)'/g)];
expect(english(labels[labels.length - 1][1])).toBe('Description');
});
});