Middle+
Have you used localization (i18n)? How many languages are supported?
sobes.tech AI
Answer from AI
Yes, I have used localization (i18n) in several projects. Usually, 2 to 5 languages are supported, including Russian and English, with German and French sometimes added. To implement this, I used libraries such as i18next or react-intl, which allow dynamically changing the interface language and loading the corresponding translations.
Example of using i18next in React:
import { useTranslation } from 'react-i18next';
function MyComponent() {
const { t, i18n } = useTranslation();
const changeLanguage = (lng) => {
i18n.changeLanguage(lng);
};
return (
<div>
<h1>{t('welcome_message')}</h1>
<button onClick={() => changeLanguage('en')}>English</button>
<button onClick={() => changeLanguage('ru')}>Russian</button>
</div>
);
}