From f4de82bcdafba51e4eed9cae6b2d3e5375ffd115 Mon Sep 17 00:00:00 2001
From: xue <>
Date: Tue, 9 May 2006 12:11:38 +0000
Subject:
---
.../quickstart/protected/pages/Advanced/I18N.page | 28 +++++++++++-----------
1 file changed, 14 insertions(+), 14 deletions(-)
(limited to 'demos/quickstart/protected/pages/Advanced/I18N.page')
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 @@
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. 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
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). To enable the localization features in Prado, you need to add a few configuration options in your application configuration.
First you need to include the System.I18N.* namespace to your paths.
Internationalization (I18N) and Localization (L10N)
+Internationalization (I18N) and Localization (L10N)
Separate culture/locale sensitive data
+Separate culture/locale sensitive data
Configuration
+Configuration
The translation message catalogue file, if using type="XLIFF", 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.
Once globalization is enabled, you can access the globalization settings, such as, Culture, Charset, etc, using
The localize 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 $sender (assuming, say, the sender is a button). The original code before localization is as follows.
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.
The following sample demonstrates the basics of localization in Prado.
Messages and strings can be localized in PHP or in templates. To translate a message or string in the template, use TTranslate.
@@ -164,7 +164,7 @@ The time is {time}. <com:TLabel Text="<%[ Hello World! ]%>" />Formatting localized date and time is straight forward.
If the Value property is not specified, the current date and time is used.
-PRADO's Internationalization framework provide localized currency formatting and number formatting. Please note that the TNumberFormat component provides formatting only, it does not perform current conversion or exchange.
Numbers can be formatted as currency, percentage, decimal or scientific @@ -310,7 +310,7 @@ Pattern Output
Compound messages, i.e., string substitution, can be accomplished with TTranslateParameter. 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 TTranslate. @@ -325,7 +325,7 @@ with the values of "Hello" and "World", respectively.The substitution string mus -
Using the localize function or TTranslate 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 number of apples.
-- cgit v1.2.3