在瓶子i18n中使用.po键

时间:2015-09-23 08:10:09

标签: python templates internationalization gettext bottle

basic example for bottle i18n中,msgID用于获取相应语言的字符串。

return bottle.template("<b>{{_('hello')}} I18N<b/>?")
corresponding .po中的

,定义了msgid:

msgid "hello"
msgstr "Hello"

other projects中,.po不仅包含msgid和msgstr,还包含之前的密钥,使用井号进行定义。这对于较长的短语尤其有用,以避免源代码混乱:

#: wordpress_file_monitor.php:138 wordpress_file_monitor.php:147
msgid "Remove Alert"
msgstr "Benachrichtigung entfernen"

如何使用bottle-i18n访问此#键?

0 个答案:

没有答案