Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add the i18n middleware for the server #476

Merged
merged 2 commits into from
Nov 15, 2024
Merged

Conversation

xingwanying
Copy link
Contributor

image

server也国际化上了

Copy link

vercel bot commented Nov 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
petercat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 15, 2024 8:31am

Copy link

Walkthrough

该PR为服务器添加了国际化中间件,支持多语言功能。主要涉及对现有代码的调整以支持国际化,包括引入新的中间件和配置文件。

Changes

文件 概要
server/agent/tools/bot_builder.py 修改了错误信息的返回值,并调整了代码格式。
server/bot/builder.py 移除了默认的启动信息和问候信息,直接使用传入的参数。
server/bot/router.py 添加了语言参数,使用国际化工具获取默认启动信息和问候信息。
server/i18n/en.json, server/i18n/ja.json, server/i18n/ko.json, server/i18n/zh-CN.json, server/i18n/zh-TW.json 添加了新的翻译条目。
server/i18n/translations.py 新增文件,定义了国际化配置和中间件。
server/main.py 添加了国际化中间件到FastAPI应用中。

server/bot/router.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 41.17647% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
server/bot/router.py 14.28% 6 Missing ⚠️
server/agent/tools/bot_builder.py 33.33% 4 Missing ⚠️
Files with missing lines Coverage Δ
server/bot/builder.py 26.31% <ø> (ø)
server/main.py 92.15% <100.00%> (ø)
server/agent/tools/bot_builder.py 42.30% <33.33%> (ø)
server/bot/router.py 20.10% <14.28%> (ø)

... and 1 file with indirect coverage changes

@xingwanying xingwanying merged commit 2789bf6 into main Nov 15, 2024
3 of 5 checks passed
@xingwanying xingwanying deleted the feat_server_i18n branch November 15, 2024 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant