/pyramid_i18n_helper

helper to create new smgid and translate msgid to local langs

Primary LanguagePython

Pyramid I18N Helper

This is a helper for internationalization and localization in Pyramid

views

This package add 3 view to your pyramid based application:

  • i18n_helper.domain view in route /translate
  • i18n_helper.pot view in route /translate/{domain}
  • i18n_helper.po view in route /translate/{domain}/{lang}

in /translate you see available domains and also you can create new domain.

in /translate/{domain} you can edit pot file for selected domain.

in /translate/{domain}/{lang} you can translate msgid to selected lang in selected domain. also you can update po file from pot file.

additional object

This package add Babel locale object to request. This package use Pyramid_flash_message to handle flash messages.

collecting msgids

you can also use auto collect msgids. for this set i18n_helper.collect_msgid = true in your project config file. by enabling auto collect. new msgids for any domain add to its own pot file. even if pot file for specific is not available it will create automatically

translation directory

you can specify translation directory in config file via i18n_helper.locale_dir

Installation

pip install pyramid_i18n_helper

add then add this package to your application

pyramid.includes =
    pyramid_layout
    pyramid_jinja2
    pyramid_i18n_helper

or

config.include('pyramid_layout')
config.include('pyramid_jinja2')
config.include('pyramid_i18n_helper')

now user with i18n_helper permission can access this pages.

Support

You can use project issue page to submit your issue

Khown Issues

  • After translating a msgid you have to restart your application
  • At now this package use pyramid_layout default layout. form pyramid_layout documentation page main_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.

Changes

v 0.3.5

  • get locale_dir from config file via i18n_helper.locale_dir

v 0.3.4

  • remove dependency to master_layout. master_layout is optional.

v 0.3.3

  • encoding bug fix.

v 0.3.2

  • bug fix.

v 0.3.1

  • documentation.
  • remove unnecessary dependency.

v 0.3.0

  • many change. so new version released.
  • documentation

v 0.2.14

  • complete domain view

v 0.2.13

  • handle duplication error
  • create new domain if not exist

v 0.2.11

  • compatible with pyramid_flash_message 0.2

v 0.2.9

  • add flash message.

v 0.2.8

  • set permission to 'i18n_helper'. so user want to access pages have to have this permission.

v 0.2.7

  • modify create lang and select lang
  • error in creating new lang if lang not valid in babel

v 0.2.6

  • add ability to collect msgids in pot file via i18n_helper.collect_msgid setting as true
  • some debug

v 0.2.5

  • add babel locale object to request

v 0.2.4

  • some bug fix

v 0.2.3

  • some bug fix

v 0.2

  • add (newlang / go to lang) field
  • some bug fix

v 0.1

  • some modification
  • apply suggestion from #1. thank @mmerickel

v 0.0

  • init project and create skeleton of it