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

长段落中文能否支持变量替代格式 #61

Open
redbin1024 opened this issue Nov 13, 2024 · 1 comment
Open

长段落中文能否支持变量替代格式 #61

redbin1024 opened this issue Nov 13, 2024 · 1 comment

Comments

@redbin1024
Copy link

比如是变量 msg 替换 “石油这东西是非常珍贵的,拿来烧了完全是暴殄天物,这是油车天然的弱点。这就好比大家养牲畜,最好是草食动物,或者至少应该是杂食动物,除非是土豪,否则不会去养肉食动物。狗和猫本来是肉食动物,跟着人混也变成杂食了。原因很简单,植物的成本最低,肉人类自己都不够吃谁养得起。”

使用时
<span>{{ t(msg) }}</span>

然后在编译时将 msg 替换为 长段中文

@zhangfisher
Copy link
Owner

zhangfisher commented Nov 14, 2024

t是不支持变量的,像{{ t(msg) }}是不支持的

也不支持模板字符串,像下面这种

<span>{{ t(`石油这东西是非常珍贵的,拿来烧了完全是暴殄天物,这是油车天然的弱点。这就好比大家养牲畜,最好是草食动物,或者至少应该是杂食动物,除非是土豪,否则不会去养肉食动物。狗和猫本来是肉食动物,跟着人混也变成杂食了。原因很简单,植物的成本最低,肉人类自己都不够吃谁养得起`) }}</span>

但是你可以这样:

const msg=t("石油这东西是非常珍贵的,拿来烧了完全是暴殄天物,这是油车天然的弱点。这就好比大家养牲畜,最好是草食动物,或者至少应该是杂食动物,除非是土豪,否则不会去养肉食动物。狗和猫本来是肉食动物,跟着人混也变成杂食了。原因很简单,植物的成本最低,肉人类自己都不够吃谁养得起")


<span>{{ t(msg) }}</span>

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

No branches or pull requests

2 participants