@@ -15,6 +15,7 @@ import Autocomplete, {
1515import { CloseIcon , ExpandMoreIcon } from "components/Icons" ;
1616import { useTranslation } from "i18n" ;
1717import { PROFILE } from "i18n/namespaces" ;
18+ import { getLocalizedListComparer } from "i18n/sorting" ;
1819import React , { useRef , useState } from "react" ;
1920import { ControllerRenderProps } from "react-hook-form" ;
2021import { theme } from "theme" ;
@@ -154,6 +155,7 @@ export default function ProfileTagInput({
154155 inputFieldProps,
155156} : ProfileTagInputProps ) {
156157 const { t, i18n } = useTranslation ( PROFILE ) ;
158+ const compareLocalizedLabels = getLocalizedListComparer ( i18n . language ) ;
157159
158160 // In case some value doesn't map to an option, add a fake option for it.
159161 // For example if value is [en, xx] and options is { en: "English", fr: "French" },
@@ -272,7 +274,7 @@ export default function ProfileTagInput({
272274 disablePortal
273275 options = { Object . entries ( effectiveOptions )
274276 . map ( ( [ key , label ] ) => ( { key, label } ) )
275- . sort ( ( a , b ) => a . label . localeCompare ( b . label , i18n . language ) ) }
277+ . sort ( ( a , b ) => compareLocalizedLabels ( a . label , b . label ) ) }
276278 renderOption = { ( props , option , { selected } ) => {
277279 const { key, ...rest } = props ;
278280
0 commit comments