diff --git a/client/src/components/AppIntlLoader.js b/client/src/components/AppIntlLoader.js index 7775d2ce7..03f4251c4 100644 --- a/client/src/components/AppIntlLoader.js +++ b/client/src/components/AppIntlLoader.js @@ -6,8 +6,8 @@ import rtlDetect from 'rtl-detect'; import DashboardLoadingIndicator from 'components/Dashboard/DashboardLoadingIndicator'; const SUPPORTED_LOCALES = [ - { name: "English", value: "en" }, - { name: 'العربية', value: 'ar' } + { name: 'English', value: 'en' }, + { name: 'العربية', value: 'ar-ly' }, ]; /** @@ -15,12 +15,12 @@ const SUPPORTED_LOCALES = [ */ function getCurrentLocal() { let currentLocale = intl.determineLocale({ - urlLocaleKey: "lang", - cookieLocaleKey: "lang", - localStorageLocaleKey: "lang", + urlLocaleKey: 'lang', + cookieLocaleKey: 'lang', + localStorageLocaleKey: 'lang', }); if (!find(SUPPORTED_LOCALES, { value: currentLocale })) { - currentLocale = "en"; + currentLocale = 'en'; } return currentLocale; } @@ -50,9 +50,7 @@ function useDocumentDirectionModifier(locale) { /** * Application Intl loader. */ -export default function AppIntlLoader({ - children -}) { +export default function AppIntlLoader({ children }) { const [isLoading, setIsLoading] = React.useState(true); const currentLocale = getCurrentLocal(); @@ -61,22 +59,24 @@ export default function AppIntlLoader({ React.useEffect(() => { // Lodas the locales data file. - loadLocales(currentLocale).then((results) => { - return intl.init({ - currentLocale, - locales: { - [currentLocale]: results, - }, + loadLocales(currentLocale) + .then((results) => { + return intl.init({ + currentLocale, + locales: { + [currentLocale]: results, + }, + }); + }) + .then(() => { + moment.locale(currentLocale); + setIsLoading(false); }); - }).then(() => { - moment.locale('ar-ly'); - setIsLoading(false); - }); }, [currentLocale, setIsLoading]); return ( {children} - ); -} \ No newline at end of file + ); +} diff --git a/client/src/components/ContactsMultiSelect.js b/client/src/components/ContactsMultiSelect.js index 7cbb1c332..9a480f66a 100644 --- a/client/src/components/ContactsMultiSelect.js +++ b/client/src/components/ContactsMultiSelect.js @@ -3,6 +3,7 @@ import { MenuItem, Button } from '@blueprintjs/core'; import { omit } from 'lodash'; import MultiSelect from 'components/MultiSelect'; import { FormattedMessage as T } from 'components'; +import intl from 'react-intl-universal'; export default function ContactsMultiSelect({ contacts, @@ -31,9 +32,10 @@ export default function ContactsMultiSelect({ [isContactSelect], ); - const countSelected = useMemo(() => Object.values(selectedContacts).length, [ - selectedContacts, - ]); + const countSelected = useMemo( + () => Object.values(selectedContacts).length, + [selectedContacts], + ); const onContactSelect = useCallback( ({ id }) => { @@ -50,12 +52,7 @@ export default function ContactsMultiSelect({ setSelectedContacts({ ...selected }); onContactSelected && onContactSelected(selected); }, - [ - setSelectedContacts, - selectedContacts, - isContactSelect, - onContactSelected, - ], + [setSelectedContacts, selectedContacts, isContactSelect, onContactSelected], ); return ( @@ -69,11 +66,9 @@ export default function ContactsMultiSelect({ >