Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replaced source of country codes #2956

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/kyb-app/src/helpers/countries-data.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { countryCodes } from '@ballerine/common';
import { State } from 'country-state-city';
import isoCountries from 'i18n-iso-countries';
import enCountries from 'i18n-iso-countries/langs/en.json';
import cnCountries from 'i18n-iso-countries/langs/zh.json';
import nationalities from 'i18n-nationality';
import enNationalities from 'i18n-nationality/langs/en.json';
import { State } from 'country-state-city';
import { TFunction } from 'i18next';

isoCountries.registerLocale(enCountries);
Expand All @@ -21,11 +22,10 @@ const unsupportedNationalities = {

export const getCountries = (lang = 'en') => {
const language = languageConversionMap[lang as keyof typeof languageConversionMap] ?? lang;
const countries = isoCountries.getNames(language, { select: 'official' });

return Object.entries(countries).map(([isoCode, title]) => ({
return countryCodes.map(isoCode => ({
chesterkmr marked this conversation as resolved.
Show resolved Hide resolved
const: isoCode,
title,
title: isoCountries.getName(isoCode?.toLocaleUpperCase(), language),
}));
};

Expand Down
Loading