Skip to content

Commit

Permalink
chore: update translation (#192)
Browse files Browse the repository at this point in the history
* chore: update translation

* chore: update test

---------

Co-authored-by: Leangseu Kim <[email protected]>
  • Loading branch information
leangseu-edx and Leangseu Kim authored Apr 3, 2024
1 parent ee8c290 commit 4e0dc3c
Show file tree
Hide file tree
Showing 8 changed files with 1,121 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/components/Prompt/__snapshots__/index.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports[`<Prompt /> render default 1`] = `
<h3
className="py-3"
>
title
Prompt
</h3>
}
>
Expand All @@ -30,7 +30,7 @@ exports[`<Prompt /> render with open and onToggle 1`] = `
<h3
className="py-3"
>
title
Prompt
</h3>
}
>
Expand Down
6 changes: 2 additions & 4 deletions src/components/Prompt/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import messages from './messages';
import './index.scss';

const Prompt = ({
prompt, title, open, onToggle,
prompt, open, onToggle,
}) => {
const { formatMessage } = useIntl();
const viewStep = useViewStep();
const activeStepName = useActiveStepName();
const message = messages[viewStep] || messages[activeStepName] || messages.promptTitle;
const promptTitle = title || formatMessage(message);
const promptTitle = formatMessage(message);
const imgRegex = /img src="\/asset-v1([^"]*)?"/g;
const linkRegex = /a href="\/asset-v1([^"]*)?"/g;
const { baseAssetUrl } = useORAConfigData();
Expand Down Expand Up @@ -51,14 +51,12 @@ const Prompt = ({
Prompt.defaultProps = {
open: null,
onToggle: null,
title: null,
};

Prompt.propTypes = {
prompt: PropTypes.string.isRequired,
open: PropTypes.bool,
onToggle: PropTypes.func,
title: PropTypes.string,
};

export default Prompt;
280 changes: 279 additions & 1 deletion src/i18n/messages/ar.json

Large diffs are not rendered by default.

280 changes: 279 additions & 1 deletion src/i18n/messages/es_419.json

Large diffs are not rendered by default.

280 changes: 279 additions & 1 deletion src/i18n/messages/fr.json

Large diffs are not rendered by default.

280 changes: 279 additions & 1 deletion src/i18n/messages/zh_CN.json

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions src/views/XBlockStudioView/components/StudioViewPrompt.jsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
import React from 'react';

import { useIntl } from '@edx/frontend-platform/i18n';

import { usePrompts } from 'hooks/app';
import Prompt from 'components/Prompt';

import { useXBlockStudioViewContext } from './XBlockStudioViewProvider';
import messages from './messages';

const StudioViewPrompt = () => {
const { formatMessage } = useIntl();
const prompts = usePrompts();

const { promptIsOpen, togglePrompt } = useXBlockStudioViewContext();

return (
<>
{prompts.map((prompt, index) => (
{prompts.map((prompt) => (
<Prompt
key={prompt}
prompt={prompt}
title={`${formatMessage(messages.promptHeader)} ${index + 1}`}
open={promptIsOpen}
onToggle={togglePrompt}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ exports[`<StudioViewPrompt /> render with prompt 1`] = `
onToggle={[MockFunction togglePrompt]}
open={true}
prompt="prompt1"
title="Prompt 1"
/>
<Prompt
key="prompt2"
onToggle={[MockFunction togglePrompt]}
open={true}
prompt="prompt2"
title="Prompt 2"
/>
</Fragment>
`;
Expand Down

0 comments on commit 4e0dc3c

Please sign in to comment.