如何使用 MessageFormat.js 为 `SelectFormat` 转义 '/'

How to escape '/' for `SelectFormat` with MessageFormat.js

我的 messageFormat 字符串看起来像这样:{foo, select, one/two{1-2} other{3}},但是 messageFormat 解析器抛出错误,因为其中使用了 /

我试过了,但没有用:

{foo, select, one'/'two{1-2} other{3}}
{foo, select, 'one/two'{1-2} other{3}}

有什么想法吗?

参考文献:
https://messageformat.github.io/messageformat/ https://messageformat.github.io/messageformat/page-guide#toc3__anchor

向库的维护者询问了同样的问题并得到了答案。现在不可能。需要寻找不同的解决方案,例如one_two

Reference