summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwei <>2006-09-23 07:30:43 +0000
committerwei <>2006-09-23 07:30:43 +0000
commit0ba115b57b6c8196b9de794afdd1d3855a3b9011 (patch)
tree1cfacf49c090131e7ab74de655a6e284c89aa6bb
parentd43aab408a618001d90721c0d6f437f5aad00243 (diff)
Fixed #382
-rw-r--r--demos/quickstart/protected/pages/Advanced/I18N.page2
-rw-r--r--framework/I18N/TGlobalization.php5
-rw-r--r--framework/I18N/Translation.php4
3 files changed, 9 insertions, 2 deletions
diff --git a/demos/quickstart/protected/pages/Advanced/I18N.page b/demos/quickstart/protected/pages/Advanced/I18N.page
index 1330091f..9c3d620f 100644
--- a/demos/quickstart/protected/pages/Advanced/I18N.page
+++ b/demos/quickstart/protected/pages/Advanced/I18N.page
@@ -40,6 +40,7 @@ First you need to include the <tt>System.I18N.*</tt> namespace to your paths.
<module id="globalization" class="TGlobalization">
<translation type="XLIFF"
source="MyApp.messages"
+ marker="@@"
autosave="true" cache="true" />
</module>
</com:TTextHighlighter>
@@ -48,6 +49,7 @@ First you need to include the <tt>System.I18N.*</tt> namespace to your paths.
where you are going to store your translate message catalogue. The <tt>autosave</tt>
attribute if enabled, saves untranslated messages back into the message catalogue.
With <tt>cache</tt> enabled, translated messages are saved in the application <tt>runtime/i18n</tt> directory.
+The <tt>marker</tt> value is used to surround any untranslated text.
</p>
<p>With the configuration complete, we can now start to localize your application. If you have <tt>autosave</tt> enabled, after running your application with some localization activity (i.e. translating some text), you will see a directory and a <tt>messages.xml</tt> created within your <tt>source</tt> directory.</p>
diff --git a/framework/I18N/TGlobalization.php b/framework/I18N/TGlobalization.php
index d3c6d233..4a9a20ac 100644
--- a/framework/I18N/TGlobalization.php
+++ b/framework/I18N/TGlobalization.php
@@ -160,6 +160,7 @@ class TGlobalization extends TModule
* $config['catalogue'] = 'messages'; //default catalog
* $config['autosave'] = 'true'; //save untranslated message
* $config['cache'] = 'true'; //cache translated message
+ * $config['marker'] = '@@'; // surround untranslated text with '@@'
* </code>
* Throws exception is source is not found.
* @param TMap configuration options
@@ -176,7 +177,7 @@ class TGlobalization extends TModule
if(@mkdir($config['source'])===false)
throw new TConfigurationException('globalization_source_path_failed',
$config['source']);
- chmod($config['source'], 0777); //make it deletable
+ chmod($config['source'], 0777); //make it deletable
}
}
else
@@ -192,7 +193,7 @@ class TGlobalization extends TModule
if(@mkdir($config['cache'])===false)
throw new TConfigurationException('globalization_cache_path_failed',
$config['cache']);
- chmod($config['cache'], 0777); //make it deletable
+ chmod($config['cache'], 0777); //make it deletable
}
}
$this->_translation = $config;
diff --git a/framework/I18N/Translation.php b/framework/I18N/Translation.php
index 33696304..7394842b 100644
--- a/framework/I18N/Translation.php
+++ b/framework/I18N/Translation.php
@@ -54,6 +54,10 @@ class Translation extends TComponent
self::$formatter = new MessageFormat($source, $app->getCharset());
+ //mark untranslated text
+ if($ps=$config['marker'])
+ self::$formatter->setUntranslatedPS(array($ps,$ps));
+
//save the message on end request
Prado::getApplication()->attachEventHandler(
'OnEndRequest', array('Translation', 'saveMessages'));