
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@ui18n/selector-web
Advanced tools
Web原生语言选择器组件,支持现代浏览器的自定义元素标准。
This package is currently in experimental stage. API may change in future releases.
For production use, we recommend:
@ui18n/core with CDN for pure JavaScript projectsWhy experimental? We are focusing on Phase 1 (pure JavaScript + CDN) following the Lean Beachhead Strategy. Framework packages will be stabilized in Phase 2 after core functionality is validated.
npm install @ui18n/selector-web
<!-- 引入组件 -->
<script type="module" src="@ui18n/selector-web"></script>
<!-- 使用组件 -->
<ui18n-language-selector
languages="zh-CN,en,ja,ko"
current="zh-CN"
show-flags="true">
</ui18n-language-selector>
import '@ui18n/selector-web';
// 动态创建选择器
const selector = document.createElement('ui18n-language-selector');
selector.setAttribute('languages', 'zh-CN,en,ja');
selector.setAttribute('current', 'zh-CN');
selector.setAttribute('show-flags', 'true');
document.body.appendChild(selector);
// 监听语言变化
selector.addEventListener('language-change', (event) => {
console.log('语言已切换到:', event.detail.language);
});
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
languages | string | '' | 支持的语言列表,逗号分隔 |
current | string | '' | 当前选中的语言 |
show-flags | boolean | false | 是否显示国旗图标 |
show-labels | boolean | true | 是否显示语言标签 |
theme | string | 'light' | 主题样式 (light/dark) |
language-change - 语言切换时触发selector-ready - 组件初始化完成时触发setLanguage(language) - 程序化设置语言getAvailableLanguages() - 获取可用语言列表refresh() - 刷新组件状态ui18n-language-selector {
--ui18n-selector-bg: #ffffff;
--ui18n-selector-color: #333333;
--ui18n-selector-border: #ddd;
--ui18n-selector-hover: #f5f5f5;
}
/* 暗色主题 */
ui18n-language-selector[theme="dark"] {
--ui18n-selector-bg: #2d2d2d;
--ui18n-selector-color: #ffffff;
--ui18n-selector-border: #555;
--ui18n-selector-hover: #3d3d3d;
}
MIT License
欢迎提交 Pull Request 和 Issue!
FAQs
🌐 零依赖Web Components语言选择器 - 支持所有框架和浏览器的通用组件
We found that @ui18n/selector-web 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.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.