Skip to content

Commit

Permalink
feat: 国际化
Browse files Browse the repository at this point in the history
  • Loading branch information
yang1206 committed Jun 13, 2023
1 parent 80494b3 commit 17166d9
Show file tree
Hide file tree
Showing 25 changed files with 599 additions and 750 deletions.
115 changes: 16 additions & 99 deletions .gitignore
Expand Up @@ -4,105 +4,22 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
stats.html

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
# typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
# .env
# .env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

.turbo

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
node_modules
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
packages/admin-vue/stats.html
packages/client/public/sw.js.map
locale
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
9 changes: 4 additions & 5 deletions example/src/main.ts
@@ -1,16 +1,15 @@
import { createSSRApp } from 'vue'

import { Locale } from 'uniapp-nutui'

// import EnUSLang from 'uniapp-nutui/components/_locale/lang/en-US'
import { Locale } from 'uniapp-nutui/locale'
import App from './App.vue'
import { setupStore } from './store'
import './styles/app.scss'

Locale.merge('zh-CN', {
// Locale.use('id-id', IdIDLang())
Locale.merge({
confirm: '官博内心',
})
// Locale.use('en-US', EnUSLang)

export function createApp() {
const app = createSSRApp(App)
setupStore(app)
Expand Down
24 changes: 0 additions & 24 deletions packages/nutui/.gitignore

This file was deleted.

File renamed without changes.
2 changes: 2 additions & 0 deletions packages/nutui/_locale/index.ts
@@ -0,0 +1,2 @@
export * from './locale'
export * from './useTranslate'
@@ -1,109 +1,111 @@
export abstract class BaseLang {
abstract save: string
abstract confirm: string
abstract cancel: string
abstract done: string
abstract noData: string
abstract placeholder: string
abstract select: string
abstract video: {
export interface BaseLang {
save: string
confirm: string
cancel: string
done: string
noData: string
placeholder: string
select: string
video: {
errorTip: string
clickRetry: string
}

abstract fixednav: {
fixednav: {
activeText: string
unActiveText: string
}

abstract pagination: {
pagination: {
prev: string
next: string
}

abstract calendaritem: {
calendaritem: {
weekdays: Array<string>
end: string
start: string
title: string
monthTitle: Function
today: string
}

abstract shortpassword: {
shortpassword: {
title: string
desc: string
tips: string
}

abstract uploader: {
uploader: {
ready: string
readyUpload: string
waitingUpload: string
uploading: string
success: string
error: string
}

abstract countdown: {
countdown: {
day: string
hour: string
minute: string
second: string
}

abstract address: {
address: {
selectRegion: string
deliveryTo: string
chooseAnotherAddress: string
}

abstract signature: {
signature: {
reSign: string
unSupportTpl: string
}

abstract ecard: {
ecard: {
chooseText: string
otherValueText: string
placeholder: string
}

abstract timeselect: {
timeselect: {
pickupTime: string
}

abstract sku: {
sku: {
buyNow: string
buyNumber: string
addToCart: string
}

abstract skuheader: {
skuheader: {
skuId: string
}

abstract addresslist: {
addresslist: {
addAddress: string
default: string
}

abstract comment: {
comment: {
complaintsText: string
additionalReview: Function
additionalImages: Function
}

abstract infiniteloading: {
infiniteloading: {
loading: string
pullTxt: string
loadMoreTxt: string
}

abstract pullrefresh: {
datepicker: {
year: string
month: string
day: string
hour: string
min: string
seconds: string
}
audiooperate: {
back: string
start: string
pause: string
forward: string
mute: string
}
pullrefresh: {
pulling: string
loosing: string
loading: string
}
}
export default BaseLang

export function defineLocaleConfig(locale: BaseLang) {
return locale
}

0 comments on commit 17166d9

Please sign in to comment.