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
a21d8fc1
Commit
a21d8fc1
authored
Mar 10, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add DefineLocale
parent
71c64a9e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
src/decorators/decorators.ts
src/decorators/decorators.ts
+7
-2
src/def/constants.ts
src/def/constants.ts
+0
-2
No files found.
src/decorators/decorators.ts
View file @
a21d8fc1
...
...
@@ -3,7 +3,6 @@ import {
CommandConfigExtended
,
CommandDefinitionFun
,
CommandOptionConfigWithDescription
,
ContextFunction
,
EventName
,
KoishiCommandDefinition
,
KoishiCommandPutDef
,
...
...
@@ -14,12 +13,12 @@ import {
import
'
reflect-metadata
'
;
import
{
Argv
,
Awaitable
,
Command
,
Dict
,
FieldCollector
,
Selection
,
Session
,
Store
,
}
from
'
koishi
'
;
import
{
Metadata
}
from
'
../meta/metadata.decorators
'
;
import
{
CommandPut
,
DoRegister
}
from
'
../registry
'
;
...
...
@@ -221,3 +220,9 @@ export const DefineTemplate = (name: string, text: string | Dict<string>) =>
TopLevelAction
((
ctx
)
=>
registerTemplate
({
name
,
text
:
adaptLocaleDict
(
text
)
},
ctx
),
);
export
const
DefineLocale
=
(
locale
:
string
,
key
:
string
,
text
:
string
|
Store
,
)
=>
TopLevelAction
((
ctx
)
=>
ctx
.
i18n
.
define
(
locale
,
key
,
text
));
src/def/constants.ts
View file @
a21d8fc1
// metadatas
import
{
CommandDefinitionFun
,
ContextFunction
,
OnContextFunction
,
TopLevelActionDef
,
}
from
'
./interfaces
'
;
import
{
DoRegister
}
from
'
../registry
'
;
import
{
Awaitable
}
from
'
koishi
'
;
export
const
KoishiOnContextScope
=
'
KoishiOnContextScope
'
;
export
const
KoishiDoRegister
=
'
KoishiDoRegister
'
;
...
...
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