Skip to content

Commit d50b5ae

Browse files
authored
Merge pull request #55380 from drminh2807/fix/55246
2 parents 987611a + 23a4306 commit d50b5ae

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/components/OptionListContextProvider.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ function OptionsListContextProvider({children}: OptionsListProviderProps) {
4646
reports: [],
4747
personalDetails: [],
4848
});
49+
const [preferredLocale] = useOnyx(ONYXKEYS.NVP_PREFERRED_LOCALE);
4950
const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT);
5051

5152
const personalDetails = usePersonalDetails();
@@ -71,7 +72,7 @@ function OptionsListContextProvider({children}: OptionsListProviderProps) {
7172
return newOptions;
7273
});
7374
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
74-
}, [reports]);
75+
}, [reports, preferredLocale]);
7576

7677
/**
7778
* This effect is used to update the options list when personal details change.

tests/unit/OptionsListUtilsTest.ts

+11
Original file line numberDiff line numberDiff line change
@@ -1037,4 +1037,15 @@ describe('OptionsListUtils', () => {
10371037
expect(canCreate).toBe(false);
10381038
});
10391039
});
1040+
1041+
it('createOptionList() localization', () => {
1042+
const reports = OptionsListUtils.createOptionList(PERSONAL_DETAILS, REPORTS).reports;
1043+
expect(reports.at(9)?.subtitle).toBe('Workspace');
1044+
return waitForBatchedUpdates()
1045+
.then(() => Onyx.set(ONYXKEYS.NVP_PREFERRED_LOCALE, CONST.LOCALES.ES))
1046+
.then(() => {
1047+
const newReports = OptionsListUtils.createOptionList(PERSONAL_DETAILS, REPORTS).reports;
1048+
expect(newReports.at(9)?.subtitle).toBe('Espacio de trabajo');
1049+
});
1050+
});
10401051
});

0 commit comments

Comments
 (0)