Browse Source

增加国际化

fix-1705
wangjr 3 years ago
parent
commit
74c5595778
15 changed files with 19208 additions and 124 deletions
  1. +18908
    -17
      package-lock.json
  2. +1
    -0
      package.json
  3. +1
    -1
      templates/base/footer_content.tmpl
  4. +1
    -1
      templates/base/footer_content_fluid.tmpl
  5. +15
    -1
      templates/custom/select_dataset.tmpl
  6. +1
    -1
      templates/explore/data_analysis.tmpl
  7. +16
    -0
      templates/explore/datasets.tmpl
  8. +1
    -0
      templates/repo/modelarts/notebook/show.tmpl
  9. +73
    -53
      web_src/js/components/Contributors.vue
  10. +21
    -5
      web_src/js/components/EditTopics.vue
  11. +40
    -26
      web_src/js/components/Images.vue
  12. +19
    -15
      web_src/js/components/MinioUploader.vue
  13. +38
    -0
      web_src/js/components/i18n/lang/en.js
  14. +34
    -0
      web_src/js/components/i18n/lang/zh.js
  15. +39
    -4
      web_src/js/index.js

+ 18908
- 17
package-lock.json
File diff suppressed because it is too large
View File


+ 1
- 0
package.json View File

@@ -54,6 +54,7 @@
"vue": "2.6.11", "vue": "2.6.11",
"vue-bar-graph": "1.2.0", "vue-bar-graph": "1.2.0",
"vue-calendar-heatmap": "0.8.4", "vue-calendar-heatmap": "0.8.4",
"vue-i18n": "6.1.3",
"vue-loader": "15.9.2", "vue-loader": "15.9.2",
"vue-router": "3.3.4", "vue-router": "3.3.4",
"vue-template-compiler": "2.6.11", "vue-template-compiler": "2.6.11",


+ 1
- 1
templates/base/footer_content.tmpl View File

@@ -21,7 +21,7 @@
<div class="header item">{{.i18n.Tr "custom.foot.help"}}</div> <div class="header item">{{.i18n.Tr "custom.foot.help"}}</div>
<div class="ui language bottom floating slide up dropdown link item"> <div class="ui language bottom floating slide up dropdown link item">
<i class="world icon"></i> <i class="world icon"></i>
<div class="text">{{.LangName}}</div>
<div class="text" id="langName">{{.LangName}}</div>
<div class="menu"> <div class="menu">
{{range .AllLangs}} {{range .AllLangs}}
<a lang="{{.Lang}}" class="item {{if eq $.Lang .Lang}}active selected{{end}}" href="{{if eq $.Lang .Lang}}#{{else}}{{$.Link}}?lang={{.Lang}}{{end}}">{{.Name}}</a> <a lang="{{.Lang}}" class="item {{if eq $.Lang .Lang}}active selected{{end}}" href="{{if eq $.Lang .Lang}}#{{else}}{{$.Link}}?lang={{.Lang}}{{end}}">{{.Name}}</a>


+ 1
- 1
templates/base/footer_content_fluid.tmpl View File

@@ -19,7 +19,7 @@
<div class="header item">{{.i18n.Tr "custom.foot.help"}}</div> <div class="header item">{{.i18n.Tr "custom.foot.help"}}</div>
<div class="ui language bottom floating slide up dropdown link item"> <div class="ui language bottom floating slide up dropdown link item">
<i class="world icon"></i> <i class="world icon"></i>
<div class="text">{{.LangName}}</div>
<div class="text" id="langName">{{.LangName}}</div>
<div class="menu"> <div class="menu">
{{range .AllLangs}} {{range .AllLangs}}
<a lang="{{.Lang}}" class="item {{if eq $.Lang .Lang}}active selected{{end}}" href="{{if eq $.Lang .Lang}}#{{else}}{{$.Link}}?lang={{.Lang}}{{end}}">{{.Name}}</a> <a lang="{{.Lang}}" class="item {{if eq $.Lang .Lang}}active selected{{end}}" href="{{if eq $.Lang .Lang}}#{{else}}{{$.Link}}?lang={{.Lang}}{{end}}">{{.Name}}</a>


+ 15
- 1
templates/custom/select_dataset.tmpl View File

@@ -135,4 +135,18 @@
</el-dialog> </el-dialog>




</div>
</div>

<script type="text/javascript">
import Vue from 'vue';
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import locale from 'element-ui/lib/locale'
var text_langName = document.getElementById("menutext_2").innerText
if (text_langName == '简体中文'){
locale.use(zhLocale)
}
else if (text_langName == 'English'){
locale.use(enLocale)
}
</script>

+ 1
- 1
templates/explore/data_analysis.tmpl View File

@@ -12,4 +12,4 @@
padding-bottom: 53px; padding-bottom: 53px;
} }


</style>
</style>

+ 16
- 0
templates/explore/datasets.tmpl View File

@@ -216,3 +216,19 @@
</div> </div>
</div> </div>
{{template "base/footer" .}} {{template "base/footer" .}}

<script type="text/javascript">
import Vue from 'vue';
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import locale from 'element-ui/lib/locale'

var text_langName = document.getElementById("menutext_2").innerText
console.log("fjdhfdjhfjdhfdjhfdj:",text_langName)
if (text_langName == '简体中文'){
locale.use(zhLocale)
}
else if (text_langName == 'English'){
locale.use(enLocale)
}
</script>

+ 1
- 0
templates/repo/modelarts/notebook/show.tmpl View File

@@ -66,3 +66,4 @@
</div> </div>
</div> </div>
{{template "base/footer" .}} {{template "base/footer" .}}


+ 73
- 53
web_src/js/components/Contributors.vue View File

@@ -1,11 +1,11 @@
<template> <template>
<div class="ui container"> <div class="ui container">
<div class="row git-user-content">
<div class="row git-user-content" >
<h3 class="ui header"> <h3 class="ui header">
<div class="ui breadcrumb">
<a class="section" :href="url_code">代码</a>
<div class="ui breadcrumb" id ='contri'>
<a class="section" :href="url_code"> {{$t('message.code')}}</a>
<div class="divider"> / </div> <div class="divider"> / </div>
<div class="active section" >贡献者&nbsp;({{totalNum}})</div>
<div class="active section" >{{$t('message.contributor')}} &nbsp;({{totalNum}})</div>
</div> </div>
</h3> </h3>
<div class="ui horizontal relaxed list"> <div class="ui horizontal relaxed list">
@@ -36,63 +36,83 @@
</div> </div>
</template> </template>


<script>
<script type="text/javascript">
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import locale from 'element-ui/lib/locale'


const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;
const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;


export default {
data() {
return {
url:'',
url_infor:'',
href_:'',
contributors_list:[],
contributors_list_page:[],
currentPage:1,
pageSize:50,
totalNum:0,
AppSubUrl:AppSubUrl
};
},
methods: {
export default {
data() {
return {
url:'',
url_infor:'',
href_:'',
contributors_list:[],
contributors_list_page:[],
currentPage:1,
pageSize:50,
totalNum:0,
AppSubUrl:AppSubUrl,
};
},
methods: {

getContributorsList(){
this.$axios.get(this.url+'/list?'+this.url_infor).then((res)=>{
this.contributors_list = res.data.contributor_info
this.totalNum = this.contributors_list.length
this.contributors_list_page = this.contributors_list.slice(0,this.pageSize)
})
},
handleCurrentChange(val){
this.contributors_list_page = this.contributors_list.slice((val-1)*this.pageSize,val*this.pageSize)
},


getContributorsList(){
this.$axios.get(this.url+'/list?'+this.url_infor).then((res)=>{
this.contributors_list = res.data.contributor_info
this.totalNum = this.contributors_list.length
this.contributors_list_page = this.contributors_list.slice(0,this.pageSize)
})
getLang(){
this.text_langName = document.getElementById("menutext_1").innerText
if (this.text_langName == '简体中文'){
this.$i18n.locale = 'zh'
locale.use(zhLocale)
}
else if (this.text_langName == 'English'){
this.$i18n.locale = 'en'
locale.use(enLocale)
}
}
}, },
handleCurrentChange(val){
this.contributors_list_page = this.contributors_list.slice((val-1)*this.pageSize,val*this.pageSize)
computed:{
}, },
},
computed:{
},
watch: {
watch: {


},
created(){
const url = window.location.pathname;
this.url = url;
let strIndex = this.url.indexOf("contributors")
this.url_code = this.url.substr(0,strIndex)
this.href_ = window.location.href;
let index = this.href_.indexOf("?")
this.url_infor = this.href_.substring(index+1,this.href_.length)
this.getContributorsList()
},
},
created(){
console.log(this)
const url = window.location.pathname;
this.url = url;
let strIndex = this.url.indexOf("contributors")
this.url_code = this.url.substr(0,strIndex)
this.href_ = window.location.href;
let index = this.href_.indexOf("?")
this.url_infor = this.href_.substring(index+1,this.href_.length)
this.getContributorsList()
this.text_langName=''
this.getLang()
},


updated(){
if(document.querySelectorAll('img[avatar]').length!==0){
window.LetterAvatar.transform()
updated(){
if(document.querySelectorAll('img[avatar]').length!==0){
window.LetterAvatar.transform()
}
},
mounted(){
this.getLang()
} }
}
}; };
</script> </script>




+ 21
- 5
web_src/js/components/EditTopics.vue View File

@@ -3,7 +3,7 @@
<div class="input-search"> <div class="input-search">
<el-input v-model="input" clearable :autofocus="true" @input="changeValue" id="topics_input" @keyup.enter.native="postTopic" placeholder="搜索或创建标签">
<el-input v-model="input" clearable :autofocus="true" @input="changeValue" id="topics_input" @keyup.enter.native="postTopic" placeholder="$t('message.search_or_create_tags')搜索或创建标签">


</el-input> </el-input>
<div class="scrolling-menu"> <div class="scrolling-menu">
@@ -14,7 +14,7 @@
<div class="text">{{arr.topic_name.toLowerCase()}} </div> <div class="text">{{arr.topic_name.toLowerCase()}} </div>
</div> </div>
<div v-if="showInputValue" class="addition item-text" @click="postTopic"> <div v-if="showInputValue" class="addition item-text" @click="postTopic">
点击或回车添加<b class="user-add-label-text">{{input.toLowerCase()}}</b>标签
{{$t('message.click_or_enter_to_add')}}点击或回车添加<b class="user-add-label-text">{{input.toLowerCase()}}</b>标签
</div> </div>
<div v-if="showAddTopic" class="item-text" @click="addPostTopic"> <div v-if="showAddTopic" class="item-text" @click="addPostTopic">
<div class="icon-wrapper"> <div class="icon-wrapper">
@@ -31,7 +31,9 @@
</template> </template>


<script> <script>

import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import locale from 'element-ui/lib/locale'
const {AppSubUrl, StaticUrlPrefix, csrf} = window.config; const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;


import $ from 'jquery' import $ from 'jquery'
@@ -342,6 +344,17 @@ export default {
window.event.cancelBubble = true;//兼容IE window.event.cancelBubble = true;//兼容IE
} }
} }
},
getLang(){
this.text_langName = document.getElementById("menutext_1").innerText
if (this.text_langName == '简体中文'){
this.$i18n.locale = 'zh'
locale.use(zhLocale)
}
else if (this.text_langName == 'English'){
this.$i18n.locale = 'en'
locale.use(enLocale)
}
} }
}, },
computed:{ computed:{
@@ -388,12 +401,15 @@ mounted() {
$('#repo-topics1').append('<span class="no-description text-italic">暂无标签</span>') $('#repo-topics1').append('<span class="no-description text-italic">暂无标签</span>')
} }
this.changeValue()
this.changeValue();
this.getLang()
} , } ,
created(){ created(){
this.initTopics(); this.initTopics();
this.input=''
this.input='';
this.text_langName='' ;
this.getLang()
} }
}; };


+ 40
- 26
web_src/js/components/Images.vue View File

@@ -3,18 +3,18 @@
<div class="header-wrapper"> <div class="header-wrapper">
<div class="ui container"> <div class="ui container">
<el-row class="image_text"> <el-row class="image_text">
<h1>云脑镜像</h1>
<h1>{{$t('message.cloud_brain_mirror')}}云脑镜像</h1>
</el-row> </el-row>
</div> </div>
</div> </div>
<div class="ui container" id="header"> <div class="ui container" id="header">
<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="公共镜像(云脑1)" name="first" v-loading="loading">
<el-tab-pane label="$t('message.cloud_brain_mirror')公共镜像(云脑1)" name="first" v-loading="loading">
<div class="ui sixteen wide column"> <div class="ui sixteen wide column">
<div class="ui two column stackable grid"> <div class="ui two column stackable grid">
<div class="column"> <div class="column">
<el-input placeholder="请输入镜像名称关健词" v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
<el-button id="success" slot="append" icon="el-icon-search" @click="searchName()">搜索</el-button>
<el-input placeholder="$t('message.enter_mirror_name_keyword')请输入镜像名称关健词" v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
<el-button id="success" slot="append" icon="el-icon-search" @click="searchName()">{{$t('message.search')}}搜索</el-button>
</el-input> </el-input>
</div> </div>


@@ -42,7 +42,7 @@
:header-cell-style="tableHeaderStyle" :header-cell-style="tableHeaderStyle"
:default-sort="{prop:'createtime',order:'descending'}"> :default-sort="{prop:'createtime',order:'descending'}">
<el-table-column <el-table-column
label="镜像名称"
label="$t('message.mirror_name')镜像名称"
width="350" width="350"
align="left" align="left"
prop="name" prop="name"
@@ -53,12 +53,12 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="文件路径/镜像描述"
label="$t('message.file_path_image_description')文件路径/镜像描述"
width="450" width="450"
align="left" align="left"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-tooltip class="item" effect="dark" content="点击复制文件路径" placement="top">
<el-tooltip class="item" effect="dark" content="$t('message.click_Copy_file_path')点击复制文件路径" placement="top">
<a class="text-over" style="display:block;" @click="copyUrl(scope.row.place)">{{ scope.row.place }}</a> <a class="text-over" style="display:block;" @click="copyUrl(scope.row.place)">{{ scope.row.place }}</a>
</el-tooltip> </el-tooltip>
@@ -67,14 +67,14 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="provider" prop="provider"
label="提供者"
label="$t('message.provider')提供者"
width="120" width="120"
align="left" align="left"
sortable> sortable>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="createtime" prop="createtime"
label="创建时间"
label="$t('message.creation_time')创建时间"
align="center" align="center"
sortable> sortable>
<template slot-scope="scope"> <template slot-scope="scope">
@@ -98,12 +98,12 @@
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="自定义镜像(云脑1)" name="second" v-loading="loading1">
<el-tab-pane label="$t('message.custom_mirror_1')自定义镜像(云脑1)" name="second" v-loading="loading1">
<div class="ui sixteen wide column"> <div class="ui sixteen wide column">
<div class="ui two column stackable grid"> <div class="ui two column stackable grid">
<div class="column"> <div class="column">
<el-input placeholder="请输入镜像名称关健词" v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
<el-button slot="append" id="success" icon="el-icon-search" @click="searchName()">搜索</el-button>
<el-input placeholder="$t('message.enter_mirror_name_keyword')请输入镜像名称关健词" v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
<el-button slot="append" id="success" icon="el-icon-search" @click="searchName()">{{$t('message.search')}}搜索</el-button>
</el-input> </el-input>
</div> </div>


@@ -133,7 +133,7 @@
:header-cell-style="tableHeaderStyle" :header-cell-style="tableHeaderStyle"
:default-sort="{prop:'createtime',order:'descending'}"> :default-sort="{prop:'createtime',order:'descending'}">
<el-table-column <el-table-column
label="镜像名称"
label="$t('message.mirror_name')镜像名称"
width="350" width="350"
align="left" align="left"
prop="name" prop="name"
@@ -144,13 +144,13 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="文件路径/镜像描述"
label="$t('message.file_path_mirror_description')文件路径/镜像描述"
width="450" width="450"
align="left" align="left"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-tooltip class="item" effect="dark" content="点击复制文件路径" placement="top">
<el-tooltip class="item" effect="dark" content="$t('message.click_Copy_file_path')点击复制文件路径" placement="top">
<a class="text-over" style="display:block;" @click="copyUrl(scope.row.place)">{{ scope.row.place }}</a> <a class="text-over" style="display:block;" @click="copyUrl(scope.row.place)">{{ scope.row.place }}</a>
</el-tooltip> </el-tooltip>
@@ -159,14 +159,14 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="provider" prop="provider"
label="提供者"
label="$t('message.provider')提供者"
width="120" width="120"
align="left" align="left"
sortable> sortable>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="createtime" prop="createtime"
label="创建时间"
label="$t('message.creation_time')创建时间"
align="center" align="center"
sortable> sortable>
<template slot-scope="scope"> <template slot-scope="scope">
@@ -190,13 +190,13 @@


</el-tab-pane> </el-tab-pane>
<el-tab-pane label="公共镜像(云脑2)" name="third">
<el-tab-pane label="$t('message.public_mirror_2')公共镜像(云脑2)" name="third">
<div class="ui sixteen wide column"> <div class="ui sixteen wide column">
<div class="ui two column stackable grid"> <div class="ui two column stackable grid">
<div class="column"> <div class="column">
<el-input placeholder="请输入镜像名称关健词" v-model="search" class="input-with-select">
<el-button slot="append" id="success" icon="el-icon-search">搜索</el-button>
<el-input placeholder="$t('message.enter_mirror_name_keyword')请输入镜像名称关健词" v-model="search" class="input-with-select">
<el-button slot="append" id="success" icon="el-icon-search">{{$t('message.search')}}搜索</el-button>
</el-input> </el-input>
</div> </div>


@@ -220,13 +220,13 @@


<el-empty :image-size="200"></el-empty> <el-empty :image-size="200"></el-empty>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="自定义镜像(云脑2)" name="fourth">
<el-tab-pane label="$t('message.custom_mirror_2')自定义镜像(云脑2)" name="fourth">
<div class="ui sixteen wide column"> <div class="ui sixteen wide column">
<div class="ui two column stackable grid"> <div class="ui two column stackable grid">
<div class="column"> <div class="column">
<el-input placeholder="请输入镜像名称关健词" v-model="search" class="input-with-select">
<el-button slot="append" id="success" icon="el-icon-search">搜索</el-button>
<el-input placeholder="$t('message.enter_mirror_name_keyword')请输入镜像名称关健词" v-model="search" class="input-with-select">
<el-button slot="append" id="success" icon="el-icon-search">{{$t('message.search')}}搜索</el-button>
</el-input> </el-input>
</div> </div>


@@ -283,7 +283,8 @@ export default {
totalNum1:0, totalNum1:0,
params1:{page:1,size:10,name:''}, params1:{page:1,size:10,name:''},
tableData1: [], tableData1: [],
loading1:false
loading1:false,
text_langName:'',
}; };
}, },
methods: { methods: {
@@ -369,6 +370,17 @@ export default {
this.getImageList1() this.getImageList1()
} }
},
getLang(){
this.text_langName = document.getElementById("menutext_1").innerText
if (this.text_langName == '简体中文'){
this.$i18n.locale = 'zh'
locale.use(zhLocale)
}
else if (this.text_langName == 'English'){
this.$i18n.locale = 'en'
locale.use(enLocale)
}
} }


}, },
@@ -414,10 +426,12 @@ export default {


}, },
mounted() { mounted() {
this.getImageList()
this.getImageList(),
this.getLang()
}, },
created() { created() {
this.text_langName='',
this.getLang()
} }


}; };


+ 19
- 15
web_src/js/components/MinioUploader.vue View File

@@ -17,6 +17,10 @@
</template> </template>


<script> <script>

import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import locale from 'element-ui/lib/locale'
/* eslint-disable eqeqeq */ /* eslint-disable eqeqeq */
// import Dropzone from 'dropzone/dist/dropzone.js'; // import Dropzone from 'dropzone/dist/dropzone.js';
// import 'dropzone/dist/dropzone.css' // import 'dropzone/dist/dropzone.css'
@@ -221,11 +225,11 @@ export default {
} }


const md5 = spark.end(); const md5 = spark.end();
console.log(
`MD5计算完成:${file.name} \nMD5:${md5} \n分片:${chunks} 大小:${
file.size
} 用时:${(new Date().getTime() - time) / 1000} s`
);
// console.log(
// `MD5计算完成:${file.name} \nMD5:${md5} \n分片:${chunks} 大小:${
// file.size
// } 用时:${(new Date().getTime() - time) / 1000} s`
// );
spark.destroy(); // 释放缓存 spark.destroy(); // 释放缓存
file.uniqueIdentifier = md5; // 将文件md5赋值给文件唯一标识 file.uniqueIdentifier = md5; // 将文件md5赋值给文件唯一标识
file.cmd5 = false; // 取消计算md5状态 file.cmd5 = false; // 取消计算md5状态
@@ -481,7 +485,7 @@ export default {
} }
const urls = []; // TODO const ? const urls = []; // TODO const ?
const etags = []; const etags = [];
console.log('上传分片...');
// console.log('上传分片...');
this.status = this.dropzoneParams.data('uploading'); this.status = this.dropzoneParams.data('uploading');
loadNext(); loadNext();
fileReader.onload = async (e) => { fileReader.onload = async (e) => {
@@ -489,10 +493,10 @@ export default {
fileReader.abort(); fileReader.abort();
currentChunk++; currentChunk++;
if (currentChunk < chunks) { if (currentChunk < chunks) {
console.log(
`第${currentChunk}个分片上传完成, 开始第${currentChunk +
1}/${chunks}个分片上传`
);
// console.log(
// `第${currentChunk}个分片上传完成, 开始第${currentChunk +
// 1}/${chunks}个分片上传`
// );
this.progress = Math.ceil((currentChunk / chunks) * 100); this.progress = Math.ceil((currentChunk / chunks) * 100);
console.log("((currentChunk / chunks) * 100).toFixed(2)",((currentChunk / chunks) * 100).toFixed(2)) console.log("((currentChunk / chunks) * 100).toFixed(2)",((currentChunk / chunks) * 100).toFixed(2))
this.updateProgress(file, ((currentChunk / chunks) * 100).toFixed(2)); this.updateProgress(file, ((currentChunk / chunks) * 100).toFixed(2));
@@ -503,11 +507,11 @@ export default {
await loadNext(); await loadNext();
} else { } else {
await completeUpload(); await completeUpload();
console.log(
`文件上传完成:${file.name} \n分片:${chunks} 大小:${
file.size
} 用时:${(new Date().getTime() - time) / 1000} s`
);
// console.log(
// `文件上传完成:${file.name} \n分片:${chunks} 大小:${
// file.size
// } 用时:${(new Date().getTime() - time) / 1000} s`
// );
this.updateProgress(file, 100); this.updateProgress(file, 100);
this.progress = 100; this.progress = 100;
this.status = this.dropzoneParams.data('upload-complete'); this.status = this.dropzoneParams.data('upload-complete');


+ 38
- 0
web_src/js/components/i18n/lang/en.js View File

@@ -0,0 +1,38 @@
import enLocale from 'element-ui/lib/locale/lang/en'

const en = {
message: {
code: 'code',
contributor:'Contributor',
introduction: 'Introduction',
edit_repository_information: 'Edit repository information',
please_enter_content: 'Please enter content',
home: 'Home',
search_or_create_tags: 'Search or create tags',
click_or_enter_to_add: 'Click or enter to add',
label: 'Label',
No_label_yet: 'No label yet',
cloud_brain_mirror: 'Cloud Brain Mirror',
public_mirror_1: 'Public mirror (Cloud Brain 1)',
enter_mirror_name_keyword: 'Please enter the image name keyword',
search: 'Search',
mirror_name: 'Mirror Name',
file_path_mirror_description: 'File Path / Mirror Description',
click_Copy_file_path: 'Click Copy File Path',
provider: 'Provider',
creation_time: 'Creation Time',
custom_mirror_1: 'Custom Mirror (Cloud Brain 1)',
public_mirror_2: 'Public Mirror (Cloud Brain 2)',
custom_mirror_1: 'Custom Mirror (Cloud Brain 2)'






},
...enLocale
}

export default en;

+ 34
- 0
web_src/js/components/i18n/lang/zh.js View File

@@ -0,0 +1,34 @@
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'

const zh = {
message: {
code: '代码',
contributor: '贡献者',
introduction: '简介',
edit_repository_information: '编辑仓库信息',
please_enter_content: '请输入内容',
home: '主页',
search_or_create_tags:'搜索或创建标签',
click_or_enter_to_add: '点击或回车添加',
label: '标签',
No_label_yet: '暂无标签',
cloud_brain_mirror: '云脑镜像',
public_mirror_1: '公共镜像(云脑1)',
enter_mirror_name_keyword: '请输入镜像名称关健词',
search: '搜索',
mirror_name: '镜像名称',
file_path_mirror_description: '文件路径/镜像描述',
click_Copy_file_path: '点击复制文件路径',
provider: '提供者',
creation_time: '创建时间',
custom_mirror_1: '自定义镜像(云脑1)',
public_mirror_2: '公共镜像(云脑2)',
custom_mirror_2: '自定义镜像(云脑2)'



},
...zhLocale
}

export default zh

+ 39
- 4
web_src/js/index.js View File

@@ -7,7 +7,8 @@ import './polyfills.js';
import './features/letteravatar.js' import './features/letteravatar.js'
import Vue from 'vue'; import Vue from 'vue';
import ElementUI from 'element-ui'; import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import 'element-ui/lib/theme-chalk/index.css';
import VueI18n from 'vue-i18n'
import axios from 'axios'; import axios from 'axios';
import qs from 'qs'; import qs from 'qs';
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
@@ -45,12 +46,37 @@ import WxAutorize from './components/WxAutorize.vue'
import initCloudrain from './features/cloudrbanin.js' import initCloudrain from './features/cloudrbanin.js'
// import $ from 'jquery.js' // import $ from 'jquery.js'


//import VueI18n from 'vue-i18n'
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import locale from 'element-ui/lib/locale'

import Element from 'element-ui'
import cn from './components/i18n/lang/zh.js'
import en from './components/i18n/lang/en.js'
Vue.use(ElementUI); Vue.use(ElementUI);
Vue.prototype.$axios = axios; Vue.prototype.$axios = axios;
Vue.prototype.$Cookies = Cookies; Vue.prototype.$Cookies = Cookies;
Vue.prototype.qs = qs; Vue.prototype.qs = qs;
const {AppSubUrl, StaticUrlPrefix, csrf} = window.config; const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;





Vue.use(VueI18n)
const messages = {
en: en,
zh: cn,
}
// Create VueI18n instance with options
const i18n = new VueI18n({
locale: 'zh', // set locale
messages, // set locale messages
})
Vue.use(Element, {
i18n: (key, value) => i18n.t(key, value)
})

Object.defineProperty(Vue.prototype, '$echarts', { Object.defineProperty(Vue.prototype, '$echarts', {
value: echarts value: echarts
}) })
@@ -3596,6 +3622,7 @@ function initVueApp() {
new Vue({ new Vue({
delimiters: ['${', '}'], delimiters: ['${', '}'],
el, el,
i18n,
data: { data: {
page:parseInt(new URLSearchParams(window.location.search).get('page')), page:parseInt(new URLSearchParams(window.location.search).get('page')),
searchLimit: Number( searchLimit: Number(
@@ -3641,6 +3668,7 @@ function initVueUploader() {


new Vue({ new Vue({
el: '#minioUploader', el: '#minioUploader',
i18n,
components: {MinioUploader}, components: {MinioUploader},
template: '<MinioUploader />' template: '<MinioUploader />'
}); });
@@ -3655,6 +3683,7 @@ function initVueEditAbout() {


new Vue({ new Vue({
el: '#about-desc', el: '#about-desc',
i18n,
render: h => h(EditAboutInfo) render: h => h(EditAboutInfo)
}); });
} }
@@ -3732,6 +3761,7 @@ function initVueDataset() {
new Vue({ new Vue({
delimiters: ['${', '}'], delimiters: ['${', '}'],
el, el,
i18n,
data: { data: {
suburl: AppSubUrl, suburl: AppSubUrl,
url:'', url:'',
@@ -4257,6 +4287,7 @@ function initVueEditTopic() {
new Vue({ new Vue({
el:'#topic_edit1', el:'#topic_edit1',
i18n,
render:h=>h(EditTopics) render:h=>h(EditTopics)
}) })
} }
@@ -4270,6 +4301,7 @@ function initVueContributors() {


new Vue({ new Vue({
el:'#Contributors', el:'#Contributors',
i18n,
render:h=>h(Contributors) render:h=>h(Contributors)
}) })
} }
@@ -4285,7 +4317,7 @@ function initVueImages() {


new Vue({ new Vue({
el: '#images', el: '#images',
i18n,
render: h => h(Images) render: h => h(Images)
}); });
} }
@@ -4299,7 +4331,7 @@ function initVueModel() {


new Vue({ new Vue({
el: el, el: el,
i18n,
render: h => h(Model) render: h => h(Model)
}); });
} }
@@ -4311,7 +4343,7 @@ function initVueDataAnalysis() {


new Vue({ new Vue({
el: '#data_analysis', el: '#data_analysis',
i18n,
render: h => h(DataAnalysis) render: h => h(DataAnalysis)
}); });
} }
@@ -4324,6 +4356,7 @@ function initObsUploader() {


new Vue({ new Vue({
el: '#obsUploader', el: '#obsUploader',
i18n,
components: {ObsUploader}, components: {ObsUploader},
template: '<ObsUploader />' template: '<ObsUploader />'
}); });
@@ -4335,6 +4368,7 @@ function initVueWxAutorize() {
} }
new Vue({ new Vue({
el:el, el:el,
i18n,
render: h => h(WxAutorize) render: h => h(WxAutorize)
}); });
} }
@@ -4383,6 +4417,7 @@ function initFilterBranchTagDropdown(selector) {
new Vue({ new Vue({
delimiters: ['${', '}'], delimiters: ['${', '}'],
el: this, el: this,
i18n,
data, data,


beforeMount() { beforeMount() {


Loading…
Cancel
Save