
Product
Introducing Socket Scanning for OpenVSX Extensions
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.
@ndla/i18n
Advanced tools
NDLA's own i18n package based on react-intl
# Using npm:
$ npm install ndla-i18n --save
# Using yarn:
$ yarn add ndla-i18n
// In app/server entry index file:
import IntlProvider from '@ndla/i18n';
...
ReactDOM.render(
...
<IntlProvider locale="NB" messages={messages}>
...
</IntlProvider>
...
document.getElementById('root'),
);
// After initial instantiation, using it with a React component
...
import { injectT } from '@ndla/i18n';
class i18nReactComponent extends Component {
...
render() {
const { t } = this.props;
return <button>{t('translationItem.buttonText')}</button>;
}
}
...
export default injectT(i18nReactComponent);
// After initial instantiation, using it with a React Functional Component and typescript
// It is important not to define t in the Props interface as then typescript will require to pass
// the t in the props, but rather import the type from @ndla/i18n package as shown in the example below.
...
import { injectT, tType } from '@ndla/i18n';
interface Props {
prop1: number;
prop2: string;
}
const i18nReactComponent: FC<Props & tType> = ({ t, prop1, prop2 }) => {
...
render() {
return <button>{t('translationItem.buttonText')}</button>;
}
}
...
export default injectT(i18nReactComponent);
// Using it with a render props component
...
import { Trans } from '@ndla/i18n';
class i18nReactComponent extends Component {
...
render() {
return(
<Trans>
{({ t }) => (<button>{t('translationItem.buttonText')}</button>)}
</Trans>
)
}
}
...
export default i18nReactComponent;
FAQs
NDLA's own i18n package based on react-intl
We found that @ndla/i18n demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.

Product
Bringing supply chain security to the next generation of JavaScript package managers

Product
A safer, faster way to eliminate vulnerabilities without updating dependencies