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
7 changes: 7 additions & 0 deletions docs/ai/localization.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ For new English units use `<source>…</source>` with an empty `<target/>`, and
a `<context-group context-type="sourcefile">` pointing to the primary consuming
file (e.g. `BurritoFormat.tsx`) so translators see where the string is used.

### Aria labels: reuse a visible label's string

When feasible, an `aria-label` (or other
accessibility-only text) should prefer to **reuse the string already shown as the
control's visible label** — a column header, field label, button text, or
tooltip — instead of adding a new XLIFF unit.

## Regenerating TypeScript after XLIFF changes

From the **repo root** in **PowerShell**:
Expand Down
7 changes: 0 additions & 7 deletions localization/TranscriberAdmin-en-1.2.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -7621,13 +7621,6 @@
<context context-type="sourcefile">PlanSheet.tsx</context>
</context-group>
</trans-unit>
<trans-unit id="planSheet.noteTitle">
<source>Note title</source>
<target/>
<context-group>
<context context-type="sourcefile">NoteTitleField.tsx</context>
</context-group>
</trans-unit>
<trans-unit id="planSheet.pasting">
<source>Pasting</source>
<target/>
Expand Down
6 changes: 0 additions & 6 deletions localization/TranscriberAdmin-en.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -6532,12 +6532,6 @@
<target/>
</segment>
</unit>
<unit id="planSheet.noteTitle">
<segment>
<source>Note title</source>
<target/>
</segment>
</unit>
<unit id="planSheet.pasting">
<segment>
<source>Pasting</source>
Expand Down
2 changes: 1 addition & 1 deletion web/public/localization/stringse76d118f.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions web/src/components/Sheet/NoteTitleField.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ function TitleCell({ readonly = false }: { readonly?: boolean }) {

describe('note title dictionary', () => {
beforeEach(() => {
mockUseSelector.mockReturnValue({ noteTitle: 'Note title' });
mockUseSelector.mockReturnValue({ title: 'Title' });
});

it('does not open the sheet menu on a misspelled note title', () => {
render(<TitleCell />);
const title = screen.getByRole('textbox', { name: 'Note title' });
const title = screen.getByRole('textbox', { name: 'Title' });
expect(title).toHaveAttribute('spellcheck', 'true');
expect(title).not.toHaveAttribute('readonly');
fireEvent.change(title, { target: { value: 'Changed' } });
Expand All @@ -46,7 +46,7 @@ describe('note title dictionary', () => {

it('does not change a read-only note title', () => {
render(<TitleCell readonly />);
const title = screen.getByRole('textbox', { name: 'Note title' });
const title = screen.getByRole('textbox', { name: 'Title' });
expect(title).toHaveAttribute('spellcheck', 'true');
expect(title).toHaveAttribute('readonly');
fireEvent.change(title, { target: { value: 'Changed' } });
Expand Down
12 changes: 8 additions & 4 deletions web/src/components/Sheet/NoteTitleField.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TextField } from '@mui/material';
import { IPlanSheetStrings } from '@model/index';
import { IScriptureTableStrings } from '@model/index';
import { useSelector, shallowEqual } from 'react-redux';
import { planSheetSelector } from '../../selector';
import { scriptureTableSelector } from '../../selector';

export function NoteTitleField({
value,
Expand All @@ -12,7 +12,10 @@ export function NoteTitleField({
onChange: (value: string) => void;
readonly?: boolean;
}>) {
const t: IPlanSheetStrings = useSelector(planSheetSelector, shallowEqual);
const t: IScriptureTableStrings = useSelector(
scriptureTableSelector,
shallowEqual
);
return (
<TextField
value={value}
Expand All @@ -24,7 +27,8 @@ export function NoteTitleField({
spellCheck
slotProps={{
htmlInput: {
'aria-label': t.noteTitle,
// Same text as the visible Title column header.
'aria-label': t.title,
spellCheck: true,
readOnly: readonly,
},
Expand Down
1 change: 0 additions & 1 deletion web/src/store/localization/model.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,6 @@ export interface IPlanSheetStrings extends Localize.LocalizedStringsMethods {
"passageEnd": string;
"passageToPrevSection": string;
"passageToNextSection": string;
"noteTitle": string;
"pasting": string;
"propagate": string;
"publish": string;
Expand Down
1 change: 0 additions & 1 deletion web/src/store/localization/reducers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,6 @@ const initialState = {
"passageEnd": "Add Passage to End",
"passageToPrevSection": "Move {pt} {0} Up",
"passageToNextSection": "Move {pt} {0} Down",
"noteTitle": "Note title",
"pasting": "Pasting",
"propagate": "Propagate to all {0} in the {1}",
"publish": "Publish {0} {1}",
Expand Down
Loading