File tree Expand file tree Collapse file tree 3 files changed +95
-3
lines changed Expand file tree Collapse file tree 3 files changed +95
-3
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 1+ {
2+ "projectName" : {
3+ "message" : " 請輸入專案名稱:"
4+ },
5+ "shouldOverwrite" : {
6+ "dirForPrompts" : {
7+ "current" : " 當前資料夾" ,
8+ "target" : " 目標資料夾:"
9+ },
10+ "message" : " 非空,是否覆蓋?"
11+ },
12+ "packageName" : {
13+ "message" : " 請輸入套件名稱:" ,
14+ "invalidMessage" : " 無效的 package.json 名稱"
15+ },
16+ "needsTypeScript" : {
17+ "message" : " 是否使用 TypeScript 語法?"
18+ },
19+ "needsJsx" : {
20+ "message" : " 是否啟用 JSX 支援?"
21+ },
22+ "needsRouter" : {
23+ "message" : " 是否引入 Vue Router 進行單頁應用開發?"
24+ },
25+ "needsPinia" : {
26+ "message" : " 是否引入 Pinia 用於狀態管理?"
27+ },
28+ "needsVitest" : {
29+ "message" : " 是否引入 Vitest 用於單元測試"
30+ },
31+ "needsE2eTesting" : {
32+ "message" : " 是否要引入一款端對端(End to End)測試工具?" ,
33+ "hint" : " - 使用箭頭切換按 Enter 確認。" ,
34+ "selectOptions" : {
35+ "negative" : {
36+ "title" : " 不需要"
37+ },
38+ "cypress" : {
39+ "title" : " Cypress" ,
40+ "desc" : " 同時支援基於 Cypress Component Testing 的單元測試"
41+ },
42+ "nightwatch" : {
43+ "title" : " Nightwatch" ,
44+ "desc" : " 同時支援基於 Nightwatch Component Testing 的單元測試"
45+ },
46+ "playwright" : {
47+ "title" : " Playwright"
48+ }
49+ }
50+ },
51+ "needsEslint" : {
52+ "message" : " 是否引入 ESLint 用於程式碼品質檢測?"
53+ },
54+ "needsPrettier" : {
55+ "message" : " 是否引入 Prettier 用於程式碼格式化?"
56+ },
57+ "errors" : {
58+ "operationCancelled" : " 操作取消"
59+ },
60+ "defaultToggleOptions" : {
61+ "active" : " 是" ,
62+ "inactive" : " 否"
63+ },
64+ "infos" : {
65+ "scaffolding" : " 正在建置專案" ,
66+ "done" : " 專案建置完成,可執行以下命令:"
67+ }
68+ }
Original file line number Diff line number Diff line change @@ -43,6 +43,32 @@ interface Language {
4343 }
4444}
4545
46+ /**
47+ *
48+ * This function is used to link obtained locale with correct locale file in order to make locales reusable
49+ *
50+ * @param locale the obtained locale
51+ * @returns locale that linked with correct name
52+ */
53+ function linkLocale ( locale : string ) {
54+ let linkedLocale : string
55+ switch ( locale ) {
56+ case 'zh-TW' :
57+ case 'zh-HK' :
58+ case 'zh-MO' :
59+ linkedLocale = 'zh-Hant'
60+ break
61+ case 'zh-CN' :
62+ case 'zh-SG' :
63+ linkedLocale = 'zh-Hans'
64+ break
65+ default :
66+ linkedLocale = locale
67+ }
68+
69+ return linkedLocale
70+ }
71+
4672function getLocale ( ) {
4773 const shellLocale =
4874 process . env . LC_ALL || // POSIX locale environment variables
@@ -51,9 +77,7 @@ function getLocale() {
5177 Intl . DateTimeFormat ( ) . resolvedOptions ( ) . locale || // Built-in ECMA-402 support
5278 'en-US' // Default fallback
5379
54- const locale = shellLocale . split ( '.' ) [ 0 ] . replace ( '_' , '-' )
55-
56- return locale
80+ return linkLocale ( shellLocale . split ( '.' ) [ 0 ] . replace ( '_' , '-' ) )
5781}
5882
5983export default function getLanguage ( ) {
You can’t perform that action at this time.
0 commit comments