How to add i18n feature to a large Pyramid project?
<p>I have did these steps to try to add i18n feature to a current project.</p>

<h1>Add packages to myproject/product/setup.py</h1>

<pre><code>requires = [
...
+    'Babel',
+    'lingua',
]

setup(name='myproject.app.product',
...
+      message_extractors = { '.': [
+          ('**.py', 'lingua_python', None ),
+          ('**.pt', 'lingua_xml', None ),
+          ('src/myproject/app/product/**/templates/**.html', 'mako', None ),
+          ('src/myproject/app/product/**/templates/**.mako', 'mako', None ),
+          ('src/myproject/app/product/**/static/**', 'ignore', None ),
+          ]},
}
)
</code></pre>

<h1>Add config to myproject/product/setup.cfg</h1>

<pre><code>[compile_catalog]
directory = src/myproject/app/product/locale
domain = product
statistics = true

[extract_messages]
add_comments = TRANSLATORS:
output_file = src/myproject/app/product/locale/product.pot
width = 80

[init_catalog]
domain = product
input_file = src/myproject/app/product/locale/product.pot
output_dir = src/myproject/app/product/locale

[update_catalog]
domain = product
input_file = src/myproject/app/product/locale/product.pot
output_dir = src/myproject/app/product/locale
previous = true
</code></pre>

<h1>Add add_translation_dirs to myproject/product/src/myproject/app/product/<strong>init</strong>.py</h1>

<pre><code>config.add_translation_dirs('myproject.app.product:locale')
</code></pre>

<h1>Change html info and add a test output message to layout file: myproject/product/src/myproject/app/product/show/templates/pc/layout.html</h1>

<pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
      i18n:domain="product"&gt;

&lt;h2 i18n:translate="search_documentation"&gt;Search documentation&lt;/h2&gt;
</code></pre>

<h1>Add default_locale_name to application.ini</h1>

<pre><code>pyramid.default_locale_name = en
</code></pre>

<h1>Add test message to .po file: myproject/product/src/myproject/app/product/locale/en/LC_MESSAGES/product.po</h1>

<pre><code>...
msgid "search_documentation"
msgstr "Search Documentation"
</code></pre>

<p>Finally, I compiled the translated .po files and started the project to view that layout page. it shows <code>Search documentation</code> but not <code>Search Documentation</code>. It means that the i18n setting is not work.</p>

<p>Where is the problem? How to config it?</p>