feat: implement dynamic README loading based on user language
- Updated app.py to load the README content from language-specific markdown files located in the templates directory. - Added new index.md files for English and Chinese, providing localized information about PsychoScales.Org and its resources.
This commit is contained in:
parent
e46d17eaf2
commit
6c905dc3ce
2
app.py
2
app.py
@ -124,7 +124,7 @@ async def index(request: Request):
|
||||
# 新增读取README.md的逻辑
|
||||
readme_content = ""
|
||||
try:
|
||||
with open("README.md", "r", encoding="utf-8") as f:
|
||||
with open("templates/"+request.state.language+"/index.md", "r", encoding="utf-8") as f:
|
||||
readme_content = markdown.markdown(f.read())
|
||||
except FileNotFoundError:
|
||||
pass # 如果README不存在则静默失败
|
||||
|
21
templates/en/index.md
Normal file
21
templates/en/index.md
Normal file
@ -0,0 +1,21 @@
|
||||
# PsychoScales.Org
|
||||
|
||||
## About Psychoscales.Org
|
||||
|
||||
This is an open source scale framework, built on Python.
|
||||
The scale loading of this project is completely based on YAML, which strikes a balance between easy editing and easy loading.
|
||||
|
||||
[Open source address](https://git.mxr612.io/PsychoScales/PsychoScalesOrg)
|
||||
|
||||
Contact us: feedback@psychoscales.com
|
||||
|
||||
User community: QQ 513869177
|
||||
|
||||
## About PsychoScale
|
||||
|
||||
PsychoScale is a professional psychology resource platform that aims to provide users with comprehensive psychology measurement tools and assessment resources. We have brought together a variety of psychological measurement tools covering multiple fields such as emotions, personality, cognitive ability, and mental health to help users better understand their own psychological characteristics and conditions.
|
||||
|
||||
As a user of PsychoScale, you can quickly obtain detailed reports and analysis of your own psychological characteristics through simple online tests. These measurement tools are based on authoritative psychological theories and research, ensuring the accuracy and reliability of test results.
|
||||
|
||||
This website aims to provide free scale sharing and result calculation.
|
||||
If you need analysis, you can get a comprehensive and in-depth analysis of AI results at [Psychoscales](https://www.psychoscales.com/).
|
21
templates/zh/index.md
Normal file
21
templates/zh/index.md
Normal file
@ -0,0 +1,21 @@
|
||||
# 心尺.Org
|
||||
|
||||
## 关于心尺.Org
|
||||
|
||||
这个一个开源的量表框架,基于Python搭建。
|
||||
本项目的量表加载完全基于YAML,在易于编辑和易于加载中间达到了平衡。
|
||||
|
||||
[开源地址](https://git.mxr612.io/PsychoScales/PsychoScalesOrg)
|
||||
|
||||
联系我们:feedback@psychoscales.com
|
||||
|
||||
用户社区:QQ 513869177
|
||||
|
||||
## 关于心尺
|
||||
|
||||
心尺是一个专业的心理学资源平台,旨在为用户提供全面的心理学测量工具和评估资源。我们汇集了各种心理测量工具,涵盖了情绪、人格、认知能力、心理健康等多个领域,帮助用户更好地了解自己的心理特点和状况。
|
||||
|
||||
作为心尺的用户,您可以通过简单的在线测试,快速获取关于自己心理特征的详细报告和分析。这些测量工具基于权威的心理学理论和研究,确保了测试结果的准确性和可靠性。
|
||||
|
||||
本网站旨在提供免费的量表分享和结果计算。
|
||||
如果您需要解析,您可以在[心尺](https://www.psychoscales.com/)得到全面、深入的AI结果解析。
|
Loading…
x
Reference in New Issue
Block a user