-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support i18n across systems (#188)
Signed-off-by: Neko Ayaka <[email protected]>
- Loading branch information
1 parent
a1e7082
commit b6e3e0c
Showing
25 changed files
with
327 additions
and
43 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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package lib | ||
|
||
import ( | ||
"go.uber.org/fx" | ||
|
||
"github.com/nekomeowww/insights-bot/internal/configs" | ||
"github.com/nekomeowww/insights-bot/pkg/i18n" | ||
"github.com/nekomeowww/insights-bot/pkg/logger" | ||
) | ||
|
||
type NewI18nParams struct { | ||
fx.In | ||
|
||
Configs *configs.Config | ||
Logger *logger.Logger | ||
} | ||
|
||
func NewI18n() func(NewI18nParams) (*i18n.I18n, error) { | ||
return func(params NewI18nParams) (*i18n.I18n, error) { | ||
return i18n.NewI18n( | ||
i18n.WithLocalesDir(params.Configs.LocalesDir), | ||
i18n.WithLogger(params.Logger), | ||
) | ||
} | ||
} |
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
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,15 @@ | ||
system: | ||
commands: | ||
start: | ||
help: Start interacting with the bot | ||
help: | ||
help: Get help | ||
message: | | ||
Hi! 👋 Welcome using Insights Bot! | ||
I currently support these commands: | ||
{{ .Commands }} | ||
cancel: | ||
help: Cancel the current activated operation | ||
alreadyCancelledAll: There is no activated operation to cancel |
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,15 @@ | ||
system: | ||
commands: | ||
start: | ||
help: 开始与 Bot 的交互 | ||
help: | ||
help: 获取帮助 | ||
message: | | ||
你好!👋 欢迎使用 Insights Bot! | ||
我当前支持这些命令: | ||
{{ .Commands }} | ||
cancel: | ||
help: 取消当前操作 | ||
alreadyCancelledAll: 已经没有正在进行的操作了 |
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
Oops, something went wrong.