用python babel翻译字符串不起作用

费利克斯

我有这条python线

raise ValueError(_(u'Your password must be {} of characters or longer.'.format(MIN_PASSWORD_LENGTH)))

我将其添加到PO文件中:

msgid "Your password must be {} of characters or longer."
msgstr "Votre mot de passe doit être {} de caractères ou plus."

我编译了它,但它没有翻译。

除此网站外,所有其他翻译都可以在该网站上使用。

我在这里想念什么?

交易

.po文件上,您需要保留%s格式。

像这样:

msgid "Your password must be %s characters or longer."
msgstr "Votre mot de passe doit être %s caractères ou plus."

或使用python-brace-format

#: foo/bar.py:32 
#, python-brace-format
msgid "Your password must be {n} characters or longer."
msgstr "Votre mot de passe doit être {n} caractères ou plus."

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

用replaceAll替换字符串中的空格在JAVA中不起作用

用qsort排序字符串不起作用

用re.match匹配字符串不起作用

非常基本的字符串格式不起作用(Python)

用str_ireplace替换不区分大小写的字符串不起作用

不等于运算符(!=)在python字符串比较中不起作用

Python-从列表中忽略字符串不起作用

Python-在字符串中查找子字符串(代码不起作用)

python枚举按字符串值获取不起作用

为什么用彩色箱子中的彩色字符串替换子字符串不起作用?

使用replace方法在Python中替换字符串中的值不起作用

如何从Python .remove中的列表中删除字符串元素对我不起作用

循环中的Jupyter Notebook中的Python F字符串不起作用

Python程序不起作用,输入==字符串不起作用

带有Unicode字符串的Python正则表达式不起作用

用骆驼分割字符串的js写函数不起作用

减少python中的字符串不起作用

用正则表达式进行字符串验证不起作用

R用sub检索字符串:为什么这不起作用?

Python字符串模式匹配不起作用

Python分割字符串不起作用

Python解析字符串替换不起作用

Python将布尔值连接到字符串不起作用

字符串到 int/float 转换在树莓派上的 python 中不起作用

SQL Server:用其他字符串替换字符串的“Case When”语句不起作用

用“|”分隔字符串文本 不起作用

字符串比较不起作用!语言是python

用 "\\s".toRegex() 拆分字符串在 Kotlin 中不起作用

用值“$&”替換字符串在javascript中不起作用