提交 98cb7585 编写于 作者: X xjh22222228

refactor: locale

上级 7cef8123
......@@ -4,10 +4,13 @@
<img src="src/assets/logo.png" width="130" />
</a>
<br />
<b>发现导航</b>
<p align="center">一个纯静态、支持SEO、在线编辑的强大导航网站,希望您会喜欢</p>
<p align="center">内置收录多达 800+ 优质网站, 助您工作、学习和生活</p>
<b>Discovery Navigation</b>
<p align="center">A purely static, powerful navigation website that supports SEO and online editing, I hope you will like it</p>
<p align="center">Built-in collection of up to 800+ high-quality websites to help you work, study and live</p>
<p align="center">
<a href="README_zh-CN.md">
<img src="https://img.shields.io/badge/lang-%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87-red.svg?longCache=true&style=flat-square">
</a>
<img src="https://img.shields.io/github/v/release/xjh22222228/nav" />
<a href="https://github.com/xjh22222228/nav/stargazers"><img src="https://img.shields.io/github/stars/xjh22222228/nav" alt="Stars"/></a>
<img alt="Angular" src="https://img.shields.io/static/v1.svg?label=&message=Angular11&style=flat-square&color=C82B38">
......@@ -22,13 +25,13 @@
<br />
## 预览
**主题**
## Preview
**Themes**
- [Sim 在线预览](https://nav3.cn/#/sim)
- [Light 在线预览](https://nav3.cn/#/light)
- [Side 在线预览](https://nav3.cn/#/side)
- [App 在线预览](https://nav3.cn/#/app)
- [Sim online preview](https://nav3.cn/#/sim)
- [Light online preview](https://nav3.cn/#/light)
- [Side online preview](https://nav3.cn/#/side)
- [App online preview](https://nav3.cn/#/app)
![Preview](https://raw.githubusercontent.com/xjh22222228/public/gh-pages/nav/1.png)
![Preview](https://raw.githubusercontent.com/xjh22222228/public/gh-pages/nav/2.png)
......@@ -41,56 +44,50 @@
## 特性
`发现导航` 的理念就是做一款无需依赖后端服务既简单又方便,没有繁杂的配置和数据库等配置概念, 做到开箱即用。
- 🍰 内置 `800+` 实用网站。
- 🍰 支持 SEO。
- 🍰 完全纯静态, 提供自动化部署功能。
- 🍰 三叉树分类、结构清晰、分类清晰。
- 🍰 支持一个网站关联多个网址
- 🍰 颜值与简约并存,不再是杀马特时代。
- 🍰 完全开源,轻松定制化。
- 🍰 支持多种浏览模式,创新。
- 🍰 支持足迹记忆。
- 🍰 支持移动端浏览。
- 🍰 支持搜索查询。
- 🍰 支持自定义引擎搜索。
- 🍰 多款主题切换。
- 🍰 支持暗黑模式。
- 🍰 支持后台管理, 无需部署。
- 🍰 支持从Chrome书签导入
- 🍰 多种Loading加载动画
## Features
`Discovery Navigation The idea is to make it simple and convenient without relying on back-end services, without complicated configuration and database configuration concepts, so it can be used out of the box.
## 部署
像数 `321` 一样简单。
- 🍰 Built-in 800+utility sites.
- 🍰 Support SEO.
- 🍰 It is completely static and provides automatic deployment functions.
- 🍰 The trigeminal tree has a clear structure and clear classification.
- 🍰 Support one website to associate multiple URLs
- 🍰 The coexistence of beauty and simplicity is no longer the era of killing Matt.
- 🍰 Completely open source, easy to customize.
- 🍰 Support multiple browsing modes and innovation.
- 🍰 Support footprint memory.
- 🍰 Support mobile browsing.
- 🍰 Support search query.
- 🍰 Support custom engine search.
- 🍰 A variety of theme switching.
- 🍰 Support dark mode.
- 🍰 Support background management, no need to deploy.
- 🍰 Support import from Chrome bookmarks
#### 方式一(gh-pages免费)
1、Fork 当前项目。
2、[https://github.com/settings/tokens](https://github.com/settings/tokens) 申请 token, 勾选相应的权限, 如果不懂就全部选中,复制并保存Token。
## Deploy
Its as easy as counting numbers "3 2 1" that simple!
3、https://github.com/用户名/nav/settings/secrets/actions/new 添加申请的token, name填写 `TOKEN` 大写。
#### Method one (github-pages free)
1、Fork the current project.
4、打开 https://github.com/用户名/nav/actions 点击 `绿色按钮`
2、[https://github.com/settings/tokens](https://github.com/settings/tokens) apply for a token, check the corresponding permissions, if you don’t understand, select all, copy and save the token.
5、务必修改项目配置文件 [nav.config.ts](nav.config.ts)
3、https://github.com/askfriends/nav/settings/secrets/actions/new Create a new application token, name fill in TOKEN (All are uppercase).
6、5分钟后打开 https://用户名.github.io/nav 就能看到一个非常强大的导航网站了。
4、Go to https://github.com/askfriends/nav/actions click "Green Button"
### 推荐方式二(Vercel免费)
和方式一的步骤一样,除了第4步不用。
5、Be sure to modify the project configuration file [nav.config.ts](nav.config.ts)
具体使用跟着步骤走即可 [https://github.com/apps/vercel](https://github.com/apps/vercel)
6、After 5 minutes, open https://askfriends.github.io/nav , you will see a very powerful navigation website.
### Method 2 (Free Vercel)
The steps are the same as the first method, except that the fourth step is not needed.
For specific use, follow the steps [https://github.com/apps/vercel](https://github.com/apps/vercel)
注:如果想部署到自己的域名,那么以上教程同样适合,因为它提供了自动化部署, 之后可以通过 `CNAME``反向代理` 实现:
Note: If you want to deploy your own domain name, then the above tutorial is also suitable, as it provides automated deployment, and then through CNAME or Revers Proxy implementation:
```conf
# nginx
......@@ -105,16 +102,17 @@ server {
```
## 书签导入
支持从 Chrome 书签导入(WebKit内核应该都是支持的~),会自动检测满足三级分类的导航,其他一律设为未分类:
## Bookmark import
Support importing from Chrome bookmarks (WebKit kernel should be supported~), it will automatically detect navigation that meets the three-level classification, and all others will be set as unclassified:
![](https://raw.githubusercontent.com/xjh22222228/public/gh-pages/nav/import.png)
浏览器打开 [chrome://bookmarks/](chrome://bookmarks/) 导出书签得到 html 文件, 接着从导航网站后台导入即可。
The browser opens chrome://bookmarks/ to export the bookmarks to get the html file, and then import it from the background of the navigation website.
## 选择适合您的Loading
[配置文件](nav.config.ts)修改 `loading` 字段。
## Choose the Loading that suits you
Modify the `loading` field in [Configuration File](nav.config.ts).
<img src="media/loading1.png" width="400px" />
<img src="media/loading2.png" width="400px" />
......@@ -124,14 +122,12 @@ server {
## 升级
在升级之前请备份根目录下的 `data` 文件夹和 `nav.config.ts`, 升级完后替换即可。
点击右上角 `Watch` 按钮第一时间跟踪版本升级。
##upgrade
Before upgrading, please back up the `data` folder and `nav.config.ts` in the root directory, and replace them after the upgrade.
Click the `Watch` button in the upper right corner to track the version upgrade for the first time.
## 更新日志
## Update log
[CHANGELOG](https://github.com/xjh22222228/nav/releases)
......@@ -139,27 +135,27 @@ server {
## 开发构建
## Development and construction
``` bash
# 下载
# Download
git clone --depth=1 https://github.com/xjh22222228/nav.git
cd nav
# 安装依赖
# Installation dependencies
yarn
# 启动
# Start
yarn start
# 打包
# Build
yarn build
```
## 贡献
[点击这里](https://github.com/xjh22222228/nav/tree/master/data)
## contribute
[Click Here](https://github.com/xjh22222228/nav/tree/master/data)
Thank you for your [contribution](https://github.com/xjh22222228/nav/issues), men.
......@@ -181,23 +177,5 @@ Thank you for your [contribution](https://github.com/xjh22222228/nav/issues), me
## 建议
如果有任何功能上的建议可通过 [issue](https://github.com/xjh22222228/nav/issues) 发起, Thank you.
## 支持
项目成立于 2018 年到至今一直坚持维护和开源, 经过N次的迭代与优化, 如果项目能帮到您是我的荣幸。
您可以请作者喝杯咖啡,继续战斗下去(请备注Github名字)~
<img src="https://cdn.jsdelivr.net/gh/xjh22222228/public@gh-pages/img/32.png" width="600">
感谢您的认可:
| 姓名 | 支持金额 |
| --------------------------------------- |----------- |
| [aiyou9](https://github.com/aiyou9) | ¥50.00 |
| [lastares](https://github.com/lastares) | ¥25.00 |
| [MrJxySteven](https://github.com/MrJxySteven) | ¥20.00 |
| 路人甲 | ¥50.00 |
## Suggest
If you have any functional suggestions, you can initiate an [issue](https://github.com/xjh22222228/nav/issues), Thank you.
<p align="center">
<a href="https://nav3.cn/?g">
<img src="src/assets/logo.png" width="130" />
</a>
<br />
<b>发现导航</b>
<p align="center">一个纯静态、支持SEO、在线编辑的强大导航网站,希望您会喜欢</p>
<p align="center">内置收录多达 800+ 优质网站, 助您工作、学习和生活</p>
<p align="center">
<a href="README.md">
<img src="https://img.shields.io/badge/lang-%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87-red.svg?longCache=true&style=flat-square">
</a>
<img src="https://img.shields.io/github/v/release/xjh22222228/nav" />
<a href="https://github.com/xjh22222228/nav/stargazers"><img src="https://img.shields.io/github/stars/xjh22222228/nav" alt="Stars"/></a>
<img alt="Angular" src="https://img.shields.io/static/v1.svg?label=&message=Angular11&style=flat-square&color=C82B38">
<img src="https://img.shields.io/github/license/xjh22222228/nav" />
<a href="https://hits.dwyl.com/xjh22222228/nav">
<img src="https://hits.dwyl.com/xjh22222228/nav.svg" />
</a>
</p>
</p>
<br />
<br />
## 预览
**主题**
- [Sim 在线预览](https://nav3.cn/#/sim)
- [Light 在线预览](https://nav3.cn/#/light)
- [Side 在线预览](https://nav3.cn/#/side)
- [App 在线预览](https://nav3.cn/#/app)
![Preview](https://raw.githubusercontent.com/xjh22222228/public/gh-pages/nav/1.png)
![Preview](https://raw.githubusercontent.com/xjh22222228/public/gh-pages/nav/2.png)
![Preview](https://raw.githubusercontent.com/xjh22222228/public/gh-pages/nav/3.png)
![Preview](https://raw.githubusercontent.com/xjh22222228/public/gh-pages/nav/4.png)
![Preview](https://raw.githubusercontent.com/xjh22222228/public/gh-pages/nav/5.png)
## 特性
`发现导航` 的理念就是做一款无需依赖后端服务既简单又方便,没有繁杂的配置和数据库等配置概念, 做到开箱即用。
- 🍰 内置 `800+` 实用网站。
- 🍰 支持 SEO。
- 🍰 完全纯静态, 提供自动化部署功能。
- 🍰 三叉树分类、结构清晰、分类清晰。
- 🍰 支持一个网站关联多个网址
- 🍰 颜值与简约并存,不再是杀马特时代。
- 🍰 完全开源,轻松定制化。
- 🍰 支持多种浏览模式,创新。
- 🍰 支持足迹记忆。
- 🍰 支持移动端浏览。
- 🍰 支持搜索查询。
- 🍰 支持自定义引擎搜索。
- 🍰 多款主题切换。
- 🍰 支持暗黑模式。
- 🍰 支持后台管理, 无需部署。
- 🍰 支持从Chrome书签导入
- 🍰 多种Loading加载动画
## 部署
像数 `321` 一样简单。
#### 方式一(gh-pages免费)
1、Fork 当前项目。
2、[https://github.com/settings/tokens](https://github.com/settings/tokens) 申请 token, 勾选相应的权限, 如果不懂就全部选中,复制并保存Token。
3、https://github.com/用户名/nav/settings/secrets/actions/new 添加申请的token, name填写 `TOKEN` 大写。
4、打开 https://github.com/用户名/nav/actions 点击 `绿色按钮`
5、务必修改项目配置文件 [nav.config.ts](nav.config.ts)
6、5分钟后打开 https://用户名.github.io/nav 就能看到一个非常强大的导航网站了。
### 推荐方式二(Vercel免费)
和方式一的步骤一样,除了第4步不用。
具体使用跟着步骤走即可 [https://github.com/apps/vercel](https://github.com/apps/vercel)
注:如果想部署到自己的域名,那么以上教程同样适合,因为它提供了自动化部署, 之后可以通过 `CNAME``反向代理` 实现:
```conf
# nginx
server {
listen 80;
server_name www.nav3.cn nav3.cn;
location / {
proxy_pass https://xjh22222228.github.io/nav/;
}
}
```
## 书签导入
支持从 Chrome 书签导入(WebKit内核应该都是支持的~),会自动检测满足三级分类的导航,其他一律设为未分类:
![](https://raw.githubusercontent.com/xjh22222228/public/gh-pages/nav/import.png)
浏览器打开 [chrome://bookmarks/](chrome://bookmarks/) 导出书签得到 html 文件, 接着从导航网站后台导入即可。
## 选择适合您的Loading
[配置文件](nav.config.ts)修改 `loading` 字段。
<img src="media/loading1.png" width="400px" />
<img src="media/loading2.png" width="400px" />
<img src="media/loading3.png" width="400px" />
## 升级
在升级之前请备份根目录下的 `data` 文件夹和 `nav.config.ts`, 升级完后替换即可。
点击右上角 `Watch` 按钮第一时间跟踪版本升级。
## 更新日志
[CHANGELOG](https://github.com/xjh22222228/nav/releases)
## 开发构建
``` bash
# 下载
git clone --depth=1 https://github.com/xjh22222228/nav.git
cd nav
# 安装依赖
yarn
# 启动
yarn start
# 打包
yarn build
```
## 贡献
[点击这里](https://github.com/xjh22222228/nav/tree/master/data)
Thank you for your [contribution](https://github.com/xjh22222228/nav/issues), men.
<a href="https://github.com/YutHelloWorld">
<img src="https://avatars1.githubusercontent.com/u/20860159?s=460&v=4" width="30px" height="30px" />
</a>
<a href="https://github.com/JJJTHuang">
<img src="https://avatars3.githubusercontent.com/u/22817432?s=460&v=4" width="30px" height="30px" />
</a>
<a href="https://github.com/Fechin">
<img src="https://avatars1.githubusercontent.com/u/2541482?s=460&v=4" width="30px" height="30px" />
</a>
<a href="https://github.com/setdiaoyong">
<img src="https://avatars1.githubusercontent.com/u/62551864?s=460&v=4" width="30px" height="30px" />
</a>
## 建议
如果有任何功能上的建议可通过 [issue](https://github.com/xjh22222228/nav/issues) 发起, Thank you.
## 支持
项目成立于 2018 年到至今一直坚持维护和开源, 经过N次的迭代与优化, 如果项目能帮到您是我的荣幸。
您可以请作者喝杯咖啡,继续战斗下去(请备注Github名字)~
<img src="https://cdn.jsdelivr.net/gh/xjh22222228/public@gh-pages/img/32.png" width="600">
感谢您的认可:
| 姓名 | 支持金额 |
| --------------------------------------- |----------- |
| [aiyou9](https://github.com/aiyou9) | ¥50.00 |
| [lastares](https://github.com/lastares) | ¥25.00 |
| [MrJxySteven](https://github.com/MrJxySteven) | ¥20.00 |
| 路人甲 | ¥50.00 |
import { IConfig } from './src/types'
const c: IConfig = {
// Deployment language - 部署语言
// zh-CN | en
language: 'en',
// [Mondatory], Please replace following Github url with your own Github address which you forked in.
// [必填], 请填写您的仓库地址
gitRepoUrl: 'https://github.com/xjh22222228/nav',
// Deployment branch name
// 部署分支
branch: 'main',
// Page Loading: loading1 | loading2 | loading3 | random
// If you have a good-looking Loading, please contact us!
// 页面Loading: loading1 | loading2 | loading3 | random
// 如果您有好看的加载Loading请联系我们!
loading: 'random', // 随机加载
// Whether the route is in Hash mode, if it is deployed on github pages, it must be set to true
// 路由是否Hash模式, 如果是部署在github pages 务必设为 true
hashMode: true,
// Whether to show the Github icon in the upper right corner
// 是否显示右上角的 Github 图标
showGithub: true,
// Your website address is good for SEO
// 您的网站地址,有利于SEO
homeUrl: 'https://nav3.cn',
// Site title
// 网站标题
title: '发现导航 - 精选实用导航网站',
// Site description
// 网站描述
description: '发现导航 - 精选实用导航网站',
// Site keywords
// 网站关键字
keywords: '导航,前端资源,社区站点,设计师,实用工具,学习资源,运营,网络安全,node.js',
// Default theme: Light | Sim | Side | App | Shortcut
// 默认主题: Light | Sim | Side | App | Shortcut
theme: 'Light',
// The content at the bottom of the website, copyright information, record number, can be HTML
// 网站底部内容, 版权信息、备案号, 可以是 HTML
footerContent: `
<div style="font-weight: bold;">共收录\${total}个网站</div>
<div>Copyright © 2018-2021 nav3.cn, All Rights Reserved</div>
`,
// Alibaba Vector Gallery https://www.iconfont.cn/
// Used in side theme level 1 and level 2 menu icon display
// 阿里巴巴矢量图库 https://www.iconfont.cn/
// 用在 Side 主题一级、二级菜单图标展示
iconfontUrl: '//at.alicdn.com/t/font_2522843_wl70o31sy6.js',
// Baidu Statistics Address
// 百度统计地址
// https://tongji.baidu.com/web/welcome/login
baiduStatisticsUrl: 'https://hm.baidu.com/hm.js?4582be7af7e7c95ef75351e07c6c32ba',
// CNZZ Statistics address
// CNZZ 统计地址
// https://www.cnzz.com/o_index.php
cnzzStatisticsUrl: '',
// Sim Theme configuration
// Sim 主题配置
simThemeConfig: {
// 海报图
// Poster illustration - 海报图
posterImageUrls: [
'https://raw.sevencdn.com/xjh22222228/nav/image/sim-wallpaper.jpg'
],
......
......@@ -12,7 +12,7 @@ module.exports = {
</style>
<div style="position: fixed;top: 0;left: 0;right: 0;bottom: 0;text-align: center;display: flex;justify-content: center;align-items: center;font-size: 14px; flex-direction: column;background: linear-gradient(45deg,#222428,#444856);">
<svg class="gear" style="width:64px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path id="p" fill="#fdb" d="M94.1 58.8c.6-2.8.9-5.8.9-8.8s-.3-6-.9-8.8l-11.7-.4c-.7-2.6-1.7-5-3-7.3l8-8.5c-3.3-4.9-7.5-9.2-12.5-12.5l-8.5 8c-2.3-1.3-4.7-2.3-7.3-3l-.3-11.6C56 5.3 53 5 50 5s-6 .3-8.8.9l-.4 11.7c-2.6.7-5 1.7-7.3 3l-8.5-8c-4.9 3.3-9.2 7.5-12.5 12.5l8 8.5c-1.3 2.3-2.3 4.7-3 7.3l-11.6.3C5.3 44 5 47 5 50s.3 6 .9 8.8l11.7.4c.7 2.6 1.7 5 3 7.3l-8 8.5c3.3 4.9 7.5 9.2 12.5 12.5l8.5-8c2.3 1.3 4.7 2.3 7.3 3l.4 11.7c2.7.5 5.7.8 8.7.8s6-.3 8.8-.9l.4-11.7c2.6-.7 5-1.7 7.3-3l8.5 8c4.9-3.3 9.2-7.5 12.5-12.5l-8-8.5c1.3-2.3 2.3-4.7 3-7.3l11.6-.3zM50 66.9c-9.3 0-16.9-7.6-16.9-16.9S40.7 33.1 50 33.1 66.9 40.7 66.9 50 59.3 66.9 50 66.9z"></path></svg>
<div style="color:#6c757d;font-size: 18px;">努力加载中...</div>
<div style="color:#6c757d;font-size: 18px;">Loading...</div>
</div>
`.trim(),
......
......@@ -61,7 +61,9 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { LogoComponent } from '../components/logo/logo.component';
import { CardComponent } from '../components/card/index.component'
registerLocaleData(zh);
if (config.language === 'zh-CN') {
registerLocaleData(zh);
}
const appRoutes: Routes = [
{
......
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1633520345434" class="icon" viewBox="0 0 1546 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6428" xmlns:xlink="http://www.w3.org/1999/xlink" width="193.25" height="128"><defs><style type="text/css"></style></defs><path d="M11.322 1017.71h1520.904V6.29H11.322v1011.42zM1536 1021.484v-3.774 3.774zM5.032 1024V0h1533.484v1024H5.032z" fill="#353636" p-id="6429"></path><path d="M8.806 2.516H1536v1017.71H8.806z" fill="#D64B24" p-id="6430"></path><path d="M264.177 118.25l32.708 99.381h104.412l-84.285 60.384 31.45 99.38-84.285-61.64-84.285 61.64 32.708-99.38-84.286-60.384h104.413z m271.725-52.835l-1.258 35.224 31.45 12.58-33.966 8.806-1.258 33.965L512 127.057l-32.708 7.547 21.386-26.417-17.612-28.934 31.45 13.838z m116.992 111.96L637.8 207.569l23.901 23.901-33.965-5.032-15.096 30.192-5.032-33.966-33.966-5.032 30.192-15.095-5.032-33.966 23.902 23.902z m-35.223 138.38l11.322 32.707h33.965l-27.675 20.128 10.063 32.707-27.675-20.127-27.676 20.127 11.322-32.707-27.676-20.128h33.966z m-81.77 105.67l-2.515 33.966 32.707 12.58-33.965 8.805-2.516 33.966L512 481.808l-33.966 8.806 22.644-26.417-18.87-28.934 32.708 12.58z" fill="#FBDC00" p-id="6431"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1633520320033" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4898" width="128" height="128" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"></style></defs><path d="M20.945 144.29h975.128v651.637H20.945z" fill="#FFFFFF" p-id="4899"></path><path d="M998.4 795.927H20.945V144.291h975.128v651.636z m-975.127 0h972.8V144.291h-972.8v651.636z" fill="#EFEFEF" p-id="4900"></path><path d="M20.945 144.29h975.128v55.855H20.945z m0 104.728h975.128v46.546H20.945z m0 100.073h975.128v46.545H20.945z m0 100.073h975.128v46.545H20.945z m0 100.072h975.128v46.546H20.945z m0 100.073h975.128v46.546H20.945z m0 100.073h975.128v46.545H20.945z" fill="#B72343" p-id="4901"></path><path d="M20.945 144.29h390.982v351.42H20.945z" fill="#00467B" p-id="4902"></path><path d="M90.764 202.473l2.327 6.982h6.982l-4.655 2.327 2.327 6.982-6.981-4.655-4.655 4.655 2.327-6.982-6.981-2.327h6.981z m65.163 0v6.982h6.982l-4.654 2.327 2.327 6.982-4.655-4.655-6.982 4.655 2.328-6.982-4.655-2.327h6.982z m65.164 0l2.327 6.982h6.982l-6.982 2.327 2.327 6.982-4.654-4.655-6.982 4.655 2.327-6.982-4.654-2.327h6.982z m62.836 0l2.328 6.982h6.981l-4.654 2.327 2.327 6.982-6.982-4.655-4.654 4.655 2.327-6.982-4.655-2.327h6.982z m67.491 0l2.327 6.982h6.982l-6.982 2.327 2.328 6.982-4.655-4.655-6.982 4.655 2.328-6.982-4.655-2.327h6.982z m-293.236-34.91l2.327 6.982h6.982l-6.982 4.655 2.327 6.982-4.654-4.655-4.655 4.655V179.2l-4.654-4.655h6.982z m65.163 0l2.328 6.982h4.654l-4.654 4.655 2.327 6.982-4.655-4.655-6.981 4.655 2.327-6.982-4.655-4.655h6.982z m65.164 0l2.327 6.982h6.982l-6.982 4.655 2.328 6.982-4.655-4.655-6.982 4.655 2.328-6.982-4.655-4.655h6.982z m65.164 0v6.982h6.982L256 179.2l2.327 6.982-4.654-4.655-6.982 4.655 2.327-6.982-4.654-4.655h6.981z m65.163 0l2.328 6.982h6.981l-6.981 4.655 2.327 6.982-4.655-4.655-4.654 4.655V179.2l-4.655-4.655h6.982z m65.164 0l2.327 6.982h4.655l-4.655 4.655 2.328 6.982-4.655-4.655-6.982 4.655 2.327-6.982-4.654-4.655h6.982zM90.764 274.618l2.327 4.655h6.982l-4.655 4.654 2.327 6.982-6.981-4.654-4.655 4.654 2.327-6.982-6.981-4.654h6.981z m65.163 0v4.655h6.982l-4.654 4.654 2.327 6.982-4.655-4.654-6.982 4.654 2.328-6.982-4.655-4.654h6.982z m65.164 0l2.327 4.655h6.982l-6.982 4.654 2.327 6.982-4.654-4.654-6.982 4.654 2.327-6.982-4.654-4.654h6.982z m62.836 0l2.328 4.655h6.981l-4.654 4.654 2.327 6.982-6.982-4.654-4.654 4.654 2.327-6.982-4.655-4.654h6.982z m67.491 0l2.327 4.655h6.982l-6.982 4.654 2.328 6.982-4.655-4.654-6.982 4.654 2.328-6.982-4.655-4.654h6.982zM58.182 239.71l2.327 6.98h6.982l-6.982 4.655 2.327 6.982-4.654-4.654-4.655 4.654v-6.982l-4.654-4.654h6.982z m65.163 0l2.328 6.98h4.654l-4.654 4.655 2.327 6.982-4.655-4.654-6.981 4.654 2.327-6.982-4.655-4.654h6.982z m65.164 0l2.327 6.98h6.982l-6.982 4.655 2.328 6.982-4.655-4.654-6.982 4.654 2.328-6.982-4.655-4.654h6.982z m65.164 0v6.98h6.982L256 251.346l2.327 6.982-4.654-4.654-6.982 4.654 2.327-6.982-4.654-4.654h6.981z m65.163 0l2.328 6.98h6.981l-6.981 4.655 2.327 6.982-4.655-4.654-4.654 4.654v-6.982l-4.655-4.654h6.982z m65.164 0l2.327 6.98h4.655l-4.655 4.655 2.328 6.982-4.655-4.654-6.982 4.654 2.327-6.982-4.654-4.654h6.982zM90.764 346.764l2.327 6.981h6.982l-4.655 4.655 2.327 6.982-6.981-4.655-4.655 4.655 2.327-6.982-6.981-4.655h6.981z m65.163 0v6.981h6.982l-4.654 4.655 2.327 6.982-4.655-4.655-6.982 4.655 2.328-6.982-4.655-4.655h6.982z m65.164 0l2.327 6.981h6.982l-6.982 4.655 2.327 6.982-4.654-4.655-6.982 4.655 2.327-6.982-4.654-4.655h6.982z m62.836 0l2.328 6.981h6.981l-4.654 4.655 2.327 6.982-6.982-4.655-4.654 4.655 2.327-6.982-4.655-4.655h6.982z m67.491 0l2.327 6.981h6.982l-6.982 4.655 2.328 6.982-4.655-4.655-6.982 4.655 2.328-6.982-4.655-4.655h6.982zM58.182 314.182l2.327 6.982h6.982l-6.982 2.327 2.327 6.982-4.654-2.328-4.655 2.328v-6.982l-4.654-2.327h6.982z m65.163 0l2.328 6.982h4.654l-4.654 2.327 2.327 6.982-4.655-2.328-6.981 2.328 2.327-6.982-4.655-2.327h6.982z m65.164 0l2.327 6.982h6.982l-6.982 2.327 2.328 6.982-4.655-2.328-6.982 2.328 2.328-6.982-4.655-2.327h6.982z m65.164 0v6.982h6.982L256 323.49l2.327 6.982-4.654-2.328-6.982 2.328 2.327-6.982-4.654-2.327h6.981z m65.163 0l2.328 6.982h6.981l-6.981 2.327 2.327 6.982-4.655-2.328-4.654 2.328v-6.982l-4.655-2.327h6.982z m65.164 0l2.327 6.982h4.655l-4.655 2.327 2.328 6.982-4.655-2.328-6.982 2.328 2.327-6.982-4.654-2.327h6.982zM90.764 421.236l2.327 6.982h6.982l-4.655 4.655 2.327 4.654-6.981-2.327-4.655 2.327 2.327-4.654-6.981-4.655h6.981z m65.163 0v6.982h6.982l-4.654 4.655 2.327 4.654-4.655-2.327-6.982 2.327 2.328-4.654-4.655-4.655h6.982z m65.164 0l2.327 6.982h6.982l-6.982 4.655 2.327 4.654-4.654-2.327-6.982 2.327 2.327-4.654-4.654-4.655h6.982z m62.836 0l2.328 6.982h6.981l-4.654 4.655 2.327 4.654-6.982-2.327-4.654 2.327 2.327-4.654-4.655-4.655h6.982z m67.491 0l2.327 6.982h6.982l-6.982 4.655 2.328 4.654-4.655-2.327-6.982 2.327 2.328-4.654-4.655-4.655h6.982zM58.182 388.655l2.327 4.654h6.982l-6.982 4.655 2.327 6.981-4.654-4.654-4.655 4.654v-6.981l-4.654-4.655h6.982z m65.163 0l2.328 4.654h4.654l-4.654 4.655 2.327 6.981-4.655-4.654-6.981 4.654 2.327-6.981-4.655-4.655h6.982z m65.164 0l2.327 4.654h6.982l-6.982 4.655 2.328 6.981-4.655-4.654-6.982 4.654 2.328-6.981-4.655-4.655h6.982z m65.164 0v4.654h6.982L256 397.964l2.327 6.981-4.654-4.654-6.982 4.654 2.327-6.981-4.654-4.655h6.981z m65.163 0l2.328 4.654h6.981l-6.981 4.655 2.327 6.981-4.655-4.654-4.654 4.654v-6.981l-4.655-4.655h6.982z m65.164 0l2.327 4.654h4.655l-4.655 4.655 2.328 6.981-4.655-4.654-6.982 4.654 2.327-6.981-4.654-4.655h6.982zM58.182 456.145l2.327 6.982h6.982l-6.982 4.655 2.327 6.982-4.654-4.655-4.655 4.655v-6.982l-4.654-4.655h6.982z m65.163 0l2.328 6.982h4.654l-4.654 4.655 2.327 6.982-4.655-4.655-6.981 4.655 2.327-6.982-4.655-4.655h6.982z m65.164 0l2.327 6.982h6.982l-6.982 4.655 2.328 6.982-4.655-4.655-6.982 4.655 2.328-6.982-4.655-4.655h6.982z m65.164 0v6.982h6.982L256 467.782l2.327 6.982-4.654-4.655-6.982 4.655 2.327-6.982-4.654-4.655h6.981z m65.163 0l2.328 6.982h6.981l-6.981 4.655 2.327 6.982-4.655-4.655-4.654 4.655v-6.982l-4.655-4.655h6.982z m65.164 0l2.327 6.982h4.655l-4.655 4.655 2.328 6.982-4.655-4.655-6.982 4.655 2.327-6.982-4.654-4.655h6.982z" fill="#FFFFFF" p-id="4903"></path></svg>
\ No newline at end of file
......@@ -40,7 +40,7 @@
<app-logo [src]="dataSource.icon" [name]="dataSource.name"></app-logo>
</ng-template>
<ng-template #actionSetting>
<div nz-tooltip [nzTooltipTitle]="copyUrlDone ? '复制成功' : '复制链接'">
<div nz-tooltip [nzTooltipTitle]="copyUrlDone ? $t('_copySuccess') : $t('_copyUrl')">
<i
nz-icon
[nzType]="copyUrlDone ? 'check' : 'copy'"
......@@ -52,7 +52,7 @@
</div>
</ng-template>
<ng-template #actionEdit>
<div nz-tooltip [nzTooltipTitle]="copyPathDone ? '复制成功' : '分享网站'">
<div nz-tooltip [nzTooltipTitle]="copyPathDone ? $t('_copySuccess') : $t('_shareWeb')">
<i
nz-icon
[nzType]="copyPathDone ? 'check' : 'share-alt'"
......@@ -68,16 +68,16 @@
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li nz-menu-item (click)="toggleModal(); detail = dataSource">编辑</li>
<li nz-menu-item (click)="toggleModal(); detail = dataSource">{{ $t('_edit') }}</li>
<a
nz-popconfirm
nzPopconfirmPlacement="rightTop"
nzOkType="danger"
nzPopconfirmTitle="您确定要删除吗?"
[nzPopconfirmTitle]="$t('_confirmDel')"
nzPopconfirmPlacement="bottom"
(nzOnConfirm)="confirmDel($event)"
>
<li nz-menu-item nzDanger>删除</li>
<li nz-menu-item nzDanger>{{ $t('_del') }}</li>
</a>
</ul>
</nz-dropdown-menu>
......
......@@ -8,6 +8,7 @@ import { setWebsiteList, copyText, deleteByWeb, getTextContent, updateByWeb } fr
import { websiteList } from '../../store'
import { INavProps, ITagProp, INavFourProp } from '../../types'
import * as __tag from '../../../data/tag.json'
import { $t } from '../../locale'
const tagMap: ITagProp = (__tag as any).default
......@@ -19,6 +20,7 @@ const tagMap: ITagProp = (__tag as any).default
export class CardComponent implements OnInit {
@Input() dataSource: INavFourProp
$t = $t
objectKeys = Object.keys
websiteList: INavProps[] = websiteList
isLogin: boolean = !!getToken()
......@@ -72,7 +74,7 @@ export class CardComponent implements OnInit {
this.dataSource[k] = payload[k]
}
this.message.success('修改成功!')
this.message.success($t('_modifySuccess'))
this.toggleModal()
}
......
<div class="fixbar">
<span *ngIf="isLogin" nz-tooltip nzTooltipTitle="查看信息">
<span *ngIf="isLogin" nz-tooltip [nzTooltipTitle]="$t('_viewInfo')">
<div
class="wrapper dark-border-color dark-action-hover"
(click)="viewInfo()"
......@@ -28,7 +28,7 @@
</ul>
</nz-dropdown-menu>
<span *ngIf="isLogin" nz-tooltip nzTooltipTitle="同步数据">
<span *ngIf="isLogin" nz-tooltip [nzTooltipTitle]="$t('_syncData')">
<div
class="wrapper dark-bg dark-border-color dark-action-hover"
(click)="handleSync()"
......@@ -38,24 +38,31 @@
</div>
</span>
<span nz-tooltip nzTooltipTitle="新增数据">
<span nz-tooltip [nzTooltipTitle]="$t('_addData')">
<div class="wrapper dark-bg dark-border-color dark-action-hover" (click)="toggleModal()">
<i class="iconfont iconchuangjian"></i>
</div>
</span>
<span *ngIf="showCollapse" nz-tooltip [nzTooltipTitle]="collapsed ? '展开' : '折叠'">
<span *ngIf="showCollapse" nz-tooltip [nzTooltipTitle]="collapsed ? $t('_collapse') : $t('_put')">
<div class="wrapper dark-bg dark-border-color dark-action-hover" (click)="collapse()">
<i class="iconfont iconweibiaoti25 collapse" [class.active]="collapsed"></i>
</div>
</span>
<span nz-tooltip [nzTooltipTitle]="isDark ? '关闭暗黑' : '开启暗黑'">
<span nz-tooltip [nzTooltipTitle]="isDark ? $t('_closeDark') : $t('_openDark')">
<div class="wrapper dark-bg dark-border-color dark-action-hover" (click)="toggleMode()">
<i class="iconfont icondark dark" *ngIf="!isDark"></i>
<img class="iconfont icondark" src="assets/img/light.svg" *ngIf="isDark">
</div>
</span>
<span>
<div class="wrapper dark-bg dark-border-color dark-action-hover" (click)="toggleLocale()">
<img class="iconfont" src="assets/img/china.svg" *ngIf="language === 'zh-CN'">
<img class="iconfont" src="assets/img/ua.svg" *ngIf="!language || language === 'en'">
</div>
</span>
<div class="wrapper dark-bg dark-border-color dark-action-hover" (click)="goTop()">
<i class="iconfont iconjiantouarrow483 arrow"></i>
......
......@@ -10,9 +10,10 @@ import { NzNotificationService } from 'ng-zorro-antd/notification'
import { getToken } from '../../utils/user'
import { updateFileContent } from '../../services'
import { websiteList } from '../../store'
import { DB_PATH, KEY_MAP, VERSION, STORAGE_KEY_MAP } from '../../constants'
import { DB_PATH, VERSION, STORAGE_KEY_MAP } from '../../constants'
import { Router, ActivatedRoute } from '@angular/router'
import { setAnnotate } from '../../utils/ripple'
import { $t, getLocale } from 'src/locale'
@Component({
selector: 'app-fixbar',
......@@ -26,6 +27,8 @@ export class FixbarComponent {
@Input() selector: string
@Output() onCollapse = new EventEmitter()
$t = $t
language = getLocale()
websiteList = websiteList
isDark: boolean = isDarkFn()
showCreateModal = false
......@@ -33,23 +36,23 @@ export class FixbarComponent {
isLogin = !!getToken()
themeList = [
{
name: '切换到 Light',
name: $t('_switchTo') + ' Light',
url: '/light'
},
{
name: '切换到 Sim',
name: $t('_switchTo') + ' Sim',
url: '/sim'
},
{
name: '切换到 Side',
name: $t('_switchTo') + ' Side',
url: '/side'
},
{
name: '切换到 Shortcut',
name: $t('_switchTo') + ' Shortcut',
url: '/shortcut'
},
{
name: '切换到 App',
name: $t('_switchTo') + ' App',
url: '/app'
}
]
......@@ -78,14 +81,14 @@ export class FixbarComponent {
this.modal.info({
nzWidth: 500,
nzTitle: '以下信息只有您能查看,请放心!',
nzOkText: '知道了',
nzTitle: $t('_infoTip'),
nzOkText: $t('_know'),
nzContent: `
<p>Token: ${getToken()}</p>
<p>部署分支: ${config.branch}</p>
<p>上次构建时间: ${date || '未知'}</p>
<p>当前版本: <img src="https://img.shields.io/badge/release-v${VERSION}-red.svg?longCache=true&style=flat-square"></p>
<p>最新版本: <img src="https://img.shields.io/github/v/release/xjh22222228/nav" /></p>
<p>${$t('_devBranch')}: ${config.branch}</p>
<p>${$t('_prevDevTime')}: ${date || $t('_unknow')}</p>
<p>${$t('_curVer')}: <img src="https://img.shields.io/badge/release-v${VERSION}-red.svg?longCache=true&style=flat-square"></p>
<p>${$t('_newVer')}: <img src="https://img.shields.io/github/v/release/xjh22222228/nav" /></p>
`,
});
}
......@@ -148,14 +151,14 @@ export class FixbarComponent {
handleSync() {
if (this.syncLoading) {
this.message.warning('请不要频繁操作')
this.message.warning($t('_repeatOper'))
return
}
this.modal.info({
nzTitle: '同步数据到远端',
nzOkText: '确定同步',
nzContent: '确定将所有数据同步到远端吗?',
nzTitle: $t('_syncDataOut'),
nzOkText: $t('_confirmSync'),
nzContent: $t('_confirmSyncTip'),
nzOnOk: () => {
this.syncLoading = true;
......@@ -165,12 +168,12 @@ export class FixbarComponent {
path: DB_PATH
})
.then(() => {
this.message.success('同步成功, 大约需要5分钟构建时间')
this.message.success($t('_syncSuccessTip'))
})
.catch(res => {
this.notification.error(
`错误: ${res?.response?.status ?? 1401}`,
'同步失败, 请重试'
`${$t('_error')}: ${res?.response?.status ?? 1401}`,
$t('_syncFailTip')
)
})
.finally(() => {
......@@ -179,4 +182,10 @@ export class FixbarComponent {
}
});
}
toggleLocale() {
const l = this.language === 'en' ? 'zh-CN' : 'en'
window.localStorage.setItem(STORAGE_KEY_MAP.language, l)
window.location.reload()
}
}
<nz-modal
[(nzVisible)]="visible"
nzTitle="请授权登录"
[nzTitle]="$t('_authLogin')"
[nzOkLoading]="submiting"
(nzOnCancel)="hanldeCancel()"
(nzOnOk)="login()"
>
<ng-container *nzModalContent>
<p>请在下方输入您的TOKEN进行登录校验</p>
<input nz-input placeholder="请输入TOKEN" [(ngModel)]="token" maxlength="100" autofocus />
<p>{{ $t('_inputTokenMsg') }}</p>
<input nz-input [placeholder]="$t('_inputToken')" [(ngModel)]="token" maxlength="100" autofocus />
<p style="margin-top: 15px;">
不知道Token如何获取?<a href="https://github.com/xjh22222228/nav#%E9%83%A8%E7%BD%B2" target="_blank">请先阅读我们的指南</a>
{{ $t('_getToken') }}<a href="https://github.com/xjh22222228/nav#%E9%83%A8%E7%BD%B2" target="_blank"> {{ $t('_readDoc') }}</a>
</p>
</ng-container>
</nz-modal>
......@@ -6,6 +6,7 @@ import { NzMessageService } from 'ng-zorro-antd/message'
import { NzNotificationService } from 'ng-zorro-antd/notification'
import { verifyToken } from '../../services'
import { getToken, setToken } from '../../utils/user'
import { $t } from 'src/locale'
@Component({
selector: 'app-login',
......@@ -16,6 +17,7 @@ export class LoginComponent implements OnInit {
@Input() visible: boolean
@Output() onCancel = new EventEmitter()
$t = $t
token = ''
isLogin = !!getToken()
submiting = false
......@@ -33,18 +35,18 @@ export class LoginComponent implements OnInit {
login() {
if (!this.token || this.token.length < 40) {
return this.message.error('请填写正确的Token');
return this.message.error($t('_pleaseInputToken'))
}
this.submiting = true
verifyToken(this.token)
.then(() => {
setToken(this.token);
this.message.success('Token验证成功, 2秒后刷新!')
this.message.success($t('_tokenVerSuc'))
setTimeout(() => window.location.reload(), 2000)
})
.catch(res => {
this.notification.error('Token 验证失败', res.message as string)
this.notification.error($t('_tokenVerFail'), res.message as string)
})
.finally(() => {
this.submiting = false
......
<div class="no-result dark-text">
<nz-empty nzNotFoundContent="对不起,没有找到您想要的结果~"></nz-empty>
<nz-empty [nzNotFoundContent]="$t('_empty')"></nz-empty>
<div class="back">
<button nz-button nzType="primary" (click)="goBack()">返回上一层</button>
<button nz-button nzType="primary" (click)="goBack()">{{ $t('_goBack') }}</button>
</div>
</div>
// Copyright @ 2018-2021 xiejiahe. All rights reserved. MIT license.
import { Component } from '@angular/core';
import { Component } from '@angular/core'
import { $t } from 'src/locale';
@Component({
selector: 'app-no-data',
......@@ -8,6 +9,8 @@ import { Component } from '@angular/core';
styleUrls: ['./no-data.component.scss']
})
export class NoDataComponent {
$t = $t
goBack = () => {
history.go(-1);
}
......
......@@ -33,11 +33,11 @@
</ng-template>
<ng-template #addOnBeforeTemplate>
<nz-select [(ngModel)]="searchTypeValue" *ngIf="!currentEngine.url">
<nz-option nzLabel="默认" [nzValue]="SearchType.All"></nz-option>
<nz-option nzLabel="标题" [nzValue]="SearchType.Title"></nz-option>
<nz-option nzLabel="描述" [nzValue]="SearchType.Desc"></nz-option>
<nz-option nzLabel="链接" [nzValue]="SearchType.Url"></nz-option>
<nz-option nzLabel="当前" [nzValue]="SearchType.Current"></nz-option>
<nz-option [nzLabel]="$t('_default')" [nzValue]="SearchType.All"></nz-option>
<nz-option [nzLabel]="$t('_title')" [nzValue]="SearchType.Title"></nz-option>
<nz-option [nzLabel]="$t('_desc')" [nzValue]="SearchType.Desc"></nz-option>
<nz-option [nzLabel]="$t('_link')" [nzValue]="SearchType.Url"></nz-option>
<nz-option [nzLabel]="$t('_current')" [nzValue]="SearchType.Current"></nz-option>
</nz-select>
</ng-template>
</div>
......
......@@ -7,6 +7,7 @@ import { Router } from '@angular/router'
import * as searchEngineList from '../../../data/search.json'
import { ISearchEngineProps } from '../../types'
import { SearchType } from './index'
import { $t } from 'src/locale'
@Component({
selector: 'app-search-engine',
......@@ -14,6 +15,7 @@ import { SearchType } from './index'
styleUrls: ['./search-engine.component.scss']
})
export class SearchEngineComponent {
$t = $t
searchEngineList: ISearchEngineProps[] = (searchEngineList as any).default
currentEngine: ISearchEngineProps = getDefaultSearchEngine()
SearchType = SearchType
......
......@@ -7,6 +7,7 @@ import { NzMessageService } from 'ng-zorro-antd/message'
import { queryString, setWebsiteList } from '../../utils'
import { getToken } from '../../utils/user'
import { websiteList } from '../../store'
import { $t } from 'src/locale'
@Component({
selector: 'app-toolbar-title',
......@@ -38,10 +39,10 @@ export class ToolbarTitleWebComponent implements OnInit {
const w = this.websiteList[page].nav[id].nav[this.index].nav
const exists = w.some(item => item.name === payload.name)
if (exists) {
return this.message.error('请不要重复添加')
return this.message.error($t('_repeatAdd'))
}
w.unshift(payload)
this.message.success('新增成功!')
this.message.success($t('_addSuccess'))
setWebsiteList(this.websiteList)
this.toggleCreateModal()
}
......
......@@ -33,5 +33,6 @@ export const STORAGE_KEY_MAP = {
s_url: 's_url',
isDark: 'isDark',
website: 'website',
engine: 'engine'
engine: 'engine',
language: 'language'
}
export default {
_webTitle: 'Discovery Navigation',
_uncategorized: 'Unclassified',
_modifySuccess: 'Modification succeeded!',
_copySuccess: 'Copy succeeded!',
_copyUrl: 'Copy Link',
_shareWeb: 'Share WEB',
_edit: 'Edit',
_add: 'Add',
_del: 'Delete',
_confirmDel: 'Are you sure you want to delete?',
_default: 'Default',
_title: 'Title',
_desc: 'Description',
_link: 'Link',
_current: 'Current',
_empty: `Sorry, we didn't find the result you want~`,
_goBack: 'Go Back',
_viewInfo: 'View Info',
_syncData: 'Sync Data',
_addData: 'Add Data',
_collapse: 'Open',
_put: 'Fold',
_closeDark: 'Close Dark',
_openDark: 'Open Dark',
_switchTo: 'Switch To',
_infoTip: 'Only you can view the following information, please rest assured!',
_know: 'Know',
_devBranch: 'Deploy branch',
_curVer: 'Current Version',
_newVer: 'Latest Version',
_prevDevTime: 'Last build time',
_unknow: 'Unknow',
_repeatOper: 'Please do not operate frequently',
_syncDataOut: 'Synchronize data to remote',
_confirmSync: '确定同步',
_confirmSyncTip: 'Are you sure to synchronize all data to the remote end?',
_syncSuccessTip: 'The synchronization is successful. It takes about 5 minutes to build',
_error: 'Error',
_syncFailTip: 'Synchronization failed, please try again',
_inputToken: 'Please enter token',
_inputTokenMsg: 'Please enter your token below for login verification',
_getToken: `I don't know how to get the token?`,
_readDoc: 'Please read our guide first',
_authLogin: 'Please authorize login',
_pleaseInputToken: 'Please fill in the correct token',
_tokenVerSuc: 'Token verification succeeded. Refresh in 2 seconds!',
_tokenVerFail: 'Token validation failed',
_repeatAdd: 'Please do not add repeatedly',
_addSuccess: 'Successfully added!',
_delSuccess: 'Delete succeeded!',
_saveSuccess: 'Saved successfully!',
_errorBookTip: 'Error: bookmark resolution failed',
_importSuccess: 'Import succeeded, refresh in 2 seconds!',
_acceptPng: 'Only PNG format is supported',
_updateLogoSuccess: 'The replacement was successful. It needs to be updated the next day due to CDN cache problems',
_updateLogoFail: 'Failed to replace logo, please try again!',
_resetInitData: 'Reset initial data',
_confirmReset: 'OK reset',
_warnReset: 'All data will be restored to its original state and cannot be undone!',
_resetSuccess: 'The data has been reset back to its initial state',
_sel3: 'Please select Level 3 Classification',
_sel2: 'Please select Level 2 Classification',
_sel1: 'Please select Level 1 Classification',
_reserveOne: 'At least one item is reserved. Please add it first!',
_icon: 'ICON',
_backHome: 'GO Home',
_syncRemote: 'Sync to remote',
_uploading: 'Uploading...',
_addTag: 'Add category',
_addWeb: 'Add site',
_clickEdit: 'Click Edit',
_importChrome: 'Import from Chrome bookmarks',
_allContentMsg1: '1. After setting all data, click "synchronize to remote end" and drag the table to sort',
_allContentMsg2: '2. Website classification needs to be maintained manually,',
_updateLogo: 'Replace logo, only PNG is supported',
_tagName: 'Classification name',
_onlyOwnVisible: 'Visible only to yourself',
_createAt: 'Create At',
_action: 'Action',
_delWarn: 'This will delete all data under the category. Are you sure you want to delete it?',
_mgr1: 'Management level 1 Classification',
_mgr2: 'Management level 2 Classification',
_mgr3: 'Management level 3 Classification',
_mgrWeb: 'Manage website',
_webName: 'Website name',
_webTag: 'Website classification',
_webDesc: 'Website description',
_requiredName: 'Please enter a name'
}
import config from '../../nav.config'
import english from "./english"
import zh_CN from "./zh_CN"
import { STORAGE_KEY_MAP } from 'src/constants'
const o = {
en: english,
cn: zh_CN
}
export function getLocale(): string {
return window.localStorage.getItem(STORAGE_KEY_MAP.language) || config.language
}
export function $t(s): string {
if (getLocale() === 'zh-CN') {
return o.cn[s]
}
return o.en[s]
}
export default o
export default {
_webTitle: '发现导航',
_uncategorized: '未分类',
_modifySuccess: '修改成功!',
_copySuccess: '复制成功',
_copyUrl: '复制链接',
_shareWeb: '分享网站',
_edit: '编辑',
_add: '新增',
_del: '删除',
_confirmDel: '您确定要删除吗?',
_default: '默认',
_title: '标题',
_desc: '描述',
_link: '链接',
_current: '当前',
_empty: '对不起,没有找到您想要的结果~',
_goBack: '返回上一层',
_viewInfo: '查看信息',
_syncData: '同步数据',
_addData: '新增数据',
_collapse: '展开',
_put: '折叠',
_closeDark: '关闭暗黑',
_openDark: '开启暗黑',
_switchTo: '切换到',
_infoTip: '以下信息只有您能查看,请放心!',
_know: '知道了',
_devBranch: '部署分支',
_curVer: '当前版本',
_newVer: '最新版本',
_prevDevTime: '上次构建时间',
_unknow: '未知',
_repeatOper: '请不要频繁操作',
_syncDataOut: '同步数据到远端',
_confirmSync: '确定同步',
_confirmSyncTip: '确定将所有数据同步到远端吗?',
_syncSuccessTip: '同步成功, 大约需要5分钟构建时间',
_error: '错误',
_syncFailTip: '同步失败, 请重试',
_inputToken: '请输入TOKEN',
_inputTokenMsg: '请在下方输入您的TOKEN进行登录校验',
_getToken: '不知道Token如何获取?',
_readDoc: '请先阅读我们的指南',
_authLogin: '请授权登录',
_pleaseInputToken: '请填写正确的Token',
_tokenVerSuc: 'Token验证成功, 2秒后刷新!',
_tokenVerFail: 'Token 验证失败',
_repeatAdd: '请不要重复添加',
_addSuccess: '新增成功!',
_delSuccess: '删除成功!',
_saveSuccess: '保存成功!',
_errorBookTip: '错误: 书签解析失败',
_importSuccess: '导入成功,2秒后刷新!',
_acceptPng: '仅支持 PNG 格式',
_updateLogoSuccess: '更换成功, 由于CDN缓存问题需要次日更新',
_updateLogoFail: '更换LOGO失败,请重试!',
_resetInitData: '重置初始数据',
_confirmReset: '确定重置',
_warnReset: '所有数据将还原初始状态,不可撤销!',
_resetSuccess: '数据已重置回初始状态',
_sel3: '请选择三级分类',
_sel2: '请选择二级分类',
_sel1: '请选择一级分类',
_reserveOne: '至少保留一项,请先添加!',
_icon: '图标',
_backHome: '返回主页',
_syncRemote: '同步到远端',
_uploading: '上传中...',
_addTag: '添加分类',
_addWeb: '添加网站',
_clickEdit: '点击编辑',
_importChrome: '从Chrome书签导入',
_allContentMsg1: '1、所有数据设置完毕后点击 “同步到远端”,拖拽表格进行排序',
_allContentMsg2: '2、网站分类需手动维护,',
_updateLogo: '更换LOGO, 仅支持 PNG',
_tagName: '分类名称',
_onlyOwnVisible: '仅自己可见',
_createAt: '创建时间',
_action: '操作',
_delWarn: '这会删除分类下的所有数据,您确定要删除吗?',
_mgr1: '管理一级分类',
_mgr2: '管理二级分类',
_mgr3: '管理三级分类',
_mgrWeb: '管理网站',
_webName: '网站名称',
_webTag: '网站分类',
_webDesc: '网站描述',
_requiredName: '请输入名称'
}
......@@ -67,6 +67,7 @@ export interface ISearchEngineProps {
}
export interface IConfig {
language?: 'zh-CN' | 'en'
gitRepoUrl: string
branch: string
loading?: string
......
......@@ -3,6 +3,7 @@
import { INavProps } from '../types'
import { websiteList } from '../store'
import { $t } from '../locale'
function getCreatedAt(node?: Element): string {
if (!node) {
......@@ -96,10 +97,10 @@ export function parseBookmark(htmlStr: string) {
jj++
data[ii - 1].nav.push({
createdAt: nowCratedAt,
title: '未分类',
title: $t('_uncategorized'),
nav: [
{
title: '未分类',
title: $t('_uncategorized'),
nav: allNoCateData
}
]
......@@ -129,7 +130,7 @@ export function parseBookmark(htmlStr: string) {
kk++
data[ii - 1].nav[jj - 1].nav.push({
createdAt: nowCratedAt,
title: '未分类',
title: $t('_uncategorized'),
nav: allNoCateData
})
}
......@@ -181,15 +182,15 @@ export function parseBookmark(htmlStr: string) {
const allNoCateData = findAllNoCate(roolDL)
if (allNoCateData.length > 0) {
data.push({
title: '未分类',
title: $t('_uncategorized'),
createdAt: nowCratedAt,
nav: [
{
createdAt: nowCratedAt,
title: '未分类',
title: $t('_uncategorized'),
nav: [
{
title: '未分类',
title: $t('_uncategorized'),
nav: allNoCateData
}
]
......
......@@ -4,7 +4,7 @@
style="margin-bottom: 15px;"
(click)="goBack()"
>
返回主页
{{ $t('_backHome') }}
</button>
<button
nz-button
......@@ -12,25 +12,25 @@
(click)="handleSync()"
[nzLoading]="syncLoading"
>
同步到远端
{{ $t('_syncRemote') }}
</button>
<button
nz-button
style="margin-left: 15px;"
(click)="handleReset()"
>
重置初始数据
{{ $t('_resetInitData') }}
</button>
<div class="content">
<p><b>1、所有数据设置完毕后点击 “同步到远端”,拖拽表格进行排序</b></p>
<p><b>2、网站分类需手动维护, <a [href]="gitRepoUrl + '/edit/main/data/tag.json'" target="_blank">点击编辑</a></b></p>
<p><b>{{ $t('_allContentMsg1') }}</b></p>
<p><b>{{ $t('_allContentMsg2') }} <a [href]="gitRepoUrl + '/edit/main/data/tag.json'" target="_blank">{{ $t('_clickEdit') }}</a></b></p>
<div class="logo-wrapper">
<label id="file">
<img [src]="LOGO_CDN" alt="" class="logo">
<p style="white-space: nowrap; margin-top: 5px;">
{{ uploading ? '上传中...' : '更换LOGO, 仅支持 PNG' }}
{{ uploading ? $t('_uploading') : $t('_updateLogo') }}
</p>
<input
type="file"
......@@ -44,7 +44,7 @@
<div class="book-wrapper">
<label id="file">
<img src="assets/img/bookmark.svg" alt="" class="logo">
<p style="white-space: nowrap; margin-top: 5px;">从Chrome书签导入</p>
<p style="white-space: nowrap; margin-top: 5px;">{{ $t('_importChrome') }}</p>
<input
type="file"
name="file"
......@@ -56,16 +56,16 @@
</div>
<nz-tabset *ngIf="isLogin" [nzSelectedIndex]="tabActive" (nzSelectedIndexChange)="onTabChange($event)">
<nz-tab nzTitle="管理一级分类">
<button nz-button nzType="primary" (click)="toggleCreateModal()">添加分类</button>
<nz-tab [nzTitle]="$t('_mgr1')">
<button nz-button nzType="primary" (click)="toggleCreateModal()">{{ $t('_addTag') }}</button>
<nz-table #basicTable [nzData]="websiteList" [nzShowPagination]="false" style="margin-top: 15px;">
<thead>
<tr>
<th>图标</th>
<th>分类名称</th>
<th>仅自己可见</th>
<th>创建时间</th>
<th>操作</th>
<th>{{ $t('_icon') }}</th>
<th>{{ $t('_tagName') }}</th>
<th>{{ $t('_onlyOwnVisible') }}</th>
<th>{{ $t('_createAt') }}</th>
<th>{{ $t('_action') }}</th>
</tr>
</thead>
<tbody cdkDropList (cdkDropListDropped)="dropOne($event)">
......@@ -83,14 +83,14 @@
</td>
<td>{{ data.createdAt }}</td>
<td>
<a (click)="handleEditBtn(data, idx)">编辑</a>
<a (click)="handleEditBtn(data, idx)">{{ $t('_edit') }}</a>
<a
nz-popconfirm
nzPopconfirmTitle="这会删除分类下的所有数据,您确定要删除吗?"
[nzPopconfirmTitle]="$t('_delWarn')"
nzPopconfirmPlacement="bottom"
(nzOnConfirm)="handleConfirmDelOne(idx)"
>
<a nz-button nzType="link" nzDanger>删除</a>
<a nz-button nzType="link" nzDanger>{{ $t('_del') }}</a>
</a>
</td>
</tr>
......@@ -98,11 +98,11 @@
</nz-table>
</nz-tab>
<nz-tab nzTitle="管理二级分类">
<nz-tab [nzTitle]="$t('_mgr2')">
<nz-select
[ngModel]="oneSelect"
nzShowSearch
nzPlaceHolder="请选择一级分类"
[nzPlaceHolder]="$t('_sel1')"
(ngModelChange)="hanldeOneSelect($event)"
style="width: 260px;"
>
......@@ -120,17 +120,17 @@
(click)="toggleCreateModal()"
style="margin-left: 20px;"
>
添加分类
{{ $t('_addTag') }}
</button>
<nz-table #basicTable [nzData]="twoTableData" [nzShowPagination]="false" style="margin-top: 15px;">
<thead>
<tr>
<th>图标</th>
<th>分类名称</th>
<th>仅自己可见</th>
<th>创建时间</th>
<th>操作</th>
<th>{{ $t('_icon') }}</th>
<th>{{ $t('_tagName') }}</th>
<th>{{ $t('_onlyOwnVisible') }}</th>
<th>{{ $t('_createAt') }}</th>
<th>{{ $t('_action') }}</th>
</tr>
</thead>
<tbody cdkDropList (cdkDropListDropped)="dropTwo($event)">
......@@ -148,14 +148,14 @@
</td>
<td>{{ data.createdAt }}</td>
<td>
<a (click)="handleEditBtn(data, idx)">编辑</a>
<a (click)="handleEditBtn(data, idx)">{{ $t('_edit') }}</a>
<a
nz-popconfirm
nzPopconfirmTitle="这会删除分类下的所有数据,您确定要删除吗?"
[nzPopconfirmTitle]="$t('_delWarn')"
nzPopconfirmPlacement="bottom"
(nzOnConfirm)="handleConfirmDelTwo(idx)"
>
<a nz-button nzType="link" nzDanger>删除</a>
<a nz-button nzType="link" nzDanger>{{ $t('_del') }}</a>
</a>
</td>
</tr>
......@@ -163,11 +163,11 @@
</nz-table>
</nz-tab>
<nz-tab nzTitle="管理三级分类">
<nz-tab [nzTitle]="$t('_mgr3')">
<nz-select
[ngModel]="oneSelect"
nzShowSearch
nzPlaceHolder="请选择一级分类"
[nzPlaceHolder]="$t('_sel1')"
(ngModelChange)="hanldeOneSelect($event)"
style="width: 200px;"
>
......@@ -182,7 +182,7 @@
<nz-select
[ngModel]="twoSelect"
nzShowSearch
nzPlaceHolder="请选择二级分类"
[nzPlaceHolder]="$t('_sel2')"
(ngModelChange)="hanldeTwoSelect($event)"
style="width: 200px; margin-left: 15px;"
>
......@@ -200,17 +200,17 @@
(click)="toggleCreateModal()"
style="margin-left: 20px;"
>
添加分类
{{ $t('_addTag') }}
</button>
<nz-table #basicTable [nzData]="threeTableData" [nzShowPagination]="false" style="margin-top: 15px;">
<thead>
<tr>
<th>图标</th>
<th>分类名称</th>
<th>仅自己可见</th>
<th>创建时间</th>
<th>操作</th>
<th>{{ $t('_icon') }}</th>
<th>{{ $t('_tagName') }}</th>
<th>{{ $t('_onlyOwnVisible') }}</th>
<th>{{ $t('_createAt') }}</th>
<th>{{ $t('_action') }}</th>
</tr>
</thead>
<tbody cdkDropList (cdkDropListDropped)="dropThree($event)">
......@@ -228,14 +228,14 @@
</td>
<td>{{ data.createdAt }}</td>
<td>
<a (click)="handleEditBtn(data, idx)">编辑</a>
<a (click)="handleEditBtn(data, idx)">{{ $t('_edit') }}</a>
<a
nz-popconfirm
nzPopconfirmTitle="这会删除分类下的所有数据,您确定要删除吗?"
[nzPopconfirmTitle]="$t('_delWarn')"
nzPopconfirmPlacement="bottom"
(nzOnConfirm)="handleConfirmDelThree(idx)"
>
<a nz-button nzType="link" nzDanger>删除</a>
<a nz-button nzType="link" nzDanger>{{ $t('_del') }}</a>
</a>
</td>
</tr>
......@@ -243,11 +243,11 @@
</nz-table>
</nz-tab>
<nz-tab nzTitle="管理网站">
<nz-tab [nzTitle]="$t('_mgrWeb')">
<nz-select
[ngModel]="oneSelect"
nzShowSearch
nzPlaceHolder="请选择一级分类"
[nzPlaceHolder]="$t('_sel1')"
(ngModelChange)="hanldeOneSelect($event)"
style="width: 200px;"
>
......@@ -262,7 +262,7 @@
<nz-select
[ngModel]="twoSelect"
nzShowSearch
nzPlaceHolder="请选择二级分类"
[nzPlaceHolder]="$t('_sel2')"
(ngModelChange)="hanldeTwoSelect($event)"
style="width: 200px; margin-left: 15px;"
>
......@@ -277,7 +277,7 @@
<nz-select
[ngModel]="threeSelect"
nzShowSearch
nzPlaceHolder="请选择三级分类"
[nzPlaceHolder]="$t('_sel3')"
(ngModelChange)="hanldeThreeSelect($event)"
style="width: 200px; margin-left: 15px;"
>
......@@ -295,19 +295,19 @@
(click)="toggleCreateWebModal()"
style="margin-left: 20px;"
>
添加网站
{{ $t('_addWeb') }}
</button>
<nz-table #basicTable [nzData]="websiteTableData" [nzShowPagination]="false" style="margin-top: 15px;">
<thead>
<tr>
<th>图标</th>
<th>网站名称</th>
<th>网站分类</th>
<th>仅自己可见</th>
<th nzWidth="300px">网站描述</th>
<th>创建时间</th>
<th>操作</th>
<th>{{ $t('_icon') }}</th>
<th>{{ $t('_webName') }}</th>
<th>{{ $t('_webTag') }}</th>
<th>{{ $t('_onlyOwnVisible') }}</th>
<th nzWidth="300px">{{ $t('_webDesc') }}</th>
<th>{{ $t('_createAt') }}</th>
<th>{{ $t('_action') }}</th>
</tr>
</thead>
<tbody cdkDropList (cdkDropListDropped)="dropWebsite($event)">
......@@ -335,14 +335,14 @@
</td>
<td nzWidth="200px">{{ data.createdAt }}</td>
<td nzWidth="100px">
<a (click)="toggleCreateWebModal(); websiteDetail = data; editIdx = idx">编辑</a>
<a (click)="toggleCreateWebModal(); websiteDetail = data; editIdx = idx">{{ $t('_edit') }}</a>
<a
nz-popconfirm
nzPopconfirmTitle="您确定要删除吗?"
[nzPopconfirmTitle]="$t('_confirmDel')"
nzPopconfirmPlacement="bottom"
(nzOnConfirm)="handleConfirmDelWebsite(idx)"
>
<a nz-button nzType="link" nzDanger>删除</a>
<a nz-button nzType="link" nzDanger>{{ $t('_del') }}</a>
</a>
</td>
</tr>
......@@ -362,28 +362,28 @@
<nz-modal
[(nzVisible)]="showCreateModal"
[nzTitle]="isEdit ? '编辑' : '新增'"
[nzTitle]="isEdit ? $t('_edit') : $t('_add')"
(nzOnCancel)="toggleCreateModal()"
(nzOnOk)="handleOk()"
>
<ng-container *nzModalContent>
<form nz-form [formGroup]="validateForm">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>分类名称</nz-form-label>
<nz-form-control [nzSpan]="18" nzErrorTip="请输入名称">
<input formControlName="title" nz-input placeholder="发现导航" />
<nz-form-label [nzSpan]="6" nzRequired>{{ $t('_tagName') }}</nz-form-label>
<nz-form-control [nzSpan]="18" [nzErrorTip]="$t('_requiredName')">
<input formControlName="title" nz-input [placeholder]="$t('_webTitle')" />
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>仅自己可见</nz-form-label>
<nz-form-label [nzSpan]="6" nzRequired>{{ $t('_onlyOwnVisible') }}</nz-form-label>
<nz-form-control [nzSpan]="18">
<nz-switch formControlName="ownVisible"></nz-switch>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6">图标</nz-form-label>
<nz-form-label [nzSpan]="6">{{ $t('_icon') }}</nz-form-label>
<nz-form-control [nzSpan]="18">
<nz-input-group [nzPrefix]="prefixIcon">
<input formControlName="icon" nz-input />
......
......@@ -16,6 +16,7 @@ import { DB_PATH, LOGO_PATH, LOGO_CDN, STORAGE_KEY_MAP } from '../../constants'
import { parseBookmark } from '../../utils/bookmark'
import * as __tag from '../../../data/tag.json'
import config from '../../../nav.config'
import { $t } from 'src/locale'
const tagMap: ITagProp = (__tag as any).default
......@@ -25,6 +26,7 @@ const tagMap: ITagProp = (__tag as any).default
styleUrls: ['./index.component.scss']
})
export default class WebpComponent {
$t = $t
validateForm!: FormGroup
websiteList: INavProps[] = websiteList
gitRepoUrl = config.gitRepoUrl
......@@ -75,11 +77,11 @@ export default class WebpComponent {
const result = parseBookmark(html)
if (!Array.isArray(result)) {
that.notification.error(
`错误: 书签解析失败`,
$t('_errorBookTip'),
`${result?.message ?? ''}`
)
} else {
that.message.success('导入成功,2秒后刷新!')
that.message.success($t('_importSuccess'))
that.websiteList = result
setWebsiteList(that.websiteList)
setTimeout(() => window.location.reload(), 2000)
......@@ -94,7 +96,7 @@ export default class WebpComponent {
const file = files[0]
if (file.type !== 'image/png') {
return this.message.error('仅支持 PNG 格式')
return this.message.error($t('_acceptPng'))
}
const fileReader = new FileReader()
......@@ -113,12 +115,12 @@ export default class WebpComponent {
path: LOGO_PATH,
branch: 'image'
}).then(() => {
that.message.success('更换成功, 由于CDN缓存问题需要次日更新')
that.message.success($t('_updateLogoSuccess'))
}).catch(res => {
logoEL.src = tempSrc
that.notification.error(
`错误: ${res?.response?.status ?? 401}`,
`${res?.response?.data?.message ?? '更换LOGO失败,请重试!'}`
`${$t('_error')}: ${res?.response?.status ?? 401}`,
`${res?.response?.data?.message ?? $t('_updateLogoFail')}`
)
}).finally(() => {
e.target.value = ''
......@@ -129,11 +131,11 @@ export default class WebpComponent {
handleReset() {
this.modal.info({
nzTitle: '重置初始数据',
nzOkText: '确定重置',
nzContent: '所有数据将还原初始状态,不可撤销!',
nzTitle: $t('_resetInitData'),
nzOkText: $t('_confirmReset'),
nzContent: $t('_warnReset'),
nzOnOk: () => {
this.message.success('数据已重置回初始状态')
this.message.success($t('_resetSuccess'))
window.localStorage.removeItem(STORAGE_KEY_MAP.website)
setTimeout(() => {
window.location.reload()
......@@ -148,7 +150,7 @@ export default class WebpComponent {
toggleCreateWebModal() {
if (this.tabActive === 3 && !this.threeSelect) {
return this.message.error('请选择三级分类')
return this.message.error($t('_sel3'))
}
this.websiteDetail = null
......@@ -159,10 +161,10 @@ export default class WebpComponent {
// 检测是否有选择
if (!this.showCreateModal) {
if (this.tabActive === 1 && !this.oneSelect) {
return this.message.error('请选择一级分类')
return this.message.error($t('_sel1'))
}
if (this.tabActive === 2 && !this.twoSelect) {
return this.message.error('请选择二级分类')
return this.message.error($t('_sel2'))
}
}
......@@ -179,11 +181,11 @@ export default class WebpComponent {
// 创建
const exists = this.websiteTableData.some(item => item.name === payload.name)
if (exists) {
return this.message.error('请不要重复添加')
return this.message.error($t('_repeatAdd'))
}
this.websiteTableData.unshift(payload)
this.message.success('新增成功!')
this.message.success($t('_addSuccess'))
}
setWebsiteList(this.websiteList)
......@@ -197,11 +199,11 @@ export default class WebpComponent {
// 删除一级分类
handleConfirmDelOne(idx) {
if (this.websiteList.length === 1) {
return this.message.error('至少保留一项,请先添加!')
return this.message.error($t('_reserveOne'))
}
this.websiteList.splice(idx, 1)
this.message.success('删除成功')
this.message.success($t('_delSuccess'))
setWebsiteList(this.websiteList)
}
......@@ -220,11 +222,11 @@ export default class WebpComponent {
// 删除二级分类
handleConfirmDelTwo(idx) {
if (this.twoTableData.length === 1) {
return this.message.error('至少保留一项,请先添加!')
return this.message.error($t('_reserveOne'))
}
this.twoTableData.splice(idx, 1)
this.message.success('删除成功')
this.message.success($t('_delSuccess'))
setWebsiteList(this.websiteList)
}
......@@ -237,11 +239,11 @@ export default class WebpComponent {
// 删除三级分类
handleConfirmDelThree(idx) {
if (this.threeTableData.length === 1) {
return this.message.error('至少保留一项,请先添加!')
return this.message.error($t('_reserveOne'))
}
this.threeTableData.splice(idx, 1)
this.message.success('删除成功')
this.message.success($t('_delSuccess'))
setWebsiteList(this.websiteList)
}
......@@ -254,11 +256,11 @@ export default class WebpComponent {
// 删除网站
handleConfirmDelWebsite(idx) {
if (this.websiteTableData.length === 1) {
return this.message.error('至少保留一项,请先添加!')
return this.message.error($t('_reserveOne'))
}
this.websiteTableData.splice(idx, 1)
this.message.success('删除成功')
this.message.success($t('_delSuccess'))
setWebsiteList(this.websiteList)
}
......@@ -294,9 +296,9 @@ export default class WebpComponent {
handleSync() {
this.modal.info({
nzTitle: '同步数据到远端',
nzOkText: '确定同步',
nzContent: '确定将所有数据同步到远端吗?',
nzTitle: $t('_syncDataOut'),
nzOkText: $t('_confirmSync'),
nzContent: $t('_confirmSyncTip'),
nzOnOk: () => {
this.syncLoading = true
......@@ -306,12 +308,12 @@ export default class WebpComponent {
path: DB_PATH
})
.then(() => {
this.message.success('同步成功, 大约需要5分钟构建时间')
this.message.success($t('_syncSuccessTip'))
})
.catch(res => {
this.notification.error(
`错误: ${res?.response?.status ?? 401}`,
'同步失败, 请重试'
`${$t('_error')}: ${res?.response?.status ?? 401}`,
$t('_syncFailTip')
)
})
.finally(() => {
......@@ -360,14 +362,14 @@ export default class WebpComponent {
break
}
this.message.success('保存成功!')
this.message.success($t('_saveSuccess'))
} else {
switch (this.tabActive) {
// 新增一级分类
case 0: {
const exists = this.websiteList.some(item => item.title === title)
if (exists) {
return this.message.error('请不要重复添加')
return this.message.error($t('_repeatAdd'))
}
this.websiteList.unshift({
......@@ -384,7 +386,7 @@ export default class WebpComponent {
case 1: {
const exists = this.twoTableData.some(item => item.title === title)
if (exists) {
return this.message.error('请不要重复添加')
return this.message.error($t('_repeatAdd'))
}
this.twoTableData.unshift({
......@@ -401,7 +403,7 @@ export default class WebpComponent {
case 2: {
const exists = this.threeTableData.some(item => item.title === title)
if (exists) {
return this.message.error('请不要重复添加')
return this.message.error($t('_repeatAdd'))
}
this.threeTableData.unshift({
......@@ -414,7 +416,7 @@ export default class WebpComponent {
}
break
}
this.message.success('新增成功!')
this.message.success($t('_addSuccess'))
}
this.validateForm.reset()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册