
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@preply/ds-i18n
Advanced tools
@preply/ds-i18n
Contains the translations for the Design System.
Just get json from locales
folder and merge it with host translations.
import dsMessages from '@preply/ds-i18n/locales/en.json';
const translations = {
...hostMessages,
...dsMessages,
};
<IntlProvider locale="en" messages={translations}>
<App />
</IntlProvider>;
design-system
repo)For packages like @preply/ds-web-lib
, we need to setup one of these tools:
Example for vite
and babel-plugin-formatjs
:
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { getPrefixedId } from '@preply/ds-i18n';
export default defineConfig({
plugins: [
react({
babel: {
plugins: ['formatjs'],
},
}),
],
...
});
In general, just wrapping the app with IntlProvider
is enough.
<IntlProvider locale="en">
<App />
</IntlProvider>
Also, check storybook implementation for more complex example to display actual translations in different locales.
react-intl
in your codeimport { FormattedMessage } from 'react-intl';
const DEFAULT_REQUIRED_LABEL = (
<FormattedMessage
id="preply-ds.fieldLabel.required"
defaultMessage="Required"
description="Form field required label"
/>
);
Please prefix all your ids with preply-ds.
to avoid collisions with host translations.
New strings will be automatically extracted and pushed to the design-system.json
source file in preply-web-product Crowdin project.
See Localization at Preply for more details
Pull Translations workflow will pull the translations from the Crowdin daily at 6:00 AM UTC. If there are any new translations, a PR will be created automatically.
Note: In general, you're not supposed to run these scripts manually, they're run by the CI pipeline.
trans:extract
Extracts the translations from the source code into temporary tmp/design-system.json
file.
This file contains additional context for the translators.
Example of a tmp/design-system.json
file:
{
"preply-ds.fieldLabel.required": {
"defaultMessage": "Required",
"description": "Form field required label"
}
}
trans:push
Pushes the translations to the Crowdin.
trans:pull
Pulls the translations from the Crowdin into temporary tmp/crowdin
folder.
Example of fetched translations:
{
"preply-ds.fieldLabel.required": {
"defaultMessage": "Required",
"description": "Form field required label"
}
}
trans:compile
Compiles the translations into simple key-value pairs in the locales
folder.
Example of compiled translations:
{
"preply-ds.fieldLabel.required": "Required"
}
FAQs
Unknown package
The npm package @preply/ds-i18n receives a total of 1,831 weekly downloads. As such, @preply/ds-i18n popularity was classified as popular.
We found that @preply/ds-i18n demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.