Skip to content

Commit

Permalink
Merge pull request #2007 from Heigvd/WEG-138
Browse files Browse the repository at this point in the history
WEG-138 Use player language to translate component’s text
  • Loading branch information
TehAwol authored Jan 16, 2025
2 parents 20e7223 + bec9cad commit e60dfcc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { editingStore } from '../../data/Stores/editingStore';
import { useStore } from '../../data/Stores/store';
import { wwarn } from '../../Helper/wegaslog';
import { componentsTranslations } from '../../i18n/components/components';
import { useInternalTranslate } from '../../i18n/internalTranslator';
import { useInternalPlayerLangTranslate } from '../../i18n/internalTranslator';
import {
DefaultEntityChooserLabel,
defaultEntityDisplay,
Expand Down Expand Up @@ -177,7 +177,7 @@ interface MessageDisplayProps {
}

function MessageDisplay({ entity }: MessageDisplayProps) {
const i18nComponentValues = useInternalTranslate(componentsTranslations);
const i18nComponentValues = useInternalPlayerLangTranslate(componentsTranslations);

const subject = useTranslate(entity.subject);
const date = useTranslate(entity.date);
Expand Down Expand Up @@ -233,7 +233,7 @@ export function InboxDisplay({
}, [inbox]);

const messages = useStore(messagesSelector);
const i18nComponentValues = useInternalTranslate(componentsTranslations);
const i18nComponentValues = useInternalPlayerLangTranslate(componentsTranslations);

return (
<EntityChooser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import * as VariableDescriptorSelector from '../../../data/selectors/VariableDes
import { editingStore } from '../../../data/Stores/editingStore';
import { useStore } from '../../../data/Stores/store';
import { createFindVariableScript } from '../../../Helper/wegasEntites';
import { useInternalTranslate } from '../../../i18n/internalTranslator';
import { useInternalPlayerLangTranslate } from '../../../i18n/internalTranslator';
import { PeerReviewTranslations } from '../../../i18n/peerReview/definitions';
import { peerReviewTranslations } from '../../../i18n/peerReview/peerReview';
import { languagesCTX } from '../../Contexts/LanguagesProvider';
Expand Down Expand Up @@ -141,7 +141,7 @@ const prPhasesJustifyStyle = css({
const phases = ['edition', 'reviewing', 'commenting', 'completed'];

function PRPHaseComponent({ value, phase }: PhaseComponentProps) {
const i18nValues = useInternalTranslate(peerReviewTranslations);
const i18nValues = useInternalPlayerLangTranslate(peerReviewTranslations);
return (
<div
className={cx(flex, flexColumn, justifyCenter, prPhaseComponentStyle, {
Expand Down Expand Up @@ -377,7 +377,7 @@ function EvalutationsEditor({
});
const [waitingState, setWaitingState] = React.useState(false);

const i18nValues = useInternalTranslate(peerReviewTranslations);
const i18nValues = useInternalPlayerLangTranslate(peerReviewTranslations);
const { showModal, OkCancelModal } = useOkCancelModal();

React.useEffect(() => {
Expand Down Expand Up @@ -518,7 +518,7 @@ function ReviewEditor({
disabled,
readOnly,
}: ReviewEditorProps) {
const i18nValues = useInternalTranslate(peerReviewTranslations);
const i18nValues = useInternalPlayerLangTranslate(peerReviewTranslations);

const rev = useStore(() => {
const reviewed = peerReview
Expand Down Expand Up @@ -669,7 +669,7 @@ export default function PeerReviewTreeViewDisplay({
id,
options,
}: PeerReviewTreeViewDisplayProps) {
const i18nValues = useInternalTranslate(peerReviewTranslations);
const i18nValues = useInternalPlayerLangTranslate(peerReviewTranslations);
const sPR = useScript<SPeerReviewDescriptor | undefined>(peerReview, context);
const sPRinstance = useStore(() => sPR?.getInstance(Player.self()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { findByName } from '../../../data/selectors/VariableDescriptorSelector';
import { editingStore } from '../../../data/Stores/editingStore';
import { store, useStore } from '../../../data/Stores/store';
import { createFindVariableScript } from '../../../Helper/wegasEntites';
import { useInternalTranslate } from '../../../i18n/internalTranslator';
import { useInternalPlayerLangTranslate } from '../../../i18n/internalTranslator';
import { peerReviewTranslations } from '../../../i18n/peerReview/peerReview';
import { languagesCTX } from '../../Contexts/LanguagesProvider';
import { deepDifferent } from '../../Hooks/storeHookFactory';
Expand Down Expand Up @@ -73,7 +73,7 @@ export default function PeerReviewVariableEditor({
const lastVal = React.useRef<string | number | undefined>();
const timer = React.useRef<Timer | null>();
const { lang } = React.useContext(languagesCTX);
const i18nValues = useInternalTranslate(peerReviewTranslations);
const i18nValues = useInternalPlayerLangTranslate(peerReviewTranslations);
const sPR = useScript<SPeerReviewDescriptor | undefined>(peerReview, context);
const reviewState = useStore(() =>
sPR?.getInstance(Player.self()).getReviewState(),
Expand Down Expand Up @@ -185,7 +185,7 @@ export default function PeerReviewVariableEditor({
if (reviewState !== 'NOT_STARTED') {
return (
<div className={grow}>
<h3>Your submission:</h3>
<h3>{i18nValues.tabview.toReview}:</h3>
<HTMLText text={String(value)} className={submissionStyle} />
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Select from 'react-select';
import CreatableSelect from 'react-select/creatable';
import { classNameOrEmpty } from '../Helper/className';
import { componentsTranslations } from '../i18n/components/components';
import { useInternalTranslate } from '../i18n/internalTranslator';
import { useInternalPlayerLangTranslate } from '../i18n/internalTranslator';
import { inputStyleCSS } from './Inputs/SimpleInput';
import { themeVar } from './Theme/ThemeVars';

Expand Down Expand Up @@ -182,7 +182,7 @@ export function Selector<T extends true | false>({
readOnly,
disabled,
}: SelectorProps<T>): JSX.Element {
const i18nValues = useInternalTranslate(componentsTranslations).select;
const i18nValues = useInternalPlayerLangTranslate(componentsTranslations).select;

const options = buildOptions(choices);

Expand Down

0 comments on commit e60dfcc

Please sign in to comment.