Browse Source

feat: 应用增加英文翻译

pull/147/head
zhengkunwang223 2 years ago committed by zhengkunwang223
parent
commit
5ef011b619
  1. 3
      Makefile
  2. 3
      backend/app/dto/app.go
  3. 3
      backend/app/model/app.go
  4. 4
      backend/app/service/app.go
  5. 3
      backend/app/service/app_utils.go
  6. 3
      backend/init/business/business.go
  7. 1
      cmd/server/main.go
  8. 3
      frontend/src/api/interface/app.ts
  9. 9
      frontend/src/views/app-store/apps/index.vue
  10. 5
      frontend/src/views/app-store/detail/index.vue
  11. 4
      frontend/src/views/home/app/index.vue

3
Makefile

@ -4,6 +4,9 @@ GOCLEAN=$(GOCMD) clean
GOARCH=amd64
GOOS=linux
GOARCH=$(shell go env GOARCH)
GOOS=$(shell go env GOOS )
BASE_PAH := $(shell pwd)
BUILD_PATH = $(BASE_PAH)/build
WEB_PATH=$(BASE_PAH)/frontend

3
backend/app/dto/app.go

@ -42,7 +42,8 @@ type AppDefine struct {
Name string `json:"name"`
Tags []string `json:"tags"`
Versions []string `json:"versions"`
ShortDesc string `json:"shortDesc"`
ShortDescZh string `json:"shortDescZh"`
ShortDescEn string `json:"shortDescEn"`
Type string `json:"type"`
Required []string `json:"Required"`
CrossVersionUpdate bool `json:"crossVersionUpdate"`

3
backend/app/model/app.go

@ -4,7 +4,8 @@ type App struct {
BaseModel
Name string `json:"name" gorm:"type:varchar(64);not null"`
Key string `json:"key" gorm:"type:varchar(64);not null;uniqueIndex"`
ShortDesc string `json:"shortDesc" gorm:"type:longtext;"`
ShortDescZh string `json:"shortDescZh" gorm:"type:longtext;"`
ShortDescEn string `json:"shortDescEn" gorm:"type:longtext;"`
Icon string `json:"icon" gorm:"type:longtext;"`
Type string `json:"type" gorm:"type:varchar(64);not null"`
Status string `json:"status" gorm:"type:varchar(64);not null"`

4
backend/app/service/app.go

@ -359,12 +359,12 @@ func (a AppService) GetAppUpdate() (*response.AppUpdateRes, error) {
return nil, err
}
res.Version = list.Version
if common.CompareVersion(list.Version, setting.AppStoreVersion) {
if setting.AppStoreVersion == "" || common.CompareVersion(list.Version, setting.AppStoreVersion) {
res.CanUpdate = true
res.DownloadPath = fmt.Sprintf("%s/%s/%s/appstore/apps-%s.tar.gz", global.CONF.System.RepoUrl, global.CONF.System.Mode, setting.SystemVersion, list.Version)
return res, err
}
return nil, err
return res, nil
}
func (a AppService) SyncAppList() error {

3
backend/app/service/app_utils.go

@ -474,7 +474,8 @@ func getApps(oldApps []model.App, items []dto.AppDefine) map[string]model.App {
app.Name = item.Name
app.Limit = item.Limit
app.Key = item.Key
app.ShortDesc = item.ShortDesc
app.ShortDescZh = item.ShortDescZh
app.ShortDescEn = item.ShortDescEn
app.Website = item.Website
app.Document = item.Document
app.Github = item.Github

3
backend/init/business/business.go

@ -3,7 +3,6 @@ package business
import (
"github.com/1Panel-dev/1Panel/backend/app/service"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/common"
)
func Init() {
@ -11,7 +10,7 @@ func Init() {
if err != nil {
global.LOG.Errorf("sync app error: %s", err.Error())
}
if common.CompareVersion(setting.AppStoreVersion, "0.0") {
if setting.AppStoreVersion != "" {
return
}
if err := service.NewIAppService().SyncAppList(); err != nil {

1
cmd/server/main.go

@ -6,6 +6,7 @@ import (
"github.com/1Panel-dev/1Panel/cmd/server/cmd"
_ "github.com/1Panel-dev/1Panel/cmd/server/docs"
_ "net/http/pprof"
)
// @title 1Panel

3
frontend/src/api/interface/app.ts

@ -6,7 +6,8 @@ export namespace App {
icon: string;
key: string;
tags: Tag[];
shortDesc: string;
shortDescZh: string;
shortDescEn: string;
author: string;
source: string;
type: string;

9
frontend/src/views/app-store/apps/index.vue

@ -20,7 +20,7 @@
:type="activeTag === item.key ? 'primary' : ''"
:plain="activeTag !== item.key"
>
{{ item.name }}
{{ language == 'zh' ? item.name : item.key }}
</el-button>
</div>
</el-col>
@ -71,12 +71,12 @@
</div>
<div class="app-desc">
<span class="desc">
{{ app.shortDesc }}
{{ language == 'zh' ? app.shortDescZh : app.shortDescEn }}
</span>
</div>
<div class="app-tag">
<el-tag v-for="(tag, ind) in app.tags" :key="ind" :colr="getColor(ind)">
{{ tag.name }}
{{ language == 'zh' ? tag.name : tag.key }}
</el-tag>
</div>
<div class="divider"></div>
@ -100,6 +100,9 @@ import i18n from '@/lang';
import Detail from '../detail/index.vue';
import router from '@/routers';
import { MsgSuccess } from '@/utils/message';
import { useI18n } from 'vue-i18n';
const language = useI18n().locale.value;
let req = reactive({
name: '',

5
frontend/src/views/app-store/detail/index.vue

@ -15,7 +15,7 @@
</div>
<div class="description">
<span>
{{ app.shortDesc }}
{{ language == 'zh' ? app.shortDescZh : app.shortDescEn }}
</span>
</div>
<div class="version">
@ -94,10 +94,11 @@
import { GetApp, GetAppDetail } from '@/api/modules/app';
import LayoutContent from '@/layout/layout-content.vue';
import { onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import Install from './install/index.vue';
const language = useI18n().locale.value;
interface OperateProps {
// id: number;
appKey: string;
}

4
frontend/src/views/home/app/index.vue

@ -15,7 +15,7 @@
</div>
<div class="h-app-desc">
<span>
{{ app.shortDesc }}
{{ language == 'zh' ? app.shortDescZh : app.shortDescEn }}
</span>
</div>
</div>
@ -43,8 +43,10 @@ import { App } from '@/api/interface/app';
import { Dashboard } from '@/api/interface/dashboard';
import { SearchApp } from '@/api/modules/app';
import { reactive, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
const router = useRouter();
const language = useI18n().locale.value;
let req = reactive({
name: '',

Loading…
Cancel
Save