Skip to content

Commit

Permalink
fix: correctly translate strings in Checkpoint component (#2886)
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorrusakov authored Dec 22, 2023
1 parent dc38d63 commit bfe4b8d
Show file tree
Hide file tree
Showing 21 changed files with 66 additions and 25 deletions.
15 changes: 9 additions & 6 deletions src/ProductTour/Checkpoint.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import CheckpointActionRow from './CheckpointActionRow';
import CheckpointBody from './CheckpointBody';
import CheckpointBreadcrumbs from './CheckpointBreadcrumbs';
import CheckpointTitle from './CheckpointTitle';
import messages from './messages';

const Checkpoint = React.forwardRef(({
body,
Expand Down Expand Up @@ -99,10 +100,8 @@ const Checkpoint = React.forwardRef(({
>
<span className="sr-only">
<FormattedMessage
id="pgn.ProductTour.Checkpoint.position-text"
defaultMessage="Top of step {step}"
value={{ step: index + 1 }}
description="Screen-reader message to indicate the user's position in a sequence of checkpoints."
{...messages.topPositionText}
values={{ step: index + 1 }}
/>
</span>
{(title || !isOnlyCheckpoint) && (
Expand All @@ -118,8 +117,12 @@ const Checkpoint = React.forwardRef(({
{...props}
/>
<div id="pgn__checkpoint-arrow" data-popper-arrow />
{/* This text is not translated due to Paragon's lack of i18n support */}
<span className="sr-only">Bottom of step {index + 1}</span>
<span className="sr-only">
<FormattedMessage
{...messages.bottomPositionText}
values={{ step: index + 1 }}
/>
</span>
</div>
);
});
Expand Down
16 changes: 16 additions & 0 deletions src/ProductTour/messages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineMessages } from 'react-intl';

const messages = defineMessages({
topPositionText: {
id: 'pgn.ProductTour.Checkpoint.top-position-text',
defaultMessage: 'Top of step {step}',
description: 'Screen-reader message to notify user that they are located at the bottom of the product tour step.',
},
bottomPositionText: {
id: 'pgn.ProductTour.Checkpoint.bottom-position-text',
defaultMessage: 'Bottom of step {step}',
description: 'Screen-reader message to notify user that they are located at the bottom of the product tour step.',
},
});

export default messages;
3 changes: 2 additions & 1 deletion src/i18n/messages/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "إغلاق قائمة الخيارات",
"pgn.FormAutosuggest.iconButtonOpened": "فتح قائمة الخيارات",
"pgn.Toast.closeLabel": "إغلاق ",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
3 changes: 2 additions & 1 deletion src/i18n/messages/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
"pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
"pgn.Toast.closeLabel": "Close",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
3 changes: 2 additions & 1 deletion src/i18n/messages/es_419.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "Cerrar el menú de opciones",
"pgn.FormAutosuggest.iconButtonOpened": "Abre el menú de opciones",
"pgn.Toast.closeLabel": "Cerrar",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
3 changes: 2 additions & 1 deletion src/i18n/messages/es_AR.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "Cerrar el menú de opciones",
"pgn.FormAutosuggest.iconButtonOpened": "Abre el menú de opciones",
"pgn.Toast.closeLabel": "Cerrar",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
3 changes: 2 additions & 1 deletion src/i18n/messages/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "Cerrar el menú de opciones",
"pgn.FormAutosuggest.iconButtonOpened": "Abre el menú de opciones",
"pgn.Toast.closeLabel": "Cerrar",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
3 changes: 2 additions & 1 deletion src/i18n/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
"pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
"pgn.Toast.closeLabel": "Close",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
3 changes: 2 additions & 1 deletion src/i18n/messages/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
"pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
"pgn.Toast.closeLabel": "Close",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
3 changes: 2 additions & 1 deletion src/i18n/messages/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
"pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
"pgn.Toast.closeLabel": "Close",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
3 changes: 2 additions & 1 deletion src/i18n/messages/it_IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
"pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
"pgn.Toast.closeLabel": "Chiudi",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
3 changes: 2 additions & 1 deletion src/i18n/messages/ko_KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
"pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
"pgn.Toast.closeLabel": "Close",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
3 changes: 2 additions & 1 deletion src/i18n/messages/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
"pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
"pgn.Toast.closeLabel": "Zamknij",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
3 changes: 2 additions & 1 deletion src/i18n/messages/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
"pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
"pgn.Toast.closeLabel": "Close",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
3 changes: 2 additions & 1 deletion src/i18n/messages/pt_PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "Fechar o menu de opções",
"pgn.FormAutosuggest.iconButtonOpened": "Abrir o menu de opções",
"pgn.Toast.closeLabel": "Fechar",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
3 changes: 2 additions & 1 deletion src/i18n/messages/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
"pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
"pgn.Toast.closeLabel": "Close",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
3 changes: 2 additions & 1 deletion src/i18n/messages/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
"pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
"pgn.Toast.closeLabel": "Close",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
3 changes: 2 additions & 1 deletion src/i18n/messages/tr_TR.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "Seçenekler menüsünü kapat",
"pgn.FormAutosuggest.iconButtonOpened": "Seçenekler menüsünü aç",
"pgn.Toast.closeLabel": "Kapat",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
3 changes: 2 additions & 1 deletion src/i18n/messages/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
"pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
"pgn.Toast.closeLabel": "Close",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
3 changes: 2 additions & 1 deletion src/i18n/messages/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
"pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
"pgn.Toast.closeLabel": "Close",
"pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
"pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
"pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
}
6 changes: 5 additions & 1 deletion www/src/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ ComponentNavItem.propTypes = {
title: PropTypes.string.isRequired,
status: PropTypes.string,
}).isRequired,
isActive: PropTypes.bool.isRequired,
isActive: PropTypes.bool,
};

ComponentNavItem.defaultProps = {
isActive: false,
};

export type MenuComponentListTypes = {
Expand Down

0 comments on commit bfe4b8d

Please sign in to comment.