summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Advanced/I18N.page
diff options
context:
space:
mode:
Diffstat (limited to 'demos/quickstart/protected/pages/Advanced/I18N.page')
-rw-r--r--demos/quickstart/protected/pages/Advanced/I18N.page28
1 files changed, 14 insertions, 14 deletions
diff --git a/demos/quickstart/protected/pages/Advanced/I18N.page b/demos/quickstart/protected/pages/Advanced/I18N.page
index 4a220c4c..5b1fafa0 100644
--- a/demos/quickstart/protected/pages/Advanced/I18N.page
+++ b/demos/quickstart/protected/pages/Advanced/I18N.page
@@ -1,9 +1,9 @@
<com:TContent ID="body" >
-<h1>Internationalization (I18N) and Localization (L10N)</h1>
+<h1 id="6201">Internationalization (I18N) and Localization (L10N)</h1>
<p>Many web application built with PHP will not have internationalization in mind when it was first written. It may be that it was not intended for use in languages and cultures. Internationalization is an important aspect due to the increase adoption of the Internet in many non-English speaking countries. The process of internationalization and localization will contain difficulties. Below are some general guidelines to internationalize an existing application.</p>
-<h2>Separate culture/locale sensitive data</h2>
+<h2 id="6203">Separate culture/locale sensitive data</h2>
<p>Identify and separate data that varies with culture. The most obvious are text/string/message. Other type of data should also be considered. The following list categorize some examples of culture sensitive data
</p>
@@ -25,7 +25,7 @@
<p>If possible all manner of text should be isolated and store in a persistence format. These text include, application error messages, hard coded strings in PHP files, emails, static HTML text, and text on form elements (e.g. buttons).</p>
-<h2>Configuration</h2>
+<h2 id="6204">Configuration</h2>
<p>To enable the localization features in Prado, you need to add a few configuration options in your <a href="?page=Configurations.AppConfig">application configuration</a>.
First you need to include the <tt>System.I18N.*</tt> namespace to your paths.
</p>
@@ -52,7 +52,7 @@ With <tt>cache</tt> enabled, translated messages are saved in the application <t
<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>
-<h2>What to do with <tt>messages.xml</tt>?</h2>
+<h2 id="6205">What to do with <tt>messages.xml</tt>?</h2>
<p>The translation message catalogue file, if using <tt>type="XLIFF"</tt>, is a standardized translation message interchange XML format. You can edit the XML file using any UTF-8 aware editor. The format of the XML is something like the following.</p>
<com:TTextHighlighter Language="xml" CssClass="source">
@@ -77,7 +77,7 @@ With <tt>cache</tt> enabled, translated messages are saved in the application <t
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>Setting and Changing Culture</h2>
+<h2 id="6206">Setting and Changing Culture</h2>
<p>Once globalization is enabled, you can access the globalization settings, such as, <tt>Culture</tt>, <tt>Charset</tt>, etc, using </p>
<com:TTextHighlighter CssClass="source">
$globalization = $this->getApplication()->getGlobalization();
@@ -98,9 +98,9 @@ Lastly, you can change the globalization settings on page by page basis using <a
&lt;%@ Application.Globalization.Culture="zh" %&gt;
</com:TTextHighlighter>
-<h2>Localizing your Prado application</h2>
+<h2 id="6207">Localizing your Prado application</h2>
There are two areas in your application that may need message or string localization, in PHP code and in the templates. To localize strings within PHP, use the <tt>localize</tt> function detailed below. To localize text in the template, use the <a href="#ttranslate">TTranslate</a> component.
-<h2>Using <tt>localize</tt> function to translate text within PHP</h2>
+<h2 id="6208">Using <tt>localize</tt> function to translate text within PHP</h2>
<p>The <tt>localize</tt> function searches for a translated string that matches original from your translation source. First, you need to locate all the hard coded text in PHP that are displayed or sent to the end user. The following example localizes the text of the <tt>$sender</tt> (assuming, say, the sender is a button). The original code before localization is as follows.
<com:TTextHighlighter CssClass="source">
@@ -118,7 +118,7 @@ function clickMe($sender,$param)
}
</com:TTextHighlighter>
-<h2>Compound Messages</h2>
+<h2 id="6209">Compound Messages</h2>
<p>Compound messages can contain variable data. For example, in the message "There are 12 users online.", the integer 12 may change depending on some data in your application. This is difficult to translate because the position of the variable data may be difference for different languages. In addition, different languages have their own rules for plurals (if any) and/or quantifiers. The following example can not be easily translated, because the sentence structure is fixed by hard coding the variable data within message.</p>
<com:TTextHighlighter CssClass="source">
@@ -137,9 +137,9 @@ The <tt>localize</tt> function does not solve the problem of localizing language
<p>The following sample demonstrates the basics of localization in Prado.</p>
<com:RunBar PagePath="Advanced.Samples.I18N.Home" />
-<h1>I18N Components</h1>
+<h1 id="6202">I18N Components</h1>
<a name="ttranslate"></a>
-<h2>TTranslate</h2>
+<h2 id="6210">TTranslate</h2>
<p>Messages and strings can be localized in PHP or in templates.
To translate a message or string in the template, use <tt>TTranslate</tt>.</p>
@@ -164,7 +164,7 @@ The time is {time}.
&lt;com:TLabel Text="&lt;%[ Hello World! ]%&gt;" /&gt;
</com:TTextHighlighter>
-<h2>TDateFormat</h2>
+<h2 id="6211">TDateFormat</h2>
<p>Formatting localized date and time is straight forward.</p>
<com:TTextHighlighter Language="prado" CssClass="source">
&lt;com:TDateFormat Value="12/01/2005" /&gt;
@@ -254,7 +254,7 @@ Format Pattern Result
<p>If the <tt>Value</tt> property is not specified, the current date and time is used.</p>
-<h2>TNumberFormat</h2>
+<h2 id="6212">TNumberFormat</h2>
<p>PRADO's Internationalization framework provide localized currency formatting and number formatting. Please note that the <tt>TNumberFormat</tt> component provides formatting only, it does not perform current conversion or exchange.</p>
<p>Numbers can be formatted as currency, percentage, decimal or scientific
@@ -310,7 +310,7 @@ Pattern Output
</com:TTextHighlighter>
</p>
-<h2>TTranslateParameter</h2>
+<h2 id="6213">TTranslateParameter</h2>
<p>Compound messages, i.e., string substitution, can be accomplished with <tt>TTranslateParameter</tt>.
In the following example, the strings "{greeting}" and "{name}" will be replace
with the values of "Hello" and "World", respectively.The substitution string must be enclose with "{" and "}". The parameters can be further translated by using <tt>TTranslate</tt>.
@@ -325,7 +325,7 @@ with the values of "Hello" and "World", respectively.The substitution string mus
<a name="choice-format"></a>
-<h2>TChoiceFormat</h2>
+<h2 id="6214">TChoiceFormat</h2>
<p>Using the <tt>localize</tt> function or <tt>TTranslate</tt> component to translate messages does not inform the translator the cardinality of the data required to determine the correct plural structure to use. It only informs them that there is a variable data, the data could be anything. Thus, the translator will be unable to determine with respect to the substitution data the correct plural, language structure or phrase to use . E.g. in English, to translate the sentence, "There are {number} of apples.", the resulting translation should be different depending on the <tt>number</tt> of apples.</p>