Skip to content

Commit

Permalink
feat(mosip#656): [Pooja] fixed rendering demographic data in requeste…
Browse files Browse the repository at this point in the history
…d language(arabic)
  • Loading branch information
Pooja Babusing authored and Pooja Babusing committed Mar 23, 2023
1 parent 2725110 commit 85bb86f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions components/VcDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Theme } from './ui/styleUtils';
import { TextItem } from './ui/TextItem';
import { VcItemTags } from './VcItemTags';
import VerifiedIcon from './VerifiedIcon';
import i18n from '../i18n';

export const VcDetails: React.FC<VcDetailsProps> = (props) => {
const { t, i18n } = useTranslation('VcDetails');
Expand Down Expand Up @@ -352,6 +353,12 @@ function getLocalizedField(rawField: string | LocalizedField[]) {
}
try {
const locales: LocalizedField[] = JSON.parse(JSON.stringify(rawField));
const language = i18n.language;
if (locales.length > 1 && language === 'ar') {
return locales[1].language === 'ara'
? locales[1].value
: locales[0].value;
}
return locales[0].value;
} catch (e) {
return '';
Expand Down
7 changes: 7 additions & 0 deletions components/VcItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { useTranslation } from 'react-i18next';
import { LocalizedField } from '../types/vc';
import { VcItemTags } from './VcItemTags';
import VerifiedIcon from './VerifiedIcon';
import i18n from '../i18n';

const getDetails = (arg1, arg2, verifiableCredential) => {
if (arg1 === 'Status') {
Expand Down Expand Up @@ -311,6 +312,12 @@ function getLocalizedField(rawField: string | LocalizedField) {
}
try {
const locales: LocalizedField[] = JSON.parse(JSON.stringify(rawField));
const language = i18n.language;
if (locales.length > 1 && language === 'ar') {
return locales[1].language === 'ara'
? locales[1].value
: locales[0].value;
}
return locales[0].value;
} catch (e) {
return '';
Expand Down

0 comments on commit 85bb86f

Please sign in to comment.