Skip to content

Commit 65c24c9

Browse files
committed
Fetch role snippet by locale
1 parent 34a2ec5 commit 65c24c9

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

src/app/components/role-selector/role-selector.js

+4-20
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,6 @@ export function RoleDropdown({ options, setValue, name = 'subject' }) {
2323
);
2424
}
2525

26-
// Jest didn't like dynamic id for formatMessage
27-
const spanishRoles = {
28-
'Student': 'Estudiante',
29-
'Faculty': 'Instructor(a)',
30-
'Home School Teacher': 'Instructor(a) de educación en el hogar',
31-
'Administrator': 'Administrador(a)',
32-
'Librarian': 'Bibliotecario',
33-
'Instructional Designer': 'Diseñador(a) instruccional',
34-
'Adjunct Faculty': 'Adjunto Facultad',
35-
'Other': 'Otro'
36-
};
37-
3826
/* eslint-disable */
3927
function RoleSelector({
4028
data: options,
@@ -44,19 +32,13 @@ function RoleSelector({
4432
hidden = false
4533
}) {
4634
const [studentContent, facultyContent] = children;
47-
const {language} = useLanguageContext();
48-
const translatedOptions = options.map(
49-
(opt) => {
50-
return {...opt, displayName: language === 'es' && spanishRoles[opt.salesforceName] || opt.displayName};
51-
}
52-
);
5335

5436
return (
5537
<div className="role-selector">
5638
<form data-region="selector">
5739
<label hidden={hidden}>
5840
<FormattedMessage id="role-selector.i-am" defaultMessage='I am a' />
59-
<RoleDropdown options={translatedOptions} setValue={setValue} />
41+
<RoleDropdown options={options} setValue={setValue} />
6042
</label>
6143
</form>
6244
{value === "Student" && studentContent}
@@ -66,7 +48,9 @@ function RoleSelector({
6648
}
6749

6850
export default function RoleSelectorLoader(props) {
51+
const {language} = useLanguageContext();
52+
6953
return (
70-
<LoaderPage slug="snippets/roles" props={props} Child={RoleSelector} />
54+
<LoaderPage slug={`snippets/roles?locale=${language}`} props={props} Child={RoleSelector} />
7155
);
7256
}

0 commit comments

Comments
 (0)