
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
react-lingo
Advanced tools
Component-friendly i18n. Optimized for developer workflow (adding/removing translation keys).
Translation file MyComponent.i18n.json
:
{
"HELLO_WORLD": {
"en-US": "Hello world!",
"fr-FR": "Bonjour le monde!"
},
"PLEASE_ENTER_PASSWORD": {
"en-US": "Please enter your password",
"fr-FR": "En fait, je ne parle pas Français"
}
}
Component file MyComponent.jsx
:
import XL from './MyComponent.i18n.json';
class MyComponent extends React.PureComponent {
render() {
return <XL>{(xl) =>
<div className="my-component">
<h1>{xl.HELLO_WORLD}</h1>
<span>{xl.PLEASE_ENTER_PASSWORD}</span>
</div>
}</XL>
}
}
Wrap everything in Lingo context (usually in app root component):
...
<LingoContext locale={userLocale || 'en-US'}>
... rendered app components with XL tags go here ...
</LingoContext>
...
Rendered output:
<div class="my-component">
<h1>Hello world!</h1>
<span>Please enter your password</span>
</div>
Assuming you are mainly developing in English and want to export a CSV file for French translation work, start off by writing your code with just the English keys in .i18n.json
files.
{
"HELLO_WORLD": {
"en-US": "Hello world!"
},
...etc
}
Then, run the following in your project directory:
node_modules/.bin/lingo-export --base=en-US --locale=fr-FR > i18n-latest.csv
This scans for all .i18n.json
files in your current folder and creates a single combined CSV file that looks like this:
src/components/MyComponent.i18n.json,HELLO_WORLD,Hello world!,
src/components/MyComponent.i18n.json,PLEASE_ENTER_PASSWORD,Please enter your password,
src/components/SomeOtherComponent.i18n.json,WHAT_IS_YOUR_FAVORITE_COLOR,What is your favorite color?,
...etc
Columns are:
en-US
in this case)fr-FR
in this case)Initially, the fourth column (target locale text) will be empty. This is what the translator should be filling in.
Then, when translation work is done, place the file in the same spot where it was generated. It should now look something like this, with the fourth column filled in and the others unchanged:
src/components/MyComponent.i18n.json,HELLO_WORLD,Hello world!,Bonjour le monde!
src/components/MyComponent.i18n.json,PLEASE_ENTER_PASSWORD,Please enter your password,"En fait, je ne parle pas Français"
src/components/SomeOtherComponent.i18n.json,WHAT_IS_YOUR_FAVORITE_COLOR,What is your favorite color?,La traduction française
...etc
Ensure that Git working directory is clean and everything is safely committed (important!) and run the import script that integrates changes back into .i18n.json
files:
node_modules/.bin/lingo-import --base=en-US --locale=fr-FR > i18n-latest.csv
Warning: This modifies the existing JSON files in place, please be careful with any prior uncommitted changes that might get mixed in. Automated import process might change your translation files in unexpected ways, so make sure everything is committed prior to running it!
Then review the JSON file changes and commit/push them as usual. For further translation passes, simply re-run the export process, fill in any new blanks as needed, then re-import.
Developers must be careful when changing the base locale wording for already-translated text: make sure that the other language values are cleared out for that key. This makes it easier to see what needs to be re-translated again. Even better approach is to create a new translation key and delete the old one, since even small changes in wording make for a different meaning.
FAQs
Lingo i18n for React
The npm package react-lingo receives a total of 365 weekly downloads. As such, react-lingo popularity was classified as not popular.
We found that react-lingo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.