mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-12 06:43:24 +03:00
7c0a686cd9
# NEW HOOK API `useI18n`: same as `useAFFiNEI18N`, with additional APIs ```ts import { useI18n } from '@affine/i18n' const i18n = useI18n() i18n['hello world']() -> 你好世界 ``` # NEW GLOBAL i18n Instance `I18n`: use i18n capabilities outside of React ```ts import { I18n } from '@affine/i18n' I18n['hello world']() -> 你好世界 ``` # NEW TYPES `I18nKeys` -> all i18n keys `I18nString` -> An i18n message (key&options) transfer and store i18n text outside of React ```ts const msg: I18nString = { key: 'helloworld', options: { arg1: '123' } } I18n.t(msg) -> 你好世界123 ``` before: ```ts registerCommand('open-page', { name: t('command.open-page') // ^- translation happens here, }) ``` after: ```ts registerCommand('open-page', { name: { key: 'command.open-page' } // ^- store I18nString here, translate when the command render to UI }) ```
170 lines
4.5 KiB
JSON
170 lines
4.5 KiB
JSON
{
|
|
"compilerOptions": {
|
|
"verbatimModuleSyntax": true,
|
|
// Classification follows https://www.typescriptlang.org/tsconfig
|
|
// Type Checking
|
|
"strict": true,
|
|
"exactOptionalPropertyTypes": false,
|
|
"noFallthroughCasesInSwitch": true,
|
|
"noImplicitAny": true,
|
|
"noImplicitOverride": true,
|
|
"noImplicitReturns": true,
|
|
"noImplicitThis": true,
|
|
"noUnusedLocals": true,
|
|
"noUnusedParameters": true,
|
|
"noPropertyAccessFromIndexSignature": false,
|
|
"noUncheckedIndexedAccess": false,
|
|
"useUnknownInCatchVariables": true,
|
|
// Modules
|
|
"module": "ESNext",
|
|
"moduleResolution": "bundler",
|
|
"resolveJsonModule": true,
|
|
"types": ["affine__env"],
|
|
// Emit
|
|
"declaration": true,
|
|
"declarationMap": true,
|
|
"sourceMap": true,
|
|
// skip type emit for @internal types
|
|
// "stripInternal": true,
|
|
// JavaScript Support
|
|
"allowJs": false,
|
|
"checkJs": false,
|
|
// Interop Constraints
|
|
"forceConsistentCasingInFileNames": true,
|
|
"allowSyntheticDefaultImports": true,
|
|
"isolatedModules": true,
|
|
// Language and Environment
|
|
"jsx": "preserve",
|
|
"jsxImportSource": "@emotion/react",
|
|
"lib": ["ESNext", "DOM"],
|
|
"target": "ES2022",
|
|
"useDefineForClassFields": false,
|
|
"experimentalDecorators": true,
|
|
"emitDecoratorMetadata": false,
|
|
// Projects
|
|
"composite": true,
|
|
"incremental": true,
|
|
// Completeness
|
|
"skipLibCheck": true, // skip all type checks for .d.ts files
|
|
"paths": {
|
|
"@affine/core/*": ["./packages/frontend/core/src/*"],
|
|
"@affine/core": ["./packages/frontend/core/src/index.ts"],
|
|
"@affine/admin/*": ["./packages/frontend/admin/src/*"],
|
|
"@affine/admin/components/ui/*": [
|
|
"./packages/frontend/admin/src/components/ui/*"
|
|
],
|
|
"@affine/cli/*": ["./tools/cli/src/*"],
|
|
"@affine/server/*": ["./packages/backend/server/src/*"],
|
|
"@affine/component": ["./packages/frontend/component/src/index"],
|
|
"@affine/component/*": [
|
|
"./packages/frontend/component/src/components/*/index",
|
|
"./packages/frontend/component/src/components/*"
|
|
],
|
|
"@affine/i18n": ["./packages/frontend/i18n/src"],
|
|
"@affine/debug": ["./packages/common/debug"],
|
|
"@affine/env": ["./packages/common/env/src"],
|
|
"@affine/env/*": ["./packages/common/env/src/*"],
|
|
"@affine/graphql": ["./packages/frontend/graphql/src"],
|
|
"@affine/electron/scripts/*": ["./packages/frontend/electron/scripts/*"],
|
|
"@affine-test/kit/*": ["./tests/kit/*"],
|
|
"@affine-test/fixtures/*": ["./tests/fixtures/*"],
|
|
"@toeverything/infra": ["./packages/common/infra/src"],
|
|
"@affine/native": ["./packages/frontend/native/index.d.ts"],
|
|
"@affine/native/*": ["./packages/frontend/native/*"],
|
|
"@affine/server-native": ["./packages/backend/native/index.d.ts"],
|
|
// Development only
|
|
"@affine/electron/*": ["./packages/frontend/electron/src/*"]
|
|
}
|
|
},
|
|
"include": [],
|
|
"references": [
|
|
// Backend
|
|
{
|
|
"path": "./packages/backend/server"
|
|
},
|
|
{
|
|
"path": "./packages/backend/server/tests"
|
|
},
|
|
// Frontend
|
|
{
|
|
"path": "./packages/frontend/admin"
|
|
},
|
|
{
|
|
"path": "./packages/frontend/component"
|
|
},
|
|
{
|
|
"path": "./packages/frontend/core"
|
|
},
|
|
{
|
|
"path": "./packages/frontend/web"
|
|
},
|
|
{
|
|
"path": "./packages/frontend/electron/tsconfig.test.json"
|
|
},
|
|
{
|
|
"path": "./packages/frontend/electron/renderer/tsconfig.json"
|
|
},
|
|
{
|
|
"path": "./packages/frontend/graphql"
|
|
},
|
|
{
|
|
"path": "./packages/frontend/i18n"
|
|
},
|
|
// Common
|
|
{
|
|
"path": "./packages/common/debug"
|
|
},
|
|
{
|
|
"path": "./packages/common/env"
|
|
},
|
|
{
|
|
"path": "./packages/common/infra"
|
|
},
|
|
// Tools
|
|
{
|
|
"path": "./tools/cli"
|
|
},
|
|
// Tests
|
|
{
|
|
"path": "./tests/kit"
|
|
},
|
|
{
|
|
"path": "./tests/affine-local"
|
|
},
|
|
{
|
|
"path": "./tests/affine-migration"
|
|
},
|
|
{
|
|
"path": "./tests/affine-legacy/0.7.0-canary.18"
|
|
},
|
|
{
|
|
"path": "./tests/affine-legacy/0.8.0-canary.7"
|
|
},
|
|
{
|
|
"path": "./tests/affine-cloud"
|
|
},
|
|
{
|
|
"path": "./tests/affine-desktop"
|
|
},
|
|
{
|
|
"path": "./tests/affine-legacy/0.8.4"
|
|
},
|
|
{
|
|
"path": "./tests/affine-legacy/0.6.1-beta.1"
|
|
},
|
|
// Others
|
|
{
|
|
"path": "./tsconfig.node.json"
|
|
}
|
|
],
|
|
"files": [],
|
|
"exclude": ["node_modules", "target", "lib", "test-results"],
|
|
"ts-node": {
|
|
"esm": true,
|
|
"compilerOptions": {
|
|
"module": "ESNext",
|
|
"moduleResolution": "Node"
|
|
}
|
|
}
|
|
}
|