Commit f1c3b043 authored by 孙 楠's avatar 孙 楠

add i18n messages

parent 5a34e1f1
......@@ -13,7 +13,7 @@ artifacts.json
*tmp
_site
logs
app/**/*.js
#app/**/*.js
config/plugin.local.js
config/plugin.js
config/config.*.js
......
......@@ -10,6 +10,7 @@ Single Page Application Isomorphic Example for Egg + Vue, Front-End and Node of
- https://www.yuque.com/easy-team/easywebpack
- https://easyjs.cn
## QuickStart
- Development
......@@ -30,11 +31,6 @@ npm run build
npm start
```
## 添加微信校验文件
- 1、在 config/wxVertify.ts 中添加
- 2、再把校验文件复制到 config/wxVertify/ 文件夹下面
## Features
- ✔︎ Single Page Application, Support Vue Server Side Render and Client Side Render Modes, Rendering Cache, Automatic Downgrade
......@@ -60,7 +56,7 @@ npm start
- https://github.com/kaorun343/vue-property-decorator
- https://github.com/ktsn/vuex-class
## License
[MIT](LICENSE)
......@@ -13,7 +13,7 @@ export default class ActivityController extends Controller {
body = await ctx.service.redis.get(redisKey);
console.log('quantum-blocks body :>> ', body);
if (body) {
ctx.logger.info('请求redis成功 key: %j', redisKey);
ctx.logger.info($t('redis.request.success.key.j'), redisKey);
}
if (!body) {
body = await ctx.renderToHtml('activity.js', { url: ctx.url, apollo });
......
// en.js
export default {
"access.denied": "Access denied",
"bad.request": "Bad request",
"better.life.more.relaxed": "Better life, more relaxed",
"cancel.duplicate.request": "Cancel duplicate request",
"click": "Click \"",
"clicked": "Clicked",
"content.loading.soon": "Content loading soon",
"event.has.ended": "Event has ended",
"event.page": "Event page",
"explore.other.events": "Explore other events",
"follow.more.exciting.events": "Follow more exciting events",
"free.container": "Free container",
"http.version.not.supported": "HTTP version not supported",
"method.not.allowed": "Method not allowed",
"network.error": "Network error",
"network.not.implemented": "Network not implemented",
"network.timeout": "Network timeout",
"no.more.content": "No more content",
"not.logged.in.or.session.expired.please.log.in.again": "Not logged in or session expired, please log in again",
"notice": "Notice",
"page.not.found": "Page not found",
"progress": "Progress:",
"redis.request.success.key.j": "Redis request success key: %j",
"request.error.resource.not.found": "Request error, resource not found",
"request.timeout": "Request timeout",
"server.error": "Server error",
"service.error.please.retry.later": "Service error, please retry later",
"service.exception": "Service exception",
"service.unavailable": "Service unavailable",
"share": "Share",
"share.this.page": "Share this page",
"shopping.cart": "Shopping cart",
"yangxiaomie": "Yangxiaomie",
};
// zh.js
export default {
"access.denied": "拒绝访问",
"bad.request": "错误请求",
"better.life.more.relaxed": "美好生活更从容",
"cancel.duplicate.request": "取消重复请求",
"click": "点击“",
"clicked": "点击了",
"content.loading.soon": "内容即将呈现",
"event.has.ended": "活动已结束",
"event.page": "活动页",
"explore.other.events": "去看看其他活动",
"follow.more.exciting.events": "请关注更多精彩活动",
"free.container": "自由容器",
"http.version.not.supported": "http版本不支持该请求",
"method.not.allowed": "请求方法未允许",
"network.error": "网络错误",
"network.not.implemented": "网络未实现",
"network.timeout": "网络超时",
"no.more.content": "没有更多啦~",
"not.logged.in.or.session.expired.please.log.in.again": "您未登录或登录超时,请重新登录",
"notice": "提示",
"page.not.found": "你访问的页面不存在",
"progress": "进度:",
"redis.request.success.key.j": "请求redis成功 key: %j",
"request.error.resource.not.found": "请求错误,未找到该资源",
"request.timeout": "请求超时",
"server.error": "服务器端出错",
"service.error.please.retry.later": "服务异常,请稍后重试",
"service.exception": "服务异常",
"service.unavailable": "服务不可用",
"share": "分享",
"share.this.page": "”分享当前页面",
"shopping.cart": "购物车",
"yangxiaomie": "羊小咩",
};
......@@ -89,6 +89,6 @@ export default class Layout extends Vue {
}
defaultTitle() {
return +localStorage.get('tenantId') === 560761 ? '羊小咩' : '活动页';
return +localStorage.get('tenantId') === 560761 ? $t('yangxiaomie') : $t('event.page');
}
}
\ No newline at end of file
......@@ -29,7 +29,7 @@
<svg viewBox="25 25 50 50" class="circular">
<circle cx="50" cy="50" r="20" fill="none" class="path"></circle>
</svg>
<p>内容即将呈现</p>
<p>{{ $t('content.loading.soon') }}</p>
</div>
</div>
<div id="app"><slot></slot></div>
......
......@@ -43,7 +43,7 @@ export default {
return [data.data, null];
}
// 接下来处理异常业务
const msg = data.msg || '服务异常';
const msg = data.msg || $t('service.exception');
if (!config.hideToast || !data.noAlert) {
Toast(msg);
......
......@@ -4,7 +4,7 @@ export const kaLoginForm = require('@qg/citrus-ui/md/index.json');
export const basicComponents = [
{
eleName: 'freedom-container',
title: '自由容器',
title: $t('free.container'),
config: [
// {
// key: 'backgroundImage',
......
......@@ -9,10 +9,8 @@
:distance="100"
/>
<cr-popover class="wxmp-tip" :value="showMpTip" placement="bottom-end">
<div class="wxmp-tip__content" ref="content">
点击“<cr-icon type="weapp-nav" />”分享当前页面
</div>
<template #reference>提示</template>
<div class="wxmp-tip__content" ref="content">{{ $t('click') }}<cr-icon type="weapp-nav" />{{ $t('share.this.page') }}</div>
<template #reference>{{ $t('notice') }}</template>
</cr-popover>
<div
v-if="showShareOverlay"
......@@ -95,7 +93,7 @@ export default {
if (isHarmonyOS) {
return btAttachVal
.map((item) => {
if (item.name === "购物车") {
if (item.name === $t('shopping.cart')) {
const appChannel = localStorage.get("appChannel") || "";
const token = localStorage.get("vccToken") || "";
const tenantId = localStorage.get("tenantId") || "";
......@@ -103,11 +101,11 @@ export default {
}
return item;
})
.filter((item) => item.persets !== "分享");
.filter((item) => item.persets !== $t('share'));
}
return btAttachVal;
} else if (isWxMp) {
return btAttachVal.filter((item) => item.persets !== "购物车");
return btAttachVal.filter((item) => item.persets !== $t('shopping.cart'));
}
return [];
// if (this.pageData.props && this.pageData.props.btAttachVal) {
......@@ -138,7 +136,7 @@ export default {
immediate: true,
handler(val) {
this.cartIndex = (val || []).findIndex(
(item) => item.persets === "购物车"
(item) => item.persets === $t('shopping.cart')
);
this.getCartCountDebounce();
},
......@@ -209,7 +207,7 @@ export default {
jump_link: e.url,
window_name: e.name,
});
if (e && e.persets === "分享") {
if (e && e.persets === $t('share')) {
if (this.tipTimer) {
clearTimeout(this.tipTimer);
}
......@@ -242,7 +240,7 @@ export default {
}
this.link = link;
const defaultTitle =
+localStorage.get("tenantId") === 560761 ? "羊小咩" : "活动页";
+localStorage.get("tenantId") === 560761 ? $t('yangxiaomie') : $t('event.page');
let shareUrl = shareCoverImage || coverImage;
shareUrl += isApp ? "?imageMogr2/thumbnail/120x120" : "";
this.shareInfo = {
......@@ -251,7 +249,7 @@ export default {
platform: ["weChat", "timeLine"],
shareDic: {
title: pageName || defaultTitle,
desc: pageDescribe || "美好生活更从容",
desc: pageDescribe || $t('better.life.more.relaxed'),
link,
imgUrl: shareUrl,
},
......
......@@ -2,7 +2,7 @@
<cr-empty
class="empty-state"
image="error"
description="你访问的页面不存在"
:description="$t('page.not.found')"
/>
</template>
<script>
......
......@@ -3,9 +3,9 @@
<cr-popup v-model="show" round :close-on-click-overlay="false">
<div class="content">
<img src="https://img.91xr.cn/activityInvalid.18ea3ddc.png" alt="">
<p class="title">活动已结束</p>
<p class="subtitle">请关注更多精彩活动</p>
<cr-button type="primary" shape="circle" @click="toOtherActivity">去看看其他活动</cr-button>
<p class="title">{{ $t('event.has.ended') }}</p>
<p class="subtitle">{{ $t('follow.more.exciting.events') }}</p>
<cr-button type="primary" shape="circle" @click="toOtherActivity">{{ $t('explore.other.events') }}</cr-button>
</div>
<!-- <cr-icon type="close" size="34px" color="#FFF" @click="close" /> -->
</cr-popup>
......
......@@ -314,7 +314,7 @@ export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyle
}
dot(title) {
console.log(title, '点击了');
console.log(title, $t('clicked'));
}
fixGridKey(item) {
if (typeof item.point?.i === 'number' && !isNaN(item.point?.i)) {
......
......@@ -70,12 +70,12 @@ export const defaultState = {
},
props: {
showPageBottomTip: true,
pageBottomTxt: '没有更多啦~',
pageBottomTxt: $t('no.more.content'),
pageBottomColor: '#fff',
showBackTop: true,
btAttachVal: [
{
name: '购物车',
name: $t('shopping.cart'),
icon: 'shopping-cart-o',
url: 'xyqb://shoppingCartTab',
color: '#333',
......
......@@ -6,18 +6,18 @@ import strategyModes from '@/config/http.config';
const ERR_MESSAGE_MAP = {
status: {
400: '错误请求',
401: '您未登录或登录超时,请重新登录',
403: '拒绝访问',
404: '请求错误,未找到该资源',
405: '请求方法未允许',
408: '请求超时',
500: '服务器端出错',
501: '网络未实现',
502: '网络错误',
503: '服务不可用',
504: '网络超时',
505: 'http版本不支持该请求'
400: $t('bad.request'),
401: $t('not.logged.in.or.session.expired.please.log.in.again'),
403: $t('access.denied'),
404: $t('request.error.resource.not.found'),
405: $t('method.not.allowed'),
408: $t('request.timeout'),
500: $t('server.error'),
501: $t('network.not.implemented'),
502: $t('network.error'),
503: $t('service.unavailable'),
504: $t('network.timeout'),
505: $t('http.version.not.supported')
}
};
const defaultStratege = {
......@@ -102,15 +102,15 @@ instance.interceptors.response.use(
if (err.message === 'Network Error' && !err.response) {
// 网络异常: 错误域名,
message = '服务不可用';
message = $t('service.unavailable');
} else if (err.response && err.response?.status) {
message =
ERR_MESSAGE_MAP.status[err.response?.status] || `未知异常码: ${err.response?.status}`;
} else if (err.message === '取消重复请求') {
message = '取消重复请求';
} else if (err.message === $t('cancel.duplicate.request')) {
message = $t('cancel.duplicate.request');
showToast = false;
}
showToast && Toast(message || '服务异常,请稍后重试');
showToast && Toast(message || $t('service.error.please.retry.later'));
const error = new Error(message);
console.error(error);
return [null, error];
......
......@@ -44,10 +44,6 @@
"/yB3tnMTnRc.txt": "5c9d1a08b3bda49beb0f950b1cdec27b",
"/gAnCcSGwFu.txt": "a8ae84f68ea72f82beff325a59fd2c58",
"/qqCExxuPJ7.txt": "a1da927722f735a09065407e32beb56a",
"/nc7QENWU7D.txt": "e9372355b4d2d128391b125c10547583",
"/G9yvqknBT8.txt": "a577d5c579061ec2782e9264e66f907f",
"/jg8jNUY2C5.txt": "8d9308d2d33911fa8cd1a108c5944339",
"/t3oh8XDXaU.txt": "006bf178a420b5e01493474283c0cfcb",
"/86b9af10a6b70c8be78c9095b24448ec.html": "5c9d1a08b3bda49beb0f950b1cdec27b",
"/bd_mapp_domaincer_25998612.txt": "a7ff4d126c6a7b90c73356e410a163b9",
"/MP_verify_f4VWFoFpHgzmqFbo.txt": "f4VWFoFpHgzmqFbo",
......
......@@ -18,10 +18,6 @@ export default {
'/gAnCcSGwFu.txt': fs.readFileSync(path.join(__dirname, '/wxVertify/gAnCcSGwFu.txt')),
'/qqCExxuPJ7.txt': fs.readFileSync(path.join(__dirname, '/wxVertify/qqCExxuPJ7.txt')),
"/9FABlQ5XMD.txt": fs.readFileSync(path.join(__dirname, '/wxVertify/9FABlQ5XMD.txt')),
"/G9yvqknBT8.txt": fs.readFileSync(path.join(__dirname, '/wxVertify/G9yvqknBT8.txt')),
"/t3oh8XDXaU.txt": fs.readFileSync(path.join(__dirname, '/wxVertify/t3oh8XDXaU.txt')),
"/jg8jNUY2C5.txt": fs.readFileSync(path.join(__dirname, '/wxVertify/jg8jNUY2C5.txt')),
"/nc7QENWU7D.txt": fs.readFileSync(path.join(__dirname, '/wxVertify/nc7QENWU7D.txt')),
'/86b9af10a6b70c8be78c9095b24448ec.html': fs.readFileSync(path.join(__dirname, '/wxVertify/86b9af10a6b70c8be78c9095b24448ec.html')),
'/bd_mapp_domaincer_25998612.txt': fs.readFileSync(path.join(__dirname, '/wxVertify/bd_mapp_domaincer_25998612.txt')),
'/MP_verify_f4VWFoFpHgzmqFbo.txt': fs.readFileSync(path.join(__dirname, '/wxVertify/MP_verify_f4VWFoFpHgzmqFbo.txt')),
......
......@@ -30,7 +30,7 @@ class upload2Cos {
const filepath = this.filesPath[idx];
await this.instance.put(`${prefix}/public${filepath.split('public')[1]}`, path.normalize(filepath));
let percent = (parseFloat((idx + 1) / filesCount) * 100).toFixed(2);
console.log('进度:' + percent + '%');
console.log($t('progress') + percent + '%');
}
} catch (error) {
console.log(error);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment