在i18n和l10n中提供帮助的小工具
pyramid-i18n-helper的Python项目详细描述
金字塔i18n助手
这是Pyramid中国际化和本地化的助手
视图
此软件包为基于金字塔的应用程序添加3个视图:
- i18n_helper.domain view in route /translate
- i18n_helper.pot view in route /translate/{domain}
- i18n_helper.po view in route /translate/{domain}/{lang}
在/translate中可以看到可用的域,还可以创建新域。
在/translate/{domain}中,可以编辑选定域的pot文件。
在/translate/{domain}/{lang}中,可以将msgid转换为选定域中的选定语言。也可以从pot文件更新po文件。
附加对象
此包将Babel语言环境对象添加到请求中。 这个包使用Pyramid_flash_message来处理flash消息。
收集msgid
您也可以使用自动收集msgid。对于您的项目配置文件中的这个集合i18n_helper.collect_msgid=true。 通过启用自动收集。任何域的新msgid都会添加到自己的pot文件中。即使特定的pot文件不可用,它也会自动创建
翻译目录
您可以通过i18n_helper.locale_dir在配置文件中指定翻译目录
安装
pip install pyramid_i18n_helper
添加然后将此软件包添加到应用程序中
pyramid.includes= pyramid_layout pyramid_jinja2 pyramid_i18n_helper
或
config.include('pyramid_layout')config.include('pyramid_jinja2')config.include('pyramid_i18n_helper')
现在具有i18n_helper权限的用户可以访问此页。
支持
您可以使用project issue page提交问题
霍恩问题
- After translating a msgid you have to restart your application
- At now this package use pyramid_layout default layout. form pyramid_layout documentation pagemain_template is the template object that provides the main template (aka, o-wrap) for the view. if your application don’t have main_layout some default main_template will be used but it is so simple and you may have problem. at now templates will be load in block named content.
- main_layout template have to designed via jinja2.
- excuse me for my bad english knowledge.
更改
电压0.3.5
- get locale_dir from config file via i18n_helper.locale_dir
电压0.3.4
- remove dependency to master_layout. master_layout is optional.
0.3.3伏
- encoding bug fix.
V 0.3.2
- bug fix.
电压0.3.1
- documentation.
- remove unnecessary dependency.
电压0.3.0
- many change. so new version released.
- documentation
电压0.2.14
- complete domain view
电压0.2.13
- handle duplication error
- create new domain if not exist
电压0.2.11
- compatible with pyramid_flash_message 0.2
电压0.2.9
- add flash message.
电压0.2.8
- set permission to ‘i18n_helper’. so user want to access pages have to have this permission.
电压0.2.7
- modify create lang and select lang
- error in creating new lang if lang not valid in babel
电压0.2.6
- add ability to collect msgids in pot file via i18n_helper.collect_msgid setting as true
- some debug
电压0.2.5
- add babel locale object to request
电压0.2.4
- some bug fix
电压0.2.3
- some bug fix
电压0.2
- add (newlang / go to lang) field
- some bug fix
电压0.1
- some modification
- apply suggestion from #1. thank @mmerickel
电压0.0
- init project and create skeleton of it