-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from zhangfisher/3.0
3.0
- Loading branch information
Showing
81 changed files
with
6,972 additions
and
24,590 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,8 @@ | |
"sync": "cnpm sync @voerkai18n/cli @voerkai18n/runtime @voerkai18n/vue @voerkai18n/openinula @voerkai18n/vite @voerkai18n/react @voerkai18n/utils @voerkai18n/vue2 @voerkai18n/babel voerkai18n-loader", | ||
"docs:dev": "vitepress dev docs", | ||
"docs:build": "vitepress build docs", | ||
"docs:preview": "vitepress preview docs" | ||
"docs:preview": "vitepress preview docs", | ||
"lint": "oxlint -c .oxlintrc.json" | ||
}, | ||
"author": "[email protected]", | ||
"license": "MIT", | ||
|
@@ -29,17 +30,15 @@ | |
"cross-env": "^7.0.3", | ||
"dayjs": "^1.11.4", | ||
"deepmerge": "^4.2.2", | ||
"docsify": "^4.13.0", | ||
"fs-extra": "^10.1.0", | ||
"gulp": "^4.0.2", | ||
"jest": "^27.5.1", | ||
"logsets": "^1.3.1", | ||
"oxlint": "^0.15.3", | ||
"pnpm": "^7.9.0", | ||
"prettier": "^2.7.1", | ||
"semver": "^7.5.4", | ||
"shelljs": "^0.8.5", | ||
"turbo": "^2.1.2", | ||
"vinyl": "^2.2.1", | ||
"vitepress": "^1.5.0", | ||
"yalc": "1.0.0-pre.53", | ||
"yorkie": "^2.0.0" | ||
|
@@ -48,7 +47,7 @@ | |
"tips": "请安装JsonComments插件,详见https://github.com/zhangfisher/json_comments_extension", | ||
"package.json": { | ||
"scripts.test:runtime": "运行@voerkai18n/runtime单元测试", | ||
"scripts.build:all": "构建所有包", | ||
"scripts.build:all": "构建所有包", | ||
"scripts.changeset": "当更新后执行以更新变更历史", | ||
"scripts.sync": "同步淘宝镜像", | ||
"scripts.release:all": "一健自动化发布所有包" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const ISO639 = require("iso-639-1-zh"); | ||
const fs = require("fs"); | ||
|
||
console.log(ISO639.getAllCodes()) // '中文' | ||
|
||
|
||
const langTypes = [] | ||
|
||
fs.writeFileSync("lngTypes",ISO639.getAllCodes().join("' | '")) | ||
|
||
console.log(ISO639.getZhName('zh')) // '中文' | ||
console.log(ISO639.getZhName('es')) // '西班牙语' | ||
console.log(ISO639.getLanguages(['en', 'es'])) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
type LanguageCodes = 'aa' | 'ab' | 'ae' | 'af' | 'ak' | 'am' | 'an' | 'ar' | 'as' | 'av' | 'ay' | 'az' | ||
| 'ba' | 'be' | 'bg' | 'bh' | 'bi' | 'bm' | 'bn' | 'bo' | 'br' | 'bs' | ||
| 'ca' | 'ce' | 'ch' | 'co' | 'cr' | 'cs' | 'cu' | 'cv' | 'cy' | ||
| 'da' | 'de' | 'dv' | 'dz' | ||
| 'ee' | 'el' | 'en' | 'eo' | 'es' | 'et' | 'eu' | ||
| 'fa' | 'ff' | 'fi' | 'fj' | 'fo' | 'fr' | 'fy' | ||
| 'ga' | 'gd' | 'gl' | 'gn' | 'gu' | 'gv' | ||
| 'ha' | 'he' | 'hi' | 'ho' | 'hr' | 'ht' | 'hu' | 'hy' | 'hz' | ||
| 'ia' | 'id' | 'ie' | 'ig' | 'ii' | 'ik' | 'io' | 'is' | 'it' | 'iu' | ||
| 'ja' | 'jv' | ||
| 'ka' | 'kg' | 'ki' | 'kj' | 'kk' | 'kl' | 'km' | 'kn' | 'ko' | 'kr' | 'ks' | 'ku' | 'kv' | 'kw' | 'ky' | ||
| 'la' | 'lb' | 'lg' | 'li' | 'ln' | 'lo' | 'lt' | 'lu' | 'lv' | ||
| 'mg' | 'mh' | 'mi' | 'mk' | 'ml' | 'mn' | 'mr' | 'ms' | 'mt' | 'my' | ||
| 'na' | 'nb' | 'nd' | 'ne' | 'ng' | 'nl' | 'nn' | 'no' | 'nr' | 'nv' | 'ny' | ||
| 'oc' | 'oj' | 'om' | 'or' | 'os' | ||
| 'pa' | 'pi' | 'pl' | 'ps' | 'pt' | ||
| 'qu' | ||
| 'rm' | 'rn' | 'ro' | 'ru' | 'rw' | ||
| 'sa' | 'sc' | 'sd' | 'se' | 'sg' | 'si' | 'sk' | 'sl' | 'sm' | 'sn' | 'so' | 'sq' | 'sr' | 'ss' | 'st' | 'su' | 'sv' | 'sw' | ||
| 'ta' | 'te' | 'tg' | 'th' | 'ti' | 'tk' | 'tl' | 'tn' | 'to' | 'tr' | 'ts' | 'tt' | 'tw' | 'ty' | ||
| 'ug' | 'uk' | 'ur' | 'uz' | ||
| 've' | 'vi' | 'vo' | ||
| 'wa' | 'wo' | ||
| 'xh' | ||
| 'yi' | 'yo' | ||
| 'za' | 'zh' | 'zu' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["aa","ab","ae","af","ak","am","an","ar","as","av","ay","az","ba","be","bg","bi","bm","bn","bo","br","bs","ca","ce","ch","co","cr","cs","cu","cv","cy","da","de","dv","dz","ee","el","en","eo","es","et","eu","fa","ff","fi","fj","fo","fr","fy","ga","gd","gl","gn","gu","gv","ha","he","hi","ho","hr","ht","hu","hy","hz","ia","id","ie","ig","ii","ik","io","is","it","iu","ja","jv","ka","kg","ki","kj","kk","kl","km","kn","ko","kr","ks","ku","kv","kw","ky","la","lb","lg","li","ln","lo","lt","lu","lv","mg","mh","mi","mk","ml","mn","mr","ms","mt","my","na","nb","nd","ne","ng","nl","nn","no","nr","nv","ny","oc","oj","om","or","os","pa","pi","pl","ps","pt","qu","rm","rn","ro","ru","rw","sa","sc","sd","se","sg","si","sk","sl","sm","sn","so","sq","sr","ss","st","su","sv","sw","ta","te","tg","th","ti","tk","tl","tn","to","tr","ts","tt","tw","ty","ug","uk","ur","uz","ve","vi","vo","wa","wo","xh","yi","yo","za","zh","zu"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { VoerkaI18nLanguageLoader } from '@/types' | ||
import { VoerkaI18nScope, VoerkaI18nScopeOptions } from '../scope' | ||
import { VoerkaI18nManager } from "@/manager" | ||
|
||
|
||
export function createVoerkaI18nScope(opts?:Partial<VoerkaI18nScopeOptions>): VoerkaI18nScope { | ||
return new VoerkaI18nScope(Object.assign({ | ||
id: 'test-scope', | ||
debug: false, | ||
library: false, | ||
languages: { | ||
zh: { name: 'Chinese', title: '中文', fallback: 'en', active: true,default: true }, | ||
en: { name: 'English', title: 'English'} | ||
}, | ||
fallback: "en", | ||
messages: { | ||
en: { message: 'Hello' }, | ||
zh: { message: '你好' } | ||
}, | ||
idMap: {}, | ||
storage: undefined, | ||
formatters: {}, | ||
ready: () => {}, | ||
}, opts)) | ||
} | ||
|
||
|
||
export function resetVoerkaI18n() { | ||
try{ | ||
|
||
if(globalThis.VoerkaI18n){ | ||
globalThis.VoerkaI18n.clearLanguage() | ||
} | ||
|
||
// @ts-ignore | ||
delete globalThis.__VoerkaI18nScopes__ | ||
// @ts-ignore | ||
delete globalThis.VoerkaI18n | ||
VoerkaI18nManager.instance = undefined | ||
|
||
}catch{} | ||
} | ||
|
||
|
||
export function getTestStorage(init?:string){ | ||
let saveLanguage:string | undefined= init | ||
return { | ||
get() { return saveLanguage}, | ||
set(_:string,value:string){saveLanguage = value}, | ||
remove(){ saveLanguage = undefined } | ||
} | ||
|
||
} | ||
|
||
|
||
export function getTestLanguageLoader(patchMsgs?:Record<string,any>):VoerkaI18nLanguageLoader{ | ||
return async (language:string,scope:VoerkaI18nScope)=>{ | ||
return Object.assign({},patchMsgs) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.