summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormikl <>2008-07-01 15:14:40 +0000
committermikl <>2008-07-01 15:14:40 +0000
commitdda2b12bff4859dcbd86334e7f65b101dba58166 (patch)
treeda6c916e5596237a73df42af26587bf86ee801aa
parentfb561e971e02b77f1caa569fb13c35fb286bd1c9 (diff)
Updated QST, added postgresql schema for I18N
-rw-r--r--.gitattributes1
-rw-r--r--demos/quickstart/protected/pages/Advanced/I18N.page20
-rw-r--r--framework/I18N/schema/postgresql.sql40
3 files changed, 61 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes
index e7a3d8b6..f296a7ac 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2483,6 +2483,7 @@ framework/I18N/core/data/zh_SG.dat -text
framework/I18N/core/data/zh_TW.dat -text
framework/I18N/core/util.php -text
framework/I18N/schema/mysql.sql -text
+framework/I18N/schema/postgresql.sql -text
framework/I18N/schema/sqlite.sql -text
framework/IO/TTarFileExtractor.php -text
framework/IO/TTextWriter.php -text
diff --git a/demos/quickstart/protected/pages/Advanced/I18N.page b/demos/quickstart/protected/pages/Advanced/I18N.page
index 306553e1..5d3e05b5 100644
--- a/demos/quickstart/protected/pages/Advanced/I18N.page
+++ b/demos/quickstart/protected/pages/Advanced/I18N.page
@@ -78,6 +78,26 @@ The <tt>marker</tt> value is used to surround any untranslated text.
Each translation message is wrapped within a <tt>trans-unit</tt> tag, where <tt>source</tt> is the original message, and <tt>target</tt> is the translated message. Editors such as <a href="http://www.heartsome.net/EN/xlfedit.html">Heartsome XLIFF Translation Editor</a> can help in editing these XML files.
+<h2>Using a Database for translation</h2>
+
+<com:SinceVersion Version="3.1.3" />
+<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:</>
+
+<com:TTextHighlighter Language="xml" CssClass="source block-content">
+<module id="db1" class="System.Data.TDataSourceConfig">
+ <database ConnectionString="mysql:host=localhost;dbname=demodb" Username="demo" Password="demo" />
+</module>
+
+<module id="globalization" class="TGlobalization">
+ <translation
+ type="Database"
+ autosave="true"
+ cache="false"
+ source="db1" />
+</module>
+</com:TTextHighlighter>
+
+<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>
<h2 id="6206">Setting and Changing Culture</h2>
<p id="790633" class="block-content">Once globalization is enabled, you can access the globalization settings, such as, <tt>Culture</tt>, <tt>Charset</tt>, etc, using </p>
diff --git a/framework/I18N/schema/postgresql.sql b/framework/I18N/schema/postgresql.sql
new file mode 100644
index 00000000..938126aa
--- /dev/null
+++ b/framework/I18N/schema/postgresql.sql
@@ -0,0 +1,40 @@
+
+-- Table structure for table catalogue
+
+CREATE TABLE catalogue (
+ cat_id serial NOT NULL primary key,
+ name varchar(100) NOT NULL default '',
+ source_lang varchar(100) NOT NULL default '',
+ target_lang varchar(100) NOT NULL default '',
+ date_created int NOT NULL default 0,
+ date_modified int NOT NULL default 0,
+ author varchar(255) NOT NULL default ''
+);
+
+-- Dumping data for table catalogue
+
+INSERT INTO catalogue VALUES (nextval('catalogue_cat_id_seq'), 'messages', '', '', 0, 0, '');
+INSERT INTO catalogue VALUES (nextval('catalogue_cat_id_seq'), 'messages.en', '', '', 0, 0, '');
+INSERT INTO catalogue VALUES (nextval('catalogue_cat_id_seq'), 'messages.en_AU', '', '', 0, 0, '');
+
+-- Table structure for table trans_unit
+
+CREATE TABLE trans_unit (
+ msg_id serial NOT NULL primary key,
+ cat_id int NOT NULL default 1,
+ id varchar(255) NOT NULL default '',
+ source text NOT NULL,
+ target text NOT NULL default '',
+ comments text NOT NULL default '',
+ date_added int NOT NULL default 0,
+ date_modified int NOT NULL default 0,
+ author varchar(255) NOT NULL default '',
+ translated smallint NOT NULL default 0
+);
+
+INSERT INTO trans_unit VALUES (nextval('trans_unit_msg_id_seq'), 1, '1', 'Hello', 'Hello World', '', 0, 0, '', 1);
+INSERT INTO trans_unit VALUES (nextval('trans_unit_msg_id_seq'), 2, '', 'Hello', 'Hello :)', '', 0, 0, '', 0);
+INSERT INTO trans_unit VALUES (nextval('trans_unit_msg_id_seq'), 1, '1', 'Welcome', 'Welcome', '', 0, 0, '', 0);
+INSERT INTO trans_unit VALUES (nextval('trans_unit_msg_id_seq'), 3, '', 'Hello', 'G''day Mate!', '', 0, 0, '', 0);
+INSERT INTO trans_unit VALUES (nextval('trans_unit_msg_id_seq'), 3, '', 'Welcome', 'Welcome Mate!', '', 0, 0, '', 0);
+