| | 81 | <h2>Using a Database for translation</h2> |
| | 82 | |
| | 83 | <com:SinceVersion Version="3.1.3" /> |
| | 84 | <p>Since version 3.1.3 the messages can also be stored in a database using the connection id from an existing <tt>TDataSourceConfig</tt>. You have to create two tables in your database: <tt>catalogue</tt> and <tt>trans_unit</tt>. The catalogue table needs an entry for each catalogue you want to use. Example schemas for different databases can be found in the framework's <tt>I18N/schema</tt> directory. To configure translation with a database use:</> |
| | 85 | |
| | 86 | <com:TTextHighlighter Language="xml" CssClass="source block-content"> |
| | 87 | <module id="db1" class="System.Data.TDataSourceConfig"> |
| | 88 | <database ConnectionString="mysql:host=localhost;dbname=demodb" Username="demo" Password="demo" /> |
| | 89 | </module> |
| | 90 | |
| | 91 | <module id="globalization" class="TGlobalization"> |
| | 92 | <translation |
| | 93 | type="Database" |
| | 94 | autosave="true" |
| | 95 | cache="false" |
| | 96 | source="db1" /> |
| | 97 | </module> |
| | 98 | </com:TTextHighlighter> |
| | 99 | |
| | 100 | <p>The translation messages will be stored in the <tt>trans_unit</tt> table. Add your translation in the <tt>target</tt> field of that table. You should make sure that you are working on the right catalogue by comparing the message's <tt>cat_id</tt> with that from the catalogue table.</p> |