UNPKG

i18n-transform-cli

Version:

这是一款能够自动将代码里的中文转成i18n国际化标记的命令行工具。当然,你也可以用它实现将中文语言包自动翻译成其他语言。适用于vue2、vue3和react

141 lines (137 loc) 6.12 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); //@ts-nocheck const react_1 = __importStar(require("react")); const react_router_dom_1 = require("react-router-dom"); const antd_1 = require("antd"); const ahooks_1 = require("ahooks"); const react_intl_universal_1 = __importDefault(require("react-intl-universal")); const icons_1 = require("@ant-design/icons"); const context_1 = require("@/context"); require("./index.less"); const { Option } = antd_1.Select; const MoreLink = () => (<antd_1.Menu> <antd_1.Menu.Item key="1"> <a href="https://salon.netease.com/" target="_blank" rel="noreferrer"> {react_intl_universal_1.default.get('index-h8iwq2x5p9').d('Learning GO 学习系统')} </a> </antd_1.Menu.Item> {/*<Menu.Item key="2">*/} {/* <a href="https://kms.netease.com/" target="_blank" rel="noreferrer">*/} {/* 网易KM系统*/} {/* </a>*/} {/*</Menu.Item>*/} <antd_1.Menu.Item key="3"> <a href="http://zhitu.netease.com/#/template?projectId=508065473142087680" target="_blank" rel="noreferrer"> {react_intl_universal_1.default.get('index-rdomdvhdeto').d('自助制图系统')} </a> </antd_1.Menu.Item> <antd_1.Menu.Item key="4"> <a href="https://subtitles.ai.163.com/" target="_blank" rel="noreferrer"> {react_intl_universal_1.default.get('index-u0cf98ewigq').d('易智字幕工具')} </a> </antd_1.Menu.Item> <antd_1.Menu.Item key="5"> <a href="https://easymeeting.ai.163.com/" target="_blank" rel="noreferrer"> {react_intl_universal_1.default.get('index-0svq13y5c259').d('易智语音转写')} </a> </antd_1.Menu.Item> </antd_1.Menu>); // 前后台使用的是同一个域名,后台项目资源用/mng前缀做nginx转发 const Notebook = () => (<antd_1.Menu> <antd_1.Menu.Item key="1"> <a href="https://nos.netease.com/rms/7ded09c6943f6659d94a48ffeeb02f19?contentType=application/pdf" target="_blank" rel="noreferrer"> {react_intl_universal_1.default.get('index-ozepkf6p1lr').d('管理员操作手册')} </a> </antd_1.Menu.Item> {/*<Menu.Item key="2">*/} {/* <a href="https://nos.netease.com/rms/40cdcae9403c098ea9472e35aca21b98?contentType=application/pdf" target="_blank" rel="noreferrer">*/} {/* 讲师操作手册*/} {/* </a>*/} {/*</Menu.Item>*/} {/*<Menu.Item key="3">*/} {/* <a href="https://nos.netease.com/rms/bb175c49cdd7dd0031086726b4929a3f?contentType=application/pdf" target="_blank" rel="noreferrer">*/} {/* 直播操作手册*/} {/* </a>*/} {/*</Menu.Item>*/} </antd_1.Menu>); function Header(props) { const { onChangeLocale } = props; const [locale, setLocale] = (0, ahooks_1.useLocalStorageState)('language', { defaultValue: 'zh', serializer: (v) => v !== null && v !== void 0 ? v : '', deserializer: (v) => v, }); const onChange = (value) => { onChangeLocale(value); setLocale(value); }; const { authInfo } = (0, react_1.useContext)(context_1.LoginContext); // 退出登录 const logout = () => { location.href = `/api/auth/login/openId/logout?returnUrl=${location.origin}/mng`; }; return (<div className="m-header"> <div className="content"> <div className="logo"> <i className="iconfont icon-yi"/> <span>· Learning GO</span> <span className="name">{react_intl_universal_1.default.get('appName')}</span> </div> <div className="right"> <antd_1.Dropdown overlay={Notebook} placement="bottomCenter"> <div className="f-cp"> <icons_1.BookOutlined />{' '} <span>{react_intl_universal_1.default.get('index-bd47lh966bc').d('指导手册')}</span> </div> </antd_1.Dropdown> {/* <Dropdown overlay={MoreLink} placement="bottomCenter">*/} {/* <div className="right-item more-link">*/} {/* <UnorderedListOutlined /> <span>相关链接</span>*/} {/* </div>*/} {/* </Dropdown>*/} {/*<Select bordered={false} onChange={onChange} value={locale}>*/} {/* <Option value="zh">中文</Option>*/} {/* <Option value="en">English</Option>*/} {/*</Select>*/} <antd_1.Dropdown overlay={<antd_1.Menu> <antd_1.Menu.Item onClick={logout}> <span> {/*<LogoutOutlined style={{ fontSize: '16px' }} /> 退出*/} </span> </antd_1.Menu.Item> </antd_1.Menu>} placement="bottomRight"> <div className="name"> <span>Hi,{authInfo.name}</span> <icons_1.CaretDownOutlined /> </div> </antd_1.Dropdown> </div> </div> </div>); } exports.default = (0, react_router_dom_1.withRouter)(Header);