
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
@easy-lang/react
Advanced tools
React 项目的多语言翻译工具,基于 easy-lang,支持响应式国际化体验。
pnpm add @easy-lang/react
# 或
npm install @easy-lang/react
# 或
yarn add @easy-lang/react
需额外安装
react
、zustand
、easy-lang
作为 peerDependency。
// translation.json
{
"错误": {
"zh_CN": "错误",
"zh_HK": "錯誤",
"en": "Error"
},
"保存": {
"zh_CN": "保存",
"zh_HK": "保存",
"en": "Save"
}
}
import translations from "./translation.json";
import { createI18nTool } from "easy-lang";
import { createReactI18nTool } from "@easy-lang/react";
const reactI18nTool = createReactI18nTool<
typeof translations,
"zh_CN" | "zh_HK" | "en"
>(
createI18nTool({
defaultLang: "zh_CN",
langs: ["zh_CN", "zh_HK", "en"],
translations,
})
);
export const useTranslate = reactI18nTool.useTranslate();
function App() {
const { $t, changeLang, currentLang } = useTranslate();
return (
<div>
<button onClick={() => changeLang("en")}>en</button>
<button onClick={() => changeLang("zh_CN")}>中文</button>
<div>当前语言: {currentLang}</div>
<div>{$t("错误")}</div>
</div>
);
}
注意:changeLang 调用后会执行 location.reload() 刷新页面。 如果你的项目只用到了 useTranslate 进行翻译,请设置 autoReload: false,可实现响应式更新。
支持在翻译文本中使用 {变量名}
,如:
{
"欢迎": {
"en": "Welcome, {name}!"
}
}
调用:
useTranslate().$t("欢迎", { name: "Tom" }); // => "Welcome, Tom!"
未翻译的 key 会自动收集到 untranslatedList
,便于后续补全。
本项目使用 vitest 进行单元测试。
pnpm test
pnpm build
MIT
FAQs
React bindings for easy-lang
The npm package @easy-lang/react receives a total of 22 weekly downloads. As such, @easy-lang/react popularity was classified as not popular.
We found that @easy-lang/react demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.