-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
packages/locales
/@local/locales
Currently contains a hacky workaround, waiting for privatenumber/tsx#181
- Loading branch information
Showing
8 changed files
with
183 additions
and
13 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 |
---|---|---|
@@ -1,20 +1,14 @@ | ||
import en from '@local/locales/en.json' | ||
import vi from '@local/locales/vi.json' | ||
|
||
export default defineI18nConfig(() => ({ | ||
legacy: false, | ||
fallbackWarn: false, | ||
fallbackLocale: 'en', | ||
locale: 'en', | ||
messages: { | ||
en: { | ||
'layouts.title': `starter-fullstack {'|'} {title}`, | ||
'pages.title.home': `Home`, | ||
'language': 'Language', | ||
'welcome': `Welcome`, | ||
}, | ||
vi: { | ||
'pages.title.home': `Trang chủ`, | ||
'language': 'Ngôn ngữ', | ||
'welcome': `Xin chào`, | ||
}, | ||
en, | ||
vi, | ||
}, | ||
flatJson: true, | ||
})) |
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,5 @@ | ||
# @local/locales | ||
|
||
Refer to [unplugin-sheet-i18n](https://github.com/NamesMT/unplugin-sheet-i18n) for more information. | ||
|
||
Basically, a power-packed plugin to process i18n [spread]sheets into anything :D. |
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,9 @@ | ||
import { createContext } from 'unplugin-sheet-i18n' | ||
|
||
// Hacky workaround to reload i18n.csv when it changes, waiting for https://github.com/privatenumber/tsx/issues/181 | ||
// @ts-expect-error it'll throw, but it's ok, we just want to hint tsx to relaod upon i18n.csv change | ||
import('./src/i18n.csv').catch(() => null) | ||
|
||
createContext({ | ||
outDir: 'dist', | ||
}).scanConvert() |
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,22 @@ | ||
{ | ||
"name": "@local/locales", | ||
"type": "module", | ||
"version": "0.0.0", | ||
"private": true, | ||
"exports": { | ||
"./*": { | ||
"import": "./dist/*" | ||
} | ||
}, | ||
"main": "./index.ts", | ||
"types": "./index.ts", | ||
"scripts": { | ||
"lint": "eslint .", | ||
"dev": "tsx watch index.ts", | ||
"postinstall": "tsx index.ts" | ||
}, | ||
"devDependencies": { | ||
"@local/tsconfig": "workspace:*", | ||
"unplugin-sheet-i18n": "^0.4.8" | ||
} | ||
} |
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,5 @@ | ||
KEY,Description,en,vi | ||
layouts.title,,starter-fullstack {'|'} {title}, | ||
pages.title.home,,Home,Trang chủ | ||
language,,Language,Ngôn ngữ | ||
welcome,,Welcome,Xin chào |
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,5 @@ | ||
{ | ||
"extends": "@local/tsconfig/base.json", | ||
"include": ["."], | ||
"exclude": ["dist", "node_modules"] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.