Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
koishi-decorators
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
3rdeye
koishi-decorators
Commits
96f15dfb
Commit
96f15dfb
authored
Mar 10, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
put @DefineLocale universal
parent
5a87ea40
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
src/decorators/decorators.ts
src/decorators/decorators.ts
+16
-3
No files found.
src/decorators/decorators.ts
View file @
96f15dfb
...
...
@@ -221,8 +221,21 @@ export const DefineTemplate = (name: string, text: string | Dict<string>) =>
registerTemplate
({
name
,
text
:
adaptLocaleDict
(
text
)
},
ctx
),
);
export
const
DefineLocale
=
(
type
Node
=
string
|
Store
;
export
function
DefineLocale
(
locale
:
string
,
dict
:
Store
):
ClassDecorator
;
export
function
DefineLocale
(
locale
:
string
,
key
:
string
,
text
:
string
|
Store
,
)
=>
TopLevelAction
((
ctx
)
=>
ctx
.
i18n
.
define
(
locale
,
key
,
text
));
value
:
Node
,
):
ClassDecorator
;
export
function
DefineLocale
(
locale
:
string
,
...
args
:
[
Store
]
|
[
string
,
Node
]
):
ClassDecorator
{
return
TopLevelAction
((
ctx
)
=>
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
ctx
.
i18n
.
define
(
locale
,
...
args
),
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment