Skip to content

Commit dd5ab8e

Browse files
committed
Add "UI." prefix to messages that are visible in the UI
1 parent 3f65859 commit dd5ab8e

16 files changed

Lines changed: 339 additions & 341 deletions

docs/adding-new-world-checklist.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
`'All worlds should be displayed as options and only one is checked'`
2424
test in `WorldSelector.test.js` for the new world
2525
- Add entries to `messages.json`
26-
- `<WorldName>.name`: the name of the world
26+
- `UI.<WorldName>.name`: the name of the world
2727
- `<WorldName>.character`: the name of the character
2828
- `<WorldName>.label`: the label used for the world in the
2929
Scene Background dialog

src/ActionsMenuItem.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export class ActionsMenuItem extends React.Component< ActionsMenuItemProps, {} >
3434

3535
render () {
3636
// We don't use FormattedMessage as we are working with a complex chain of templates.
37-
let commandName = this.props.intl.formatMessage({ id: `ActionsMenuItem.command.${this.props.itemKey}` });
38-
const usedLabel = this.props.intl.formatMessage({ id: 'ActionsMenuItem.usedItemToggleLabel' });
37+
let commandName = this.props.intl.formatMessage({ id: `UI.ActionsMenuItem.command.${this.props.itemKey}` });
38+
const usedLabel = this.props.intl.formatMessage({ id: 'UI.ActionsMenuItem.usedItemToggleLabel' });
3939
if (this.props.isUsed) {
4040
commandName += " " + usedLabel;
4141
}

src/ActionsSimplificationModal.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ class ActionsSimplificationModal extends React.Component<ActionsSimplificationMo
5454

5555
render() {
5656
const cancelButtonProperties = {
57-
label: this.props.intl.formatMessage({ id: 'Cancel'} ),
57+
label: this.props.intl.formatMessage({ id: 'UI.Cancel'} ),
5858
isPrimary: false,
5959
onClick: this.handleOnCancel
6060
};
6161
const saveButtonProperties = {
6262
id: 'ActionSimplificationModal-done',
6363
isPrimary: true,
64-
label: this.props.intl.formatMessage({ id: 'Save'} ),
64+
label: this.props.intl.formatMessage({ id: 'UI.Save'} ),
6565
onClick: this.saveChanges
6666
};
6767
return (
@@ -75,14 +75,14 @@ class ActionsSimplificationModal extends React.Component<ActionsSimplificationMo
7575
>
7676
<ModalHeader
7777
id='ActionsSimplificationModal__header'
78-
title={this.props.intl.formatMessage({ id: 'ActionsSimplificationModal.title'})}
78+
title={this.props.intl.formatMessage({ id: 'UI.ActionsSimplificationModal.title'})}
7979
>
8080
<SimplificationIcon aria-hidden='true'/>
8181
</ModalHeader>
8282

8383
<ModalBody>
8484
<h3 className='ActionsSimplificationModal__section-heading'>
85-
<FormattedMessage id="CommandPalette.movementsTitle"/>
85+
<FormattedMessage id="UI.CommandPalette.movementsTitle"/>
8686
</h3>
8787

8888
<div className='ActionsSimplificationModal__section'>
@@ -91,7 +91,7 @@ class ActionsSimplificationModal extends React.Component<ActionsSimplificationMo
9191

9292

9393
<h3 className='ActionsSimplificationModal__section-heading'>
94-
<FormattedMessage id="CommandPalette.controlsTitle"/>
94+
<FormattedMessage id="UI.CommandPalette.controlsTitle"/>
9595
</h3>
9696

9797
<div className='ActionsSimplificationModal__section'>

src/App.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,13 +1321,13 @@ export class App extends React.Component<AppProps, AppState> {
13211321
className="App__PrivacyModal__toggle-button"
13221322
onClick={this.handleClickPrivacyButton}
13231323
>
1324-
<FormattedMessage id='App.privacyModalToggle'/>
1324+
<FormattedMessage id='UI.App.privacyModalToggle'/>
13251325
</button>
13261326
</div>
13271327
<div className='App__header-menu'>
13281328
<IconButton
13291329
className="App__header-soundOptions"
1330-
ariaLabel={this.props.intl.formatMessage({ id: 'SoundOptionsModal.title' })}
1330+
ariaLabel={this.props.intl.formatMessage({ id: 'UI.SoundOptionsModal.title' })}
13311331
onClick={this.handleClickSoundIcon}
13321332
>
13331333
<AudioIcon
@@ -1476,14 +1476,14 @@ export class App extends React.Component<AppProps, AppState> {
14761476
<React.Fragment>
14771477
<div className='App__ActionsMenu__header'>
14781478
<h2 className='App__ActionsMenu__header-heading'>
1479-
<FormattedMessage id='ActionsMenu.title' />
1479+
<FormattedMessage id='UI.ActionsMenu.title' />
14801480
</h2>
14811481
</div>
14821482
<div className='App__command-palette-command-container'>
14831483
<div className='App__command-palette-section'>
14841484
<div className='App__command-palette-section-heading-container'>
14851485
<h3 className='App__command-palette-section-heading'>
1486-
<FormattedMessage id='CommandPalette.movementsTitle'/>
1486+
<FormattedMessage id='UI.CommandPalette.movementsTitle'/>
14871487
</h3>
14881488
</div>
14891489
<div className='App__command-palette-section-body'>
@@ -1508,7 +1508,7 @@ export class App extends React.Component<AppProps, AppState> {
15081508
<div className='App__command-palette-section'>
15091509
<div className='App__command-palette-section-heading-container'>
15101510
<h3 className='App__command-palette-section-heading'>
1511-
<FormattedMessage id='CommandPalette.controlsTitle'/>
1511+
<FormattedMessage id='UI.CommandPalette.controlsTitle'/>
15121512
</h3>
15131513
</div>
15141514

@@ -1601,7 +1601,7 @@ export class App extends React.Component<AppProps, AppState> {
16011601
aria-hidden={true}
16021602
/>
16031603
<div className='App__ShareButton__label'>
1604-
{this.props.intl.formatMessage({id:'ShareButton'})}
1604+
{this.props.intl.formatMessage({id:'UI.ShareButton'})}
16051605
</div>
16061606
</button>
16071607
</div>

src/CharacterMessageBuilder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default class CharacterMessageBuilder {
2727
buildEndOfSceneMessage(): string {
2828
return this.intl.formatMessage(
2929
{
30-
id:'CharacterMessageBuilder.endOfScene'
30+
id:'UI.CharacterMessageBuilder.endOfScene'
3131
}
3232
);
3333
}
@@ -37,7 +37,7 @@ export default class CharacterMessageBuilder {
3737
const rowLabel = this.dimensions.getRowLabel(y);
3838
return this.intl.formatMessage(
3939
{
40-
id:'CharacterMessageBuilder.hitWall'
40+
id:'UI.CharacterMessageBuilder.hitWall'
4141
},
4242
{
4343
columnLabel: columnLabel == null ? '' : columnLabel,

src/ConfirmDeleteAllModal.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,24 @@ class ConfirmDeleteAllModal extends React.Component<ConfirmDeleteAllModalProps,
2323
show={this.props.show}
2424
focusOnOpenSelector={'#ConformDeleteAllModal-confirm'}
2525
focusOnCloseSelector={'.ProgramBlockEditor__program-deleteAll-button'}
26-
ariaLabel={this.props.intl.formatMessage({ id: 'ConfirmDeleteAllModal.title' })}
26+
ariaLabel={this.props.intl.formatMessage({ id: 'UI.ConfirmDeleteAllModal.title' })}
2727
onClose={this.props.onCancel}
2828
buttonProperties={
2929
[
30-
{label: this.props.intl.formatMessage({id: 'Cancel'}), onClick: this.props.onCancel},
31-
{id: 'ConformDeleteAllModal-confirm', label: this.props.intl.formatMessage({id: 'ConfirmDeleteAllModal.confirmButton'}), onClick: this.props.onConfirm, isPrimary: true}
30+
{label: this.props.intl.formatMessage({id: 'UI.Cancel'}), onClick: this.props.onCancel},
31+
{id: 'ConformDeleteAllModal-confirm', label: this.props.intl.formatMessage({id: 'UI.ConfirmDeleteAllModal.confirmButton'}), onClick: this.props.onConfirm, isPrimary: true}
3232
]
3333
}>
3434
<ModalHeader
3535
id='ConfirmDeleteAllModal'
3636
title={this.props.intl.formatMessage({
37-
id: 'ConfirmDeleteAllModal.title'
37+
id: 'UI.ConfirmDeleteAllModal.title'
3838
})}>
3939
<DeleteIcon aria-hidden='true' />
4040
</ModalHeader>
4141
<ModalBody>
4242
<div className='ConfirmDeleteAllModal__content'>
43-
<FormattedMessage id='ConfirmDeleteAllModal.content' />
43+
<FormattedMessage id='UI.ConfirmDeleteAllModal.content' />
4444
</div>
4545
</ModalBody>
4646
</ModalWithFooter>

src/KeyboardInputModal.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ class KeyboardInputModal extends React.Component<KeyboardInputModalProps, Keyboa
115115

116116
if (keyDef.altKey) {
117117
const altKeyLabel = this.props.intl.formatMessage(
118-
{ id: "KeyboardInputModal.KeyLabels.Alt" }
118+
{ id: "UI.KeyboardInputModal.KeyLabels.Alt" }
119119
);
120120
labelKeySegments.unshift(altKeyLabel);
121121

122122
const altKeyIcon = this.props.intl.formatMessage(
123-
{ id: "KeyboardInputModal.KeyIcons.Alt" }
123+
{ id: "UI.KeyboardInputModal.KeyIcons.Alt" }
124124
);
125125
icons.unshift(<div key="alt-modifier" className="KeyboardInputModal__binding__icon">
126126
{altKeyIcon}
@@ -129,20 +129,20 @@ class KeyboardInputModal extends React.Component<KeyboardInputModalProps, Keyboa
129129

130130
if (keyDef.ctrlKey) {
131131
const controlKeyLabel = this.props.intl.formatMessage(
132-
{ id: "KeyboardInputModal.KeyLabels.Control" }
132+
{ id: "UI.KeyboardInputModal.KeyLabels.Control" }
133133
);
134134
labelKeySegments.unshift(controlKeyLabel);
135135

136136
const controlKeyIcon = this.props.intl.formatMessage(
137-
{ id: "KeyboardInputModal.KeyIcons.Control" }
137+
{ id: "UI.KeyboardInputModal.KeyIcons.Control" }
138138
);
139139
icons.unshift(<div key="ctrl-modifier" className="KeyboardInputModal__binding__icon">
140140
{controlKeyIcon}
141141
</div>);
142142
}
143143

144144
const labelKeyString = labelKeySegments.join(" + ")
145-
const descriptionMessageKey = "KeyboardInputModal.Description." + key;
145+
const descriptionMessageKey = "UI.KeyboardInputModal.Description." + key;
146146
const descriptionMessageId = "key-binding-description-" + index;
147147
keyBindingElements.push(<li className="KeyboardInputModal__binding" key={itemKey}>
148148
<div className="KeyboardInputModal__binding__keyCombo" aria-hidden={true} aria-labelledby={descriptionMessageId}>
@@ -165,7 +165,7 @@ class KeyboardInputModal extends React.Component<KeyboardInputModalProps, Keyboa
165165
renderKeyboardSchemeMenu () {
166166
const selectOptionElements = [];
167167
Object.keys(KeyboardInputSchemes).forEach((schemeName) => {
168-
const messageId = "KeyboardInputModal.Scheme.Descriptions." + schemeName;
168+
const messageId = "UI.KeyboardInputModal.Scheme.Descriptions." + schemeName;
169169
const optionText = this.props.intl.formatMessage({ id: messageId });
170170
selectOptionElements.push(<option key={schemeName} value={schemeName}>
171171
{optionText}
@@ -182,20 +182,20 @@ class KeyboardInputModal extends React.Component<KeyboardInputModalProps, Keyboa
182182

183183
render () {
184184
const cancelButtonProperties = {
185-
label: this.props.intl.formatMessage({id: 'Cancel'}),
185+
label: this.props.intl.formatMessage({id: 'UI.Cancel'}),
186186
onClick: this.cancelChanges
187187
};
188188

189189
const doneButtonProperties = {
190190
id: 'KeyboardInputModal-done',
191-
label: this.props.intl.formatMessage({id: 'Save'}),
191+
label: this.props.intl.formatMessage({id: 'UI.Save'}),
192192
onClick: this.saveChanges,
193193
isPrimary: true
194194
};
195195

196196
return(
197197
<ModalWithFooter
198-
ariaLabel={this.props.intl.formatMessage({ id: 'KeyboardInputModal.Title' })}
198+
ariaLabel={this.props.intl.formatMessage({ id: 'UI.KeyboardInputModal.Title' })}
199199
onClose={this.cancelChanges}
200200
show={this.props.show}
201201
focusOnOpenSelector={'#keyboardInputModal__toggle'}
@@ -204,7 +204,7 @@ class KeyboardInputModal extends React.Component<KeyboardInputModalProps, Keyboa
204204
>
205205
<ModalHeader
206206
id='KeyboardInputModal'
207-
title={this.props.intl.formatMessage({ id: 'KeyboardInputModal.Title' })}>
207+
title={this.props.intl.formatMessage({ id: 'UI.KeyboardInputModal.Title' })}>
208208
<KeyboardIcon aria-hidden='true'/>
209209
</ModalHeader>
210210

@@ -216,7 +216,7 @@ class KeyboardInputModal extends React.Component<KeyboardInputModalProps, Keyboa
216216
</div>
217217
<div className="KeyboardInputModal__content__toggleBar__toggle">
218218
<div aria-hidden='true'>
219-
<FormattedMessage id='Off'/>
219+
<FormattedMessage id='UI.Off'/>
220220
</div>
221221
<ToggleSwitch
222222
id='keyboardInputModal__toggle'
@@ -228,7 +228,7 @@ class KeyboardInputModal extends React.Component<KeyboardInputModalProps, Keyboa
228228
onChange={this.handleChangeKeyBindingsEnabled}
229229
/>
230230
<div aria-hidden='true'>
231-
<FormattedMessage id='On'/>
231+
<FormattedMessage id='UI.On'/>
232232
</div>
233233
</div>
234234
</div>

src/KeyboardInputSchemes.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -543,20 +543,20 @@ export const KeyboardInputSchemes: KeyboardInputSchemesType = {
543543
};
544544

545545
const labelMessageKeysByCode = {
546-
"KeyA": "KeyboardInputModal.KeyLabels.A",
547-
"KeyB": "KeyboardInputModal.KeyLabels.B",
548-
"KeyD": "KeyboardInputModal.KeyLabels.D",
549-
"KeyE": "KeyboardInputModal.KeyLabels.E",
550-
"KeyI": "KeyboardInputModal.KeyLabels.I",
551-
"KeyP": "KeyboardInputModal.KeyLabels.P",
552-
"KeyS": "KeyboardInputModal.KeyLabels.S",
553-
"KeyR": "KeyboardInputModal.KeyLabels.R"
546+
"KeyA": "UI.KeyboardInputModal.KeyLabels.A",
547+
"KeyB": "UI.KeyboardInputModal.KeyLabels.B",
548+
"KeyD": "UI.KeyboardInputModal.KeyLabels.D",
549+
"KeyE": "UI.KeyboardInputModal.KeyLabels.E",
550+
"KeyI": "UI.KeyboardInputModal.KeyLabels.I",
551+
"KeyP": "UI.KeyboardInputModal.KeyLabels.P",
552+
"KeyS": "UI.KeyboardInputModal.KeyLabels.S",
553+
"KeyR": "UI.KeyboardInputModal.KeyLabels.R"
554554
};
555555

556556
const labelMessageKeysByKey = {
557-
"?": "KeyboardInputModal.KeyLabels.QuestionMark",
558-
">": "KeyboardInputModal.KeyLabels.GreaterThan",
559-
"<": "KeyboardInputModal.KeyLabels.LessThan"
557+
"?": "UI.KeyboardInputModal.KeyLabels.QuestionMark",
558+
">": "UI.KeyboardInputModal.KeyLabels.GreaterThan",
559+
"<": "UI.KeyboardInputModal.KeyLabels.LessThan"
560560
};
561561

562562
export function getLabelMessageKeyFromKeyDef (keyDef: KeyDef) {
@@ -572,20 +572,20 @@ export function getLabelMessageKeyFromKeyDef (keyDef: KeyDef) {
572572
};
573573

574574
const iconMessageKeysByCode = {
575-
"KeyA": "KeyboardInputModal.KeyIcons.A",
576-
"KeyB": "KeyboardInputModal.KeyIcons.B",
577-
"KeyD": "KeyboardInputModal.KeyIcons.D",
578-
"KeyE": "KeyboardInputModal.KeyIcons.E",
579-
"KeyI": "KeyboardInputModal.KeyIcons.I",
580-
"KeyP": "KeyboardInputModal.KeyIcons.P",
581-
"KeyS": "KeyboardInputModal.KeyIcons.S",
582-
"KeyR": "KeyboardInputModal.KeyIcons.R"
575+
"KeyA": "UI.KeyboardInputModal.KeyIcons.A",
576+
"KeyB": "UI.KeyboardInputModal.KeyIcons.B",
577+
"KeyD": "UI.KeyboardInputModal.KeyIcons.D",
578+
"KeyE": "UI.KeyboardInputModal.KeyIcons.E",
579+
"KeyI": "UI.KeyboardInputModal.KeyIcons.I",
580+
"KeyP": "UI.KeyboardInputModal.KeyIcons.P",
581+
"KeyS": "UI.KeyboardInputModal.KeyIcons.S",
582+
"KeyR": "UI.KeyboardInputModal.KeyIcons.R"
583583
};
584584

585585
const iconMessageKeysByKey = {
586-
"?": "KeyboardInputModal.KeyIcons.QuestionMark",
587-
">": "KeyboardInputModal.KeyIcons.GreaterThan",
588-
"<": "KeyboardInputModal.KeyIcons.LessThan"
586+
"?": "UI.KeyboardInputModal.KeyIcons.QuestionMark",
587+
">": "UI.KeyboardInputModal.KeyIcons.GreaterThan",
588+
"<": "UI.KeyboardInputModal.KeyIcons.LessThan"
589589
};
590590

591591
export function getIconMessageKeyFromKeyDef (keyDef: KeyDef) {

0 commit comments

Comments
 (0)