diff options
author | wei <> | 2006-01-29 04:53:43 +0000 |
---|---|---|
committer | wei <> | 2006-01-29 04:53:43 +0000 |
commit | fe229dbb1a4fc2b5569063a6fefc3ca1c493a1b5 (patch) | |
tree | 3fb3b239c60c170fc7b34edad2f1104d1df5b9cf | |
parent | 2dda03e2a747d03b71d041e70f3ff04420d80287 (diff) |
Add I18N Sample.
24 files changed, 1516 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes index e1848a24..e3929346 100644 --- a/.gitattributes +++ b/.gitattributes @@ -51,6 +51,29 @@ demos/quickstart/protected/pages/Advanced/I18N.page -text demos/quickstart/protected/pages/Advanced/Logging.page -text demos/quickstart/protected/pages/Advanced/MasterContent.page -text demos/quickstart/protected/pages/Advanced/Performance.page -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.de.page -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.es.page -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.fr.page -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.page -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.php -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.pl.page -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.zh.page -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/LanguageList.php -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/LanguageList.tpl -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/config.xml -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.de.xml -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.en.xml -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.es.xml -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.fr.xml -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.pl.xml -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.zh.xml -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.de.xml -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.en.xml -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.es.xml -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.fr.xml -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.pl.xml -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.zh.xml -text +demos/quickstart/protected/pages/Advanced/Samples/I18N/zh_TW/Home.page -text demos/quickstart/protected/pages/Advanced/State.page -text demos/quickstart/protected/pages/Advanced/Themes.page -text demos/quickstart/protected/pages/Advanced/exception.gif -text diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.de.page b/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.de.page new file mode 100644 index 00000000..159c5d54 --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.de.page @@ -0,0 +1,152 @@ +<%@ Title="Internationalisierung in PRADO "
+ Page.Application.Globalization.TranslationCatalogue="index" %>
+<com:TContent ID="body">
+<h1>Internationalisierung in PRADO </h1>
+<p>Diese Demo zeigt die grundlegenden Bestandteile, die in PRADO für den Prozess der Internationalisierung und regionalen Anpassung von Web-Anwendungen vorhanden sind. Das Beispiel verwendet mehrere sprachlich (bzw. kulturell) angepasste Templates, um eine lokalisierte Seite anzuzeigen. Um eine anderssprachige Version anzusehen, ändern Sie bitte die Spracheinstellungen in Ihrem Webbrowser.</p>
+
+<p>
+ Ihre aktuelle Kultur ist
+<%= $this->Page->CurrentCulture %>.
+<div class="links">
+ Vorhandene Sprachversionen:
+ <com:LanguageList />
+</div>
+</p>
+
+<p>
+Weiter mit dem Thema kulturell angepasster Templates. Text kann unter Zuhilfenahme vieler unterschiedlicher Übersetzungsquellen lokalisiert werden. PRADO stellt gettext-, XML-, SQLite- und MySQL-Container für die Speicherung von Nachrichtenübersetzungen zur Verfügung. Das Beispiel im folgenden Link zeigt, wie Text mit der TTranslate-Komponente lokalisiert werden kann.
+<hr />
+<h2>Einleitung </h2>
+<p> Entwicklung und Wartung mehrsprachiger Sites ist ein weitverbreitetes Problem fÜr Web-Entwickler.</p>
+<dl>
+<dt><strong>Internationalisierung (I18N)</strong></dt>
+<dd> Prozess der Entwicklung eines Produktes, so dass es mit Daten in unterschiedlichen Sprachen funktioniert und an verschiedene Zielmärkte ohne Technikänderungen angepasst werden kann. </dd>
+<dt><strong>Lokalisation (L10N)</strong></dt>
+<dd>Nachfolgender Prozess der Übersetzung und Anpassung eines Produktes an die kulturellen Konventionen eines gegebenen Marktes.</dd>
+</dl>
+<p> Die folgenden Merkmale werden von PRADO unterstützt: </p>
+<ul>
+ <li>Textübersetzung </li>
+ <li>Attributübersetzung (noch zu implementieren) </li>
+ <li>Parameteraustausch (falls erforderlich mit Übersetzung) </li>
+ <li>Datums-, Zahlen- und Währungsformatierung</li>
+ </ul>
+<h2>Beispiele </h2>
+<h3>Datum: volles Muster, Kultur en_GB</h3>
+<h4>Beispiel: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time1" Pattern="full" Culture="en_GB"/>
+</com:TTextHighlighter>
+<h4>Resultat: </h4>
+<com:TDateFormat ID="Time1" Pattern="full" Culture="en_GB"/> <br />
+<hr />
+
+<h3>Datum: kurzes Muster</h3>
+<h4>Beispiel:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time2" Pattern="short" />
+</com:TTextHighlighter>
+<h4>Resultat: </h4>
+<com:TDateFormat ID="Time2" Pattern="short" /> <br />
+<hr />
+
+<h3>Datum: Standardmuster von <%= $this->Page->CurrentCulture %> </h3>
+<h4>Beispiel:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time3" Value="2004/12/06" />
+</com:TTextHighlighter>
+<h4>Resultat: </h4>
+<com:TDateFormat ID="Time3" Value="2004/12/06" /> <br />
+<hr />
+
+<h3>Währung Standardformat </h3>
+<h4>Beispiel: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat Type="currency" Value="12.4" />
+</com:TTextHighlighter>
+<h4>Resultat: </h4>
+<com:TNumberFormat Type="currency" Value="12.4" /> <br />
+
+<hr />
+
+<h3>Währung, Kultur de_DE mit Euro </h3>
+<h4>Beispiel: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat ID="Number2" Type="currency" Culture="de_DE" Currency="EUR"/>
+</com:TTextHighlighter>
+<h4>Resultat: </h4>
+<com:TNumberFormat ID="Number2" Type="currency" Culture="de_DE" Currency="EUR"/> <br />
+
+<hr />
+
+<h3>Währung, US-Format mit Euro </h3>
+<h4>Beispiel: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" />
+</com:TTextHighlighter>
+<h4>Resultat: </h4>
+<com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" /> <br />
+<hr />
+
+<h3>Übersetzungsbeispiele </h3>
+<h4>Beispiel: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate>Hello</com:TTranslate>
+</com:TTextHighlighter>
+<h4>Resultat: </h4>
+<com:TTranslate>Hello</com:TTranslate> <br />
+<h4>Beispiel: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate Text="Goodbye" />
+</com:TTextHighlighter>
+<h4>Resultat: </h4>
+<com:TTranslate Text="Goodbye" /> <br />
+
+<hr />
+<h3>Using localization tag</h3>
+<h4>Example:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<%[ Goodbye ]%>
+</com:TTextHighlighter>
+
+<h4>Result:</h4>
+<%[ Goodbye ]%>
+<br />
+
+<hr />
+<h3>Übersetzung mit Verwendung eines anderen Kataloges</h3>
+<h4>Beispiel: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate Text="Goodbye" Catalogue="tests" />
+</com:TTextHighlighter>
+<h4>Resultat: </h4>
+<com:TTranslate Text="Goodbye" Catalogue="tests" />
+<br />
+
+
+<hr />
+<h3>Übersetzung mit Parameteraustausch </h3>
+<h4>Beispiel: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate>
+ {greeting} {name}!, The unix-time is "{time}".
+ <com:TTranslateParameter Key="name">
+ <com:TTranslate Catalogue="tests" Text="World" />
+ </com:TTranslateParameter>
+ <com:TTranslateParameter Key="greeting" Value="Hello" />
+ <com:TTranslateParameter Key="time" Value="<%= Time() %>" />
+</com:TTranslate>
+</com:TTextHighlighter>
+
+<h4>Resultat: </h4>
+
+<com:TTranslate>
+ {greeting} {name}!, The unix-time is "{time}".
+ <com:TTranslateParameter Key="name">
+ <com:TTranslate Catalogue="tests" Text="World" />
+ </com:TTranslateParameter>
+ <com:TTranslateParameter Key="greeting" Value="Hello" />
+ <com:TTranslateParameter Key="time" Value="<%= Time() %>" />
+</com:TTranslate>
+
+</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.es.page b/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.es.page new file mode 100644 index 00000000..31e7de07 --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.es.page @@ -0,0 +1,150 @@ +<%@ Title="Internationlization en PRADO "
+ Page.Application.Globalization.TranslationCatalogue="index" %>
+<com:TContent ID="body">
+<h1>Internationlization en PRADO </h1>
+<p> Esta versión parcial de programa muestra los componentes básicos disponibles en PRADO para el proceso de internacionalizar y de localizar aplicaciones del Web. Esta paginación utiliza modelos enterados múltiples del locale (o cultura) para mostrar la paginación localizada apropiada. Para visión una diversa versión localizada, cambie por favor sus configuraciones del lenguaje en su browser. </p>
+
+<p>
+ Su cultura actual es
+<%= $this->Page->CurrentCulture %>.
+<div class="links">
+ Versiones localizadas disponibles:
+ <com:LanguageList />
+</div>
+</p>
+
+<p>
+ Además de modelo enterado de la cultura. El texto se puede localizar usando muchas diversas fuentes de la traducción. PRADO proporciona al gettext, al envase de XML, de SQLite, y de MySQL para salvar traducciones del mensaje. El ejemplo en la conexión siguiente demuestra cómo el texto se puede localizar usando el componente de TTranslate.
+<hr />
+<h2>Introducción </h2>
+<p> Que desarrolla y que los mantiene el multi-lenguaje sitios es un problema común para los reveladores del Web.</p>
+<dl>
+<dt><strong>Internacionalización (I18N)</strong></dt>
+<dd> Proceso de desarrollar un producto de una manera tal que trabaje con datos en diversos lenguajes y pueda ser adaptado a los varios mercados de blanco sin cambios de ingeniería. </dd>
+<dt><strong>Localización (L10N)</strong></dt>
+<dd> Proceso subsecuente de traducir y de adaptar un producto a las convenciones culturales de un mercado dado. </dd>
+</dl>
+<p> Las características siguientes son utilizadas por PRADO: </p>
+<ul>
+ <li>Traducción del texto </li>
+ <li>Traducción del atributo (todo) </li>
+ <li>Substitución de parámetro (con la traducción si es necesario) </li>
+ <li>Fecha, número y formato de la modernidad </li>
+ </ul>
+<h2>Ejemplos </h2>
+<h3>Fecha: modelo completo, cultura del en_GB </h3>
+<h4>Ejemplo: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time1" Pattern="full" Culture="en_GB"/>
+</com:TTextHighlighter>
+<h4>Resultado: </h4>
+<com:TDateFormat ID="Time1" Pattern="full" Culture="en_GB"/> <br />
+<hr />
+
+<h3>Fecha: modelo corto </h3>
+<h4>Ejemplo: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time2" Pattern="short" />
+</com:TTextHighlighter>
+<h4>Resultado: </h4>
+<com:TDateFormat ID="Time2" Pattern="short" /> <br />
+<hr />
+
+<h3>Modelo del valor por defecto de la fecha del <%= $this->Page->CurrentCulture %> </h3>
+<h4>Ejemplo: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time3" Value="2004/12/06" />
+</com:TTextHighlighter>
+<h4>Resultado: </h4>
+<com:TDateFormat ID="Time3" Value="2004/12/06" /> <br />
+<hr />
+
+<h3>Formato del valor por defecto de la modernidad </h3>
+<h4>Ejemplo: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat Type="currency" Value="12.4" />
+</com:TTextHighlighter>
+<h4>Resultado: </h4>
+<com:TNumberFormat Type="currency" Value="12.4" /> <br />
+<hr />
+<h3>Modernidad, cultura del de_DE con el Euro </h3>
+<h4>Ejemplo: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat ID="Number2" Type="currency" Culture="de_DE" Currency="EUR"/>
+</com:TTextHighlighter>
+<h4>Resultado: </h4>
+<com:TNumberFormat ID="Number2" Type="currency" Culture="de_DE" Currency="EUR"/> <br />
+
+<hr />
+
+<h3>Modernidad, formato de los E.E.U.U. con el Euro </h3>
+<h4>Ejemplo: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" />
+</com:TTextHighlighter>
+<h4>Resultado: </h4>
+<com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" /> <br />
+<hr />
+
+<h3>Ejemplos de la traducción </h3>
+<h4>Ejemplo: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate>Hello</com:TTranslate>
+</com:TTextHighlighter>
+<h4>Resultado: </h4>
+<com:TTranslate>Hello</com:TTranslate> <br />
+<h4>Ejemplo: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate Text="Goodbye" />
+</com:TTextHighlighter>
+<h4>Resultado: </h4>
+<com:TTranslate Text="Goodbye" /> <br />
+
+<hr />
+<h3>Using localization tag</h3>
+<h4>Example:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<%[ Goodbye ]%>
+</com:TTextHighlighter>
+
+<h4>Result:</h4>
+<%[ Goodbye ]%>
+<br />
+
+<hr />
+<h3>Traducción usando un diverso catálogo </h3>
+<h4>Ejemplo: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate Text="Goodbye" Catalogue="tests" />
+</com:TTextHighlighter>
+<h4>Resultado: </h4>
+<com:TTranslate Text="Goodbye" Catalogue="tests" />
+<br />
+
+
+<hr />
+<h3>Traducción con la substitución de parámetro </h3>
+<h4>Ejemplo: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate>
+ {greeting} {name}!, The unix-time is "{time}".
+ <com:TTranslateParameter Key="name">
+ <com:TTranslate Catalogue="tests" Text="World" />
+ </com:TTranslateParameter>
+ <com:TTranslateParameter Key="greeting" Value="Hello" />
+ <com:TTranslateParameter Key="time" Value="<%= Time() %>" />
+</com:TTranslate>
+</com:TTextHighlighter>
+
+<h4>Resultado: </h4>
+
+<com:TTranslate>
+ {greeting} {name}!, The unix-time is "{time}".
+ <com:TTranslateParameter Key="name">
+ <com:TTranslate Catalogue="tests" Text="World" />
+ </com:TTranslateParameter>
+ <com:TTranslateParameter Key="greeting" Value="Hello" />
+ <com:TTranslateParameter Key="time" Value="<%= Time() %>" />
+</com:TTranslate>
+
+</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.fr.page b/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.fr.page new file mode 100644 index 00000000..66d01c90 --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.fr.page @@ -0,0 +1,202 @@ +<%@ Title="Internationalisation dans PRADO"
+ Page.Application.Globalization.TranslationCatalogue="index" %>
+<com:TContent ID="body">
+ <h1>Internationalisation avec PRADO
+ </h1>
+ <p>
+ Cette démonstration présente les composants de base fournis
+ par PRADO pour le processus d'internationalisation et de localisation des
+ applications Web. Cette page utilise plusieurs gabarits en fonction de la
+ localisation (ou de la culture) pour afficher le contenu approprié. Pour
+ afficher une version localisée différente, veuillez changer la configuration
+ des langues dans votre navigateur.
+ </p>
+ <p>
+ Votre culture actuelle est <%= $this->Page->CurrentCulture %>.
+ <div class="links">
+ Versions localisées disponibles :
+ <com:LanguageList />
+ </div>
+ <P></P>
+ <p>
+ En plus du support de la culture dans les gabarits, le contenu peut être
+ localisé en utilisant différentes sources de traduction. PRADO permet
+ d'utiliser gettext, XML, SQLite et MySQL pour enregistrer les traductions des
+ messages. L'exemple suivant montre comment le texte peut être localisé en
+ utilisant le composant TTranslate.
+ <hr>
+ <h2>Introduction
+ </h2>
+ <p>
+ Développer et mettre à jour un site multi-langues est un problème classique
+ pour les développeurs de sites Web.</p>
+ <dl>
+ <dt><strong>Internationalisation (I18N)</strong>
+ <dd>
+ Processus de développement d'un produit de telle manière qu'il fonctionne avec
+ des données dans différentes langues et puisse être adapté à
+ diverses cibles culturelles sans changement technique. <dt><strong>Localisation
+ (L10N)</strong>
+ <dd>
+ Processus ultérieur de traduction et d'adaptation d'un produit aux conventions
+ culturelles d'un marché donné.
+ </dd>
+ </dl>
+ <p>
+ PRADO offrent les fonctionnalités suivantes :
+ </p>
+ <ul>
+ <li>
+ Traduction de contenu
+ <li>
+ Traduction des attributs (à faire)
+ <li>
+ Substitution des paramètres (avec traduction si nécessaire)
+ <li>
+ Date, nombre et formatage des devises
+ </li>
+ </ul>
+ <h2>Exemples</h2>
+ <h3>Date : format long, culture en_GB</h3>
+ <h4>Exemple :
+ </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time1" Pattern="full" Culture="en_GB"/>
+</com:TTextHighlighter>
+ <h4>Résultat :
+ </h4>
+ <com:TDateFormat ID="Time1" Pattern="full" Culture="en_GB" />
+ <br>
+ <hr>
+ <h3>Date : format court
+ </h3>
+ <h4>Exemple :
+ </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time2" Pattern="short" />
+</com:TTextHighlighter>
+ <h4>Résultat :
+ </h4>
+ <com:TDateFormat ID="Time2" Pattern="short" />
+ <br>
+ <hr>
+ <h3>Format par défaut d'une date pour la culture
+ <%= $this->Page->CurrentCulture %>
+ </h3>
+ <h4>Exemple :
+ </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time3" Value="2004/12/06" />
+</com:TTextHighlighter>
+ <h4>Résultat :
+ </h4>
+<com:TDateFormat ID="Time3" Value="2004/12/06" /> <br />
+ <br>
+ <hr>
+ <h3>Format par défaut d'une devise
+ </h3>
+ <h4>Exemple :
+ </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat Type="currency" Value="12.4" />
+</com:TTextHighlighter>
+ <h4>Résultat :
+ </h4>
+<com:TNumberFormat Type="currency" Value="12.4" /> <br />
+ <br>
+ <hr>
+ <h3>Devise : culture de_DE avec devise Euro
+ </h3>
+ <h4>Exemple :
+ </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat ID="Number2" Type="currency" Culture="de_DE" Currency="EUR"/>
+</com:TTextHighlighter>
+ <h4>Résultat :
+ </h4>
+ <com:TNumberFormat ID="Number2" Type="currency" Culture="de_DE" Currency="EUR" />
+ <br>
+ <hr>
+ <h3>Devise : culture en_US avec devise Euro
+ </h3>
+ <h4>Exemple :
+ </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" />
+</com:TTextHighlighter>
+ <h4>Résultat
+ </h4>
+ <com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" />
+ <br>
+ <hr>
+ <h3>Exemples de traduction
+ </h3>
+ <h4>Exemple :
+ </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate>Hello</com:TTranslate>
+</com:TTextHighlighter>
+ <h4>Résultat :
+ </h4>
+ <com:TTranslate>Hello</com:TTranslate>
+ <br>
+ <h4>Exemple :
+ </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate Text="Goodbye" />
+</com:TTextHighlighter>
+ <h4>Résultat :
+ </h4>
+ <com:TTranslate Text="Goodbye" />
+ <br>
+
+<hr />
+<h3>Using localization tag</h3>
+<h4>Example:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<%[ Goodbye ]%>
+</com:TTextHighlighter>
+
+<h4>Result:</h4>
+<%[ Goodbye ]%>
+<br />
+
+
+ <hr>
+ <h3>Traduction en utilisant un catalogue différent</h3>
+ <h4>Exemple :
+ </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate Text="Goodbye" Catalogue="tests" />
+</com:TTextHighlighter>
+ <h4>Résultat :
+ </h4>
+<com:TTranslate Text="Goodbye" Catalogue="tests" />
+ <br>
+ <hr>
+ <h3>Traduction avec substitution de paramètres
+ </h3>
+ <h4>Exemple :
+ </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate>
+ {greeting} {name}!, The unix-time is "{time}".
+ <com:TTranslateParameter Key="name">
+ <com:TTranslate Catalogue="tests" Text="World" />
+ </com:TTranslateParameter>
+ <com:TTranslateParameter Key="greeting" Value="Hello" />
+ <com:TTranslateParameter Key="time" Value="<%= Time() %>" />
+</com:TTranslate>
+</com:TTextHighlighter>
+ <h4>Résultat :
+ </h4>
+<com:TTranslate>
+ {greeting} {name}!, The unix-time is "{time}".
+ <com:TTranslateParameter Key="name">
+ <com:TTranslate Catalogue="tests" Text="World" />
+ </com:TTranslateParameter>
+ <com:TTranslateParameter Key="greeting" Value="Hello" />
+ <com:TTranslateParameter Key="time" Value="<%= Time() %>" />
+</com:TTranslate>
+
+</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.page b/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.page new file mode 100644 index 00000000..466bbca8 --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.page @@ -0,0 +1,161 @@ +<%@ Title="Internationlization in PRADO"
+ Page.Application.Globalization.TranslationCatalogue="index" %>
+<com:TContent ID="body">
+
+<h1>Internationlization in PRADO</h1>
+<p>This demo shows the basic components available in PRADO for the process of Internationalizing and Localizing web applications. This page utilize multiple locale (or culture) aware templates to show the appropriate localized page. To view a different localized version, please change your language settings in your browser.</p>
+
+<p>
+Your current culture is <%= $this->Page->CurrentCulture %>.
+<div class="links">
+ Available localized versions:
+ <com:LanguageList />
+</div>
+</p>
+
+<p>
+ In addition to culture aware template. Text can be localized using many different translation sources. PRADO provides gettext, XML, SQLite, and MySQL container for storing message translations. The example in the following link demonstrates how text can be localized using the TTranslate component.
+</p>
+<hr />
+<h2>Introduction</h2>
+<p> Developing and maintaining multi-language sites is a common problem for web developers. </p>
+<dl>
+<dt><strong>Internationalization (I18N)</strong></dt>
+<dd>Process of developing a product in such a way that it works with data in different languages and can be adapted to various target markets without engineering changes. </dd>
+<dt><strong>Localization (L10N)</strong></dt>
+<dd>Subsequent process of translating and adapting a product to a given market's cultural conventions.</dd>
+</dl>
+<p>The following features are supported by PRADO: </p>
+<ul>
+ <li>Text translation</li>
+ <li>Attribute translation</li>
+ <li>Parameter substitution (with translation if needed) </li>
+ <li>Date, number and currency formatting </li>
+</ul>
+<h2>Examples</h2>
+<h3>Date: full pattern, en_GB culture</h3>
+<h4>Example:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time1" Pattern="full" Culture="en_GB"/>
+</com:TTextHighlighter>
+<h4>Result:</h4>
+<com:TDateFormat ID="Time1" Pattern="full" Culture="en_GB"/> <br />
+<hr />
+
+<h3>Date: short pattern</h3>
+<h4>Example:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time2" Pattern="short" />
+</com:TTextHighlighter>
+
+<h4>Result:</h4>
+<com:TDateFormat ID="Time2" Pattern="short" /> <br />
+<hr />
+
+<h3>Date default pattern of <%= $this->Page->CurrentCulture %> </h3>
+<h4>Example:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time3" Value="2004/12/06" />
+</com:TTextHighlighter>
+
+<h4>Result:</h4>
+<com:TDateFormat ID="Time3" Value="2004/12/06" /> <br />
+<hr />
+
+<h3>Currency default format</h3>
+<h4>Example:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat Type="currency" Value="12.4" />
+</com:TTextHighlighter>
+
+<h4>Result:</h4>
+<com:TNumberFormat Type="currency" Value="12.4" /> <br />
+<hr />
+<h3>Currency, de_DE culture with Euro</h3>
+<h4>Example:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat ID="Number2" Type="currency" Culture="de_DE" Currency="EUR"/>
+</com:TTextHighlighter>
+
+<h4>Result:</h4>
+<com:TNumberFormat ID="Number2" Type="currency" Culture="de_DE" Currency="EUR"/> <br />
+
+<hr />
+
+<h3>Currency, US format with Euro</h3>
+<h4>Example:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" />
+</com:TTextHighlighter>
+
+<h4>Result</h4>
+<com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" /> <br />
+<hr />
+
+<h3>Translation examples</h3>
+<h4>Example:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate>Hello</com:TTranslate>
+</com:TTextHighlighter>
+
+<h4>Result:</h4>
+<com:TTranslate>Hello</com:TTranslate> <br />
+<h4>Example:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate Text="Goodbye" />
+</com:TTextHighlighter>
+
+<h4>Result:</h4>
+<com:TTranslate Text="Goodbye" /> <br />
+
+<hr />
+<h3>Using localization tag</h3>
+<h4>Example:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<%[ Goodbye ]%>
+</com:TTextHighlighter>
+
+<h4>Result:</h4>
+<%[ Goodbye ]%>
+<br />
+
+
+<hr />
+<h3>Translation using a different catalogue </h3>
+<h4>Example:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate Text="Goodbye" Catalogue="tests" />
+</com:TTextHighlighter>
+
+<h4>Result:</h4>
+<com:TTranslate Text="Goodbye" Catalogue="tests" />
+<br />
+
+
+<hr />
+<h3>Translation with parameter substitution</h3>
+<h4>Example:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate>
+ {greeting} {name}!, The unix-time is "{time}".
+ <com:TTranslateParameter Key="name">
+ <com:TTranslate Catalogue="tests" Text="World" />
+ </com:TTranslateParameter>
+ <com:TTranslateParameter Key="greeting" Value="Hello" />
+ <com:TTranslateParameter Key="time" Value="<%= Time() %>" />
+</com:TTranslate>
+</com:TTextHighlighter>
+
+
+<h4>Result:</h4>
+
+<com:TTranslate>
+ {greeting} {name}!, The unix-time is "{time}".
+ <com:TTranslateParameter Key="name">
+ <com:TTranslate Catalogue="tests" Text="World" />
+ </com:TTranslateParameter>
+ <com:TTranslateParameter Key="greeting" Value="Hello" />
+ <com:TTranslateParameter Key="time" Value="<%= Time() %>" />
+</com:TTranslate>
+
+</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.php b/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.php new file mode 100644 index 00000000..9d3a7e99 --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.php @@ -0,0 +1,43 @@ +<?php
+
+class Home extends TPage
+{
+ /**
+ * Change the globalization culture using value from request "lang" parameter.
+ */
+ public function __construct()
+ {
+ $lang = $this->Request['lang'];
+ if(CultureInfo::validCulture($lang)) //only valid lang is permitted
+ $this->Application->Globalization->Culture = $lang;
+ parent::__construct();
+ }
+
+ /**
+ * Initialize the page with some arbituary data.
+ * @param TEventParameter event parameter.
+ */
+ function onLoad($param)
+ {
+ $time1 = $this->Time1;
+ $time1->Value = time();
+
+ $number2 = $this->Number2;
+ $number2->Value = 46412.416;
+
+ $this->dataBind();
+ }
+
+ /**
+ * Get the localized current culture name.
+ * @return string localized curreny culture name.
+ */
+ function getCurrentCulture()
+ {
+ $culture = $this->Application->getGlobalization()->Culture;
+ $cultureInfo = new CultureInfo($culture);
+ return $cultureInfo->NativeName;
+ }
+}
+
+?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.pl.page b/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.pl.page new file mode 100644 index 00000000..61882fee --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.pl.page @@ -0,0 +1,149 @@ +<%@ Title="Internacjonalizacja w PRADO"
+ Page.Application.Globalization.TranslationCatalogue="index" %>
+<com:TContent ID="body">
+<h1>Internacjonalizacja w PRADO</h1>
+<p>Ten przykład pokazuje podstawowe komponenty PRADO używane w procesach Internacjonalizacji i Lokalizacji aplikacji webowych. Ta strona używa wielu zlokalizowanych, pod względem językowo-kulturowym, szablonów aby wyświetlić właściwe tłumaczenie. Aby zobaczyć inne lokalizacje, musisz zmienić ustawienia językowe w swojej przeglądarce.
+</p>
+
+<p>
+Twoim obecnym językiem jest: <%= $this->Page->CurrentCulture %>.
+<div class="links">
+ Dostępne lokalizacje:
+ <com:LanguageList />
+</div>
+</p>
+
+<p>
+ Nawiązanie do szablonów kulturowo-językowych. Tekst może zostać zlokalizowany przy użyciu wielu źródeł tłumaczeń. PRADO umożliwia przechowywanie tłumaczeń przy pomocy następujących modułów: gettext, XML, SQLite oraz MySQL. Przykład do którego prowadzi poniższy odnośnik pokazuje jak można zlokalizować treść używając kontrolki TTranslate.
+<hr />
+<h2>Wstęp</h2>
+<p> Tworzenie i utrzymywanie wielojęzykowych serwisów to problem który trapi wielu programistów. </p>
+<dl>
+<dt><strong>Internacjonalizacja (I18N)</strong></dt>
+<dd> To proces takiego przygotowania produktu aby mógł operować na danych w różnych językach, na wielu rynkach bez konieczności zmian w nim samym. </dd>
+<dt><strong>Lokalizacja (L10N)</strong></dt>
+<dd> To kolejny etap, jest to proces tłumaczenia i dostosowywania produktu do konkretnych wymagań językowo-kulturowych.</dd>
+</dl>
+<p>PRADO obsługuje następujące mechanizmy: </p>
+<ul>
+ <li>Tłumaczenie tekstu </li>
+ <li>Tłumaczenie atrybutów (todo) </li>
+ <li>Podstawianie parametrów (wraz z koniecznym tłumaczeniem) </li>
+ <li>Formatowanie dat, liczb i walut </li>
+</ul>
+<h2>Przykłady</h2>
+<h3>Data: pełny format językowo-kulturowy: en_GB</h3>
+<h4>Przykład:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time1" Pattern="full" Culture="en_GB"/>
+</com:TTextHighlighter>
+<h4>Wynik:</h4>
+<com:TDateFormat ID="Time1" Pattern="full" Culture="en_GB"/> <br />
+<hr />
+
+<h3>Data: format krótki</h3>
+<h4>Przykład:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time2" Pattern="short" />
+</com:TTextHighlighter>
+<h4>Wynik:</h4>
+<com:TDateFormat ID="Time2" Pattern="short" /> <br />
+<hr />
+
+<h3>Domyślny format daty dla języka: <%= $this->Page->CurrentCulture %> </h3>
+<h4>Przykład:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time3" Value="2004/12/06" />
+</com:TTextHighlighter>
+<h4>Wynik:</h4>
+<com:TDateFormat ID="Time3" Value="2004/12/06" /> <br />
+<hr />
+
+<h3>Domyślny format waluty</h3>
+<h4>Przykład:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat Type="currency" Value="12.4" />
+</com:TTextHighlighter>
+<h4>Wynik:</h4>
+<com:TNumberFormat Type="currency" Value="12.4" /> <br />
+<hr />
+<h3>Waluty, format językowo-kulturowy de_DE w Euro</h3>
+<h4>Przykład:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat ID="Number2" Type="currency" Culture="de_DE" Currency="EUR"/>
+</com:TTextHighlighter>
+<h4>Wynik:</h4>
+<com:TNumberFormat ID="Number2" Type="currency" Culture="de_DE" Currency="EUR"/> <br />
+
+<hr />
+
+<h3>Waluty, format Amerykański w Euro</h3>
+<h4>Przykład:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" />
+</com:TTextHighlighter>
+<h4>Wynik</h4>
+<com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" /> <br />
+<hr />
+
+<h3>Tłumaczenia</h3>
+<h4>Przykład:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate>Hello</com:TTranslate>
+</com:TTextHighlighter>
+<h4>Wynik:</h4>
+<com:TTranslate>Hello</com:TTranslate> <br />
+<h4>Przykład:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate Text="Goodbye" />
+</com:TTextHighlighter>
+<h4>Wynik:</h4>
+<com:TTranslate Text="Goodbye" /> <br />
+
+<hr />
+<h3>Using localization tag</h3>
+<h4>Example:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<%[ Goodbye ]%>
+</com:TTextHighlighter>
+
+<h4>Result:</h4>
+<%[ Goodbye ]%>
+<br />
+
+<hr />
+<h3>Tłumaczenie z wykorzystaniem innego katalogu </h3>
+<h4>Przykład:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate Text="Goodbye" Catalogue="tests" />
+</com:TTextHighlighter>
+<h4>Wynik:</h4>
+<com:TTranslate Text="Goodbye" Catalogue="tests" />
+<br />
+
+
+<hr />
+<h3>Tłumaczenie z wykorzystanie podstawiania parametru</h3>
+<h4>Przykład:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate>
+ {greeting} {name}!, The unix-time is "{time}".
+ <com:TTranslateParameter Key="name">
+ <com:TTranslate Catalogue="tests" Text="World" />
+ </com:TTranslateParameter>
+ <com:TTranslateParameter Key="greeting" Value="Hello" />
+ <com:TTranslateParameter Key="time" Value="<%= Time() %>" />
+</com:TTranslate>
+</com:TTextHighlighter>
+<h4>Wynik:</h4>
+
+<com:TTranslate>
+ {greeting} {name}!, The unix-time is "{time}".
+ <com:TTranslateParameter Key="name">
+ <com:TTranslate Catalogue="tests" Text="World" />
+ </com:TTranslateParameter>
+ <com:TTranslateParameter Key="greeting" Value="Hello" />
+ <com:TTranslateParameter Key="time" Value="<%= Time() %>" />
+</com:TTranslate>
+
+</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.zh.page b/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.zh.page new file mode 100644 index 00000000..959f0b8e --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.zh.page @@ -0,0 +1,156 @@ +<%@ Title="PRADO 国际化"
+ Page.Application.Globalization.TranslationCatalogue="index" %>
+<com:TContent ID="body">
+
+<h1>PRADO 国际化</h1>
+<p>本演示将介绍如何用PRADO中的一些部件对您的Web应用进行国际化和本地化。
+本网页的显示是根据您的当地设置从多个不同语言的模板中选择进行的。
+如果你想查看其它语言版本,请更改浏览器的语言设置。</p>
+
+<p>
+您目前的语言设置是
+<%= $this->Page->CurrentCulture %>.
+<div class="links">
+可查看的语言版本包括:
+ <com:LanguageList />
+</div>
+</p>
+
+<p>
+除了能自动侦知语言设置的模板外,文本也可以使用不同的翻译源进行本地化。
+PRADO提供了gettext,XML,SQLite以及MySQL等手段用于存放消息的各种翻译。
+下面连接所指向的例子展示了如何使用TTranslate部件对文本进行本地化。
+<hr />
+<h2>简介</h2>
+<p>开发和维护多语言的站点对Web开发者而言是一个很常见的问题。</p>
+<dl>
+<dt><strong>国际化(I18N)</strong></dt>
+<dd>产品开发的一个步骤,它使得产品能接受不同语言的数据,并且在没有更改设计
+的情况下使产品能用于不同的市场。</dd>
+<dt><strong>L本地化(L10N)</strong></dt>
+<dd>国际化的一个细节步骤,它针对某个特定的市场文化对产品进行翻译和调整。</dd>
+</dl>
+<p>PRADO支持以下功能:</p>
+<ul>
+ <li>文本翻译</li>
+ <li>属性翻译(尚未完成)</li>
+ <li>参数替换(如需要可进行翻译)</li>
+ <li>日期,数字和货币的格式化</li>
+ </ul>
+<h2>例子</h2>
+<h3>日期:完整格式,en_GB语言设置</h3>
+<h4>例: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time1" Pattern="full" Culture="en_GB"/>
+</com:TTextHighlighter>
+<h4>结果: </h4>
+<com:TDateFormat ID="Time1" Pattern="full" Culture="en_GB"/> <br />
+<hr />
+
+<h3>日期:短格式</h3>
+<h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time2" Pattern="short" />
+</com:TTextHighlighter>
+<h4>结果:</h4>
+<com:TDateFormat ID="Time2" Pattern="short" /> <br />
+<hr />
+
+<h3>日期:<%= $this->Page->CurrentCulture %>的缺省模式</h3>
+<h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time3" Value="2004/12/06" />
+</com:TTextHighlighter>
+<h4>结果:</h4>
+<com:TDateFormat ID="Time3" Value="2004/12/06" /> <br />
+<hr />
+
+<h3>货币,缺省格式</h3>
+<h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat Type="currency" Value="12.4" />
+</com:TTextHighlighter>
+<h4>结果:</h4>
+<com:TNumberFormat Type="currency" Value="12.4" /> <br />
+<hr />
+<h3>货币,de_DE语言以及欧币</h3>
+<h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat ID="Number2" Type="currency" Culture="de_DE" Currency="EUR"/>
+</com:TTextHighlighter>
+<h4>结果:</h4>
+<com:TNumberFormat ID="Number2" Type="currency" Culture="de_DE" Currency="EUR"/> <br />
+
+<hr />
+
+<h3>货币, 美国格式以及欧币</h3>
+<h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" />
+</com:TTextHighlighter>
+<h4>结果:</h4>
+<com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" /> <br />
+<hr />
+
+<h3>翻译实例</h3>
+<h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate>Hello</com:TTranslate>
+</com:TTextHighlighter>
+<h4>结果:</h4>
+<com:TTranslate>Hello</com:TTranslate> <br />
+<h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate Text="Goodbye" />
+</com:TTextHighlighter>
+<h4>结果:</h4>
+<com:TTranslate Text="Goodbye" /> <br />
+
+<hr />
+<h3>Using localization tag</h3>
+<h4>Example:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<%[ Goodbye ]%>
+</com:TTextHighlighter>
+
+<h4>Result:</h4>
+<%[ Goodbye ]%>
+<br />
+
+<hr />
+<h3>用不同目录进行翻译</h3>
+<h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate Text="Goodbye" Catalogue="tests" />
+</com:TTextHighlighter>
+<h4>结果:</h4>
+<com:TTranslate Text="Goodbye" Catalogue="tests" />
+<br />
+
+
+<hr />
+<h3>用参数替换进行翻译</h3>
+<h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate>
+ {greeting} {name}!, The unix-time is "{time}".
+ <com:TTranslateParameter Key="name">
+ <com:TTranslate Catalogue="tests" Text="World" />
+ </com:TTranslateParameter>
+ <com:TTranslateParameter Key="greeting" Value="Hello" />
+ <com:TTranslateParameter Key="time" Value="<%= Time() %>" />
+</com:TTranslate>
+</com:TTextHighlighter>
+
+<h4>结果:</h4>
+
+<com:TTranslate>
+ {greeting} {name}!, The unix-time is "{time}".
+ <com:TTranslateParameter Key="name">
+ <com:TTranslate Catalogue="tests" Text="World" />
+ </com:TTranslateParameter>
+ <com:TTranslateParameter Key="greeting" Value="Hello" />
+ <com:TTranslateParameter Key="time" Value="<%= Time() %>" />
+</com:TTranslate>
+
+</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/LanguageList.php b/demos/quickstart/protected/pages/Advanced/Samples/I18N/LanguageList.php new file mode 100644 index 00000000..c15b2008 --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/LanguageList.php @@ -0,0 +1,19 @@ +<?php
+/**
+ * Language List
+ * @author $Author: weizhuo $
+ * @version $Id: LanguageList.php,v 1.3 2005/08/04 05:27:17 weizhuo Exp $
+ * @package prado.examples
+ */
+
+/**
+ *
+ * @author $Author: weizhuo $
+ * @version $Id: LanguageList.php,v 1.3 2005/08/04 05:27:17 weizhuo Exp $
+ */
+class LanguageList extends TTemplateControl
+{
+
+}
+
+?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/LanguageList.tpl b/demos/quickstart/protected/pages/Advanced/Samples/I18N/LanguageList.tpl new file mode 100644 index 00000000..2f919630 --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/LanguageList.tpl @@ -0,0 +1,10 @@ + <ul>
+ <li><a href="index.php?page=<%= $this->Request->ServiceParameter %>&lang=en">English</a></li>
+ <li><a href="index.php?page=<%= $this->Request->ServiceParameter %>&lang=zh">中文简体</a></li>
+ <li><a href="index.php?page=<%= $this->Request->ServiceParameter %>&lang=zh_TW">中文繁體</a></li>
+ <li><a href="index.php?page=<%= $this->Request->ServiceParameter %>&lang=de">Deutsch</a></li>
+ <li><a href="index.php?page=<%= $this->Request->ServiceParameter %>&lang=es">Español</a></li>
+ <li><a href="index.php?page=<%= $this->Request->ServiceParameter %>&lang=fr">Français</a></li>
+ <li><a href="index.php?page=<%= $this->Request->ServiceParameter %>&lang=pl">Polska</a></li>
+ </ul>
+
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/config.xml b/demos/quickstart/protected/pages/Advanced/Samples/I18N/config.xml new file mode 100644 index 00000000..e6fa03ec --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/config.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?>
+
+<configuration>
+ <paths>
+ <alias id="I18NSample" path="." />
+ <using namespace="System.I18N.*" />
+ <using namespace="I18NSample.LanguageList" />
+ </paths>
+
+ <modules>
+ <module id="globalization" class="TGlobalizationAutoDetect">
+ <translation type="XLIFF" source="I18NSample.messages" />
+ </module>
+ </modules>
+
+ <pages MasterClass="SampleLayout" />
+
+</configuration>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.de.xml b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.de.xml new file mode 100644 index 00000000..847398bd --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.de.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?>
+<xliff version="1.0">
+<!-- @author $Author: weizhuo $ -->
+<!-- @version $Id: index.de.xml,v 1.2 2005/01/02 04:40:36 weizhuo Exp $ -->
+<file orginal="I18N Example IndexPage" source-language="EN" datatype="plaintext" date="2004-12-30T18:01:42Z">
+<body>
+
+<trans-unit id="1">
+<source>Hello</source>
+<target>Hallo</target>
+</trans-unit>
+
+<trans-unit id="2">
+<source>Goodbye</source>
+<target>Auf Wiedersehen</target>
+</trans-unit>
+
+<trans-unit id="3">
+<source>World</source>
+<target>Welt</target>
+</trans-unit>
+
+<trans-unit id="4">
+<source>{greeting} {name}!, The unix-time is "{time}".</source>
+<target>{greeting} {name}!, der Unix-Zeitstempel ist "{time}".</target>
+</trans-unit>
+</body>
+</file>
+</xliff>
diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.en.xml b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.en.xml new file mode 100644 index 00000000..8620c06e --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.en.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?>
+<xliff version="1.0">
+<!-- @author $Author: weizhuo $ -->
+<!-- @version $Id: index.en.xml,v 1.2 2005/01/09 22:15:32 weizhuo Exp $ -->
+<file orginal="I18N Example IndexPage" source-language="EN" datatype="plaintext" date="2005-01-09T13:52:21Z">
+<body>
+
+<trans-unit id="1">
+<source>Hello</source>
+<target/>
+</trans-unit>
+
+<trans-unit id="2">
+<source>Goodbye</source>
+<target>bye</target>
+</trans-unit>
+
+<trans-unit id="3">
+<source>World</source>
+<target>world</target>
+</trans-unit>
+
+<trans-unit id="4">
+<source>{greeting} {name}!, The unix-time is "{time}".</source>
+<target/>
+</trans-unit>
+</body>
+</file>
+</xliff>
diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.es.xml b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.es.xml new file mode 100644 index 00000000..a4e6868c --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.es.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?>
+<xliff version="1.0">
+<!-- @author $Author: weizhuo $ -->
+<!-- @version $Id: index.es.xml,v 1.1 2004/12/29 00:52:58 weizhuo Exp $ -->
+<file orginal="I18N Example IndexPage" source-language="EN" datatype="plaintext" date="2004-12-29T11:24:28Z">
+<body>
+
+<trans-unit id="1">
+<source>Hello</source>
+<target>Hola</target>
+</trans-unit>
+
+<trans-unit id="2">
+<source>Goodbye</source>
+<target>Adiós</target>
+</trans-unit>
+
+<trans-unit id="3">
+<source>World</source>
+<target>mundo</target>
+</trans-unit>
+
+<trans-unit id="4">
+<source>{greeting} {name}!, The unix-time is "{time}".</source>
+<target>¡{greeting} {name}!, el unix-tiempo es "{time}".</target>
+</trans-unit>
+</body>
+</file>
+</xliff>
diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.fr.xml b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.fr.xml new file mode 100644 index 00000000..e43e7f5c --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.fr.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?>
+<xliff version="1.0">
+<!-- @author $Author: weizhuo $ -->
+<!-- @version $Id: index.fr.xml,v 1.3 2005/01/14 11:34:18 weizhuo Exp $ -->
+<file orginal="I18N Example IndexPage" source-language="EN" datatype="plaintext" date="2005-01-06T23:48:27Z">
+<body>
+
+<trans-unit id="1">
+<source>Hello</source>
+<target>Bonjour</target>
+</trans-unit>
+
+<trans-unit id="2">
+<source>Goodbye</source>
+<target>Au revoir</target>
+</trans-unit>
+
+<trans-unit id="3">
+<source>World</source>
+<target>le monde</target>
+</trans-unit>
+
+<trans-unit id="4">
+<source>{greeting} {name}!, The unix-time is "{time}".</source>
+<target>{greeting} {name}!, le temps unix est "{time}".</target>
+</trans-unit>
+</body>
+</file>
+</xliff>
+
diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.pl.xml b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.pl.xml new file mode 100644 index 00000000..684f21aa --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.pl.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?>
+<xliff version="1.0">
+<!-- @author $Author: weizhuo $ -->
+<!-- @version $Id: index.pl.xml,v 1.1 2004/12/29 22:27:47 weizhuo Exp $ -->
+<file orginal="I18N Example IndexPage" source-language="EN" datatype="plaintext" date="2004-12-28T17:43:42Z">
+<body>
+
+<trans-unit id="1">
+<source>Hello</source>
+<target>Witaj</target>
+</trans-unit>
+
+<trans-unit id="2">
+<source>Goodbye</source>
+<target>Żegnaj!</target>
+</trans-unit>
+
+<trans-unit id="3">
+<source>World</source>
+<target>Świecie</target>
+</trans-unit>
+
+<trans-unit id="4">
+<source>{greeting} {name}!, The unix-time is "{time}".</source>
+<target>{greeting} {name}!, Czas unixowy "{time}".</target>
+</trans-unit>
+</body>
+</file>
+</xliff>
diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.zh.xml b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.zh.xml new file mode 100644 index 00000000..38e4d174 --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/index.zh.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?>
+<xliff version="1.0">
+<!-- @author $Author: qiangxue $ -->
+<!-- @version $Id: index.zh.xml,v 1.2 2005/01/01 13:55:56 qiangxue Exp $ -->
+<file orginal="I18N Example IndexPage" source-language="EN" datatype="plaintext" date="2004-12-29T11:07:53Z">
+<body>
+
+<trans-unit id="1">
+<source>Hello</source>
+<target>你好</target>
+</trans-unit>
+
+<trans-unit id="2">
+<source>Goodbye</source>
+<target>再见</target>
+</trans-unit>
+
+<trans-unit id="3">
+<source>World</source>
+<target>世界</target>
+</trans-unit>
+
+<trans-unit id="4">
+<source>{greeting} {name}!, The unix-time is "{time}".</source>
+<target>{greeting} {name}!,Unix时间是“{time}”。</target>
+</trans-unit>
+</body>
+</file>
+</xliff>
diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.de.xml b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.de.xml new file mode 100644 index 00000000..7ec53d2a --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.de.xml @@ -0,0 +1,17 @@ +<?xml version="1.0"?>
+<xliff version="1.0">
+<!-- @author $Author: weizhuo $ -->
+<!-- @version $Id: tests.de.xml,v 1.2 2005/01/02 04:40:36 weizhuo Exp $ -->
+<file orginal="I18N Example IndexPage" source-language="EN" datatype="plaintext" date="2004-12-29T11:22:55Z">
+<body>
+<trans-unit id="1">
+<source>Goodbye</source>
+<target>Auf Wiedersehen!</target>
+</trans-unit>
+<trans-unit id="2">
+<source>World</source>
+<target>Welt</target>
+</trans-unit>
+</body>
+</file>
+</xliff>
diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.en.xml b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.en.xml new file mode 100644 index 00000000..5bfb3dd8 --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.en.xml @@ -0,0 +1,17 @@ +<?xml version="1.0"?>
+<xliff version="1.0">
+<!-- @author $Author: weizhuo $ -->
+<!-- @version $Id: tests.en.xml,v 1.1 2004/12/28 09:19:05 weizhuo Exp $ -->
+<file orginal="I18N Example IndexPage" source-language="EN" datatype="plaintext" date="2004-12-28T18:10:19Z">
+<body>
+<trans-unit id="1">
+<source>Goodbye</source>
+<target>Bye Bye!</target>
+</trans-unit>
+<trans-unit id="2">
+<source>World</source>
+<target>world</target>
+</trans-unit>
+</body>
+</file>
+</xliff>
diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.es.xml b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.es.xml new file mode 100644 index 00000000..4fa18b7c --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.es.xml @@ -0,0 +1,17 @@ +<?xml version="1.0"?>
+<xliff version="1.0">
+<!-- @author $Author: weizhuo $ -->
+<!-- @version $Id: tests.es.xml,v 1.1 2004/12/29 00:52:58 weizhuo Exp $ -->
+<file orginal="I18N Example IndexPage" source-language="EN" datatype="plaintext" date="2004-12-29T11:27:45Z">
+<body>
+<trans-unit id="1">
+<source>Goodbye</source>
+<target>¡Adiós!</target>
+</trans-unit>
+<trans-unit id="2">
+<source>World</source>
+<target>mundo</target>
+</trans-unit>
+</body>
+</file>
+</xliff>
diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.fr.xml b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.fr.xml new file mode 100644 index 00000000..9ed81872 --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.fr.xml @@ -0,0 +1,18 @@ +<?xml version="1.0"?>
+<xliff version="1.0">
+<!-- @author $Author: weizhuo $ -->
+<!-- @version $Id: tests.fr.xml,v 1.3 2005/01/14 11:34:18 weizhuo Exp $ -->
+<file orginal="I18N Example IndexPage" source-language="EN" datatype="plaintext" date="2004-12-28T18:10:19Z">
+<body>
+<trans-unit id="1">
+<source>Goodbye</source>
+<target>Au revoir !</target>
+</trans-unit>
+<trans-unit id="2">
+<source>World</source>
+<target>le monde</target>
+</trans-unit>
+</body>
+</file>
+</xliff>
+
diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.pl.xml b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.pl.xml new file mode 100644 index 00000000..d4632437 --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.pl.xml @@ -0,0 +1,17 @@ +<?xml version="1.0"?>
+<xliff version="1.0">
+<!-- @author $Author: weizhuo $ -->
+<!-- @version $Id: tests.pl.xml,v 1.1 2004/12/29 22:27:47 weizhuo Exp $ -->
+<file orginal="I18N Example IndexPage" source-language="EN" datatype="plaintext" date="2004-12-28T18:10:19Z">
+<body>
+<trans-unit id="1">
+<source>Goodbye</source>
+<target>Dowidzenia</target>
+</trans-unit>
+<trans-unit id="2">
+<source>World</source>
+<target>Świecie</target>
+</trans-unit>
+</body>
+</file>
+</xliff>
diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.zh.xml b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.zh.xml new file mode 100644 index 00000000..72fba8fc --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/messages/tests.zh.xml @@ -0,0 +1,17 @@ +<?xml version="1.0"?>
+<xliff version="1.0">
+<!-- @author $Author: qiangxue $ -->
+<!-- @version $Id: tests.zh.xml,v 1.4 2005/01/01 13:55:57 qiangxue Exp $ -->
+<file orginal="I18N Example IndexPage" source-language="EN" datatype="plaintext" date="2004-12-29T11:08:54Z">
+<body>
+<trans-unit id="1">
+<source>Goodbye</source>
+<target>拜拜</target>
+</trans-unit>
+<trans-unit id="2">
+<source>World</source>
+<target>世界</target>
+</trans-unit>
+</body>
+</file>
+</xliff>
diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/zh_TW/Home.page b/demos/quickstart/protected/pages/Advanced/Samples/I18N/zh_TW/Home.page new file mode 100644 index 00000000..329a7669 --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/zh_TW/Home.page @@ -0,0 +1,155 @@ +<%@ Title="PRADO 國際化"
+ Page.Application.Globalization.TranslationCatalogue="index" %>
+<com:TContent ID="body">
+<h1>PRADO 國際化</h1>
+ <p>本演示將介紹如何用PRADO中的一些部件對您的Web應用進行國際化和本地化。
+ 本网頁的顯示是根据您的當地設置從多個不同語言的模板中選擇進行的。
+ 如果你想查看其它語言版本,請更改瀏覽器的語言設置。</p>
+
+ <p>
+ 您目前的語言設置是
+ <%= $this->Page->CurrentCulture %>.
+ <div class="links">
+ 可查看的語言版本包括:
+ <com:LanguageList />
+ </div>
+ </p>
+
+ <p>
+ 除了能自動偵知語言設置的模板外,文本也可以使用不同的翻譯源進行本地化。
+ PRADO提供了gettext,XML,SQLite以及MySQL等手段用于存放消息的各种翻譯。
+ 下面連接所指向的例子展示了如何使用TTranslate部件對文本進行本地化。
+ <hr />
+ <h2>簡介</h2>
+ <p>開發和維護多語言的站點對Web開發者而言是一個很常見的問題。</p>
+ <dl>
+ <dt><strong>國際化(I18N)</strong></dt>
+ <dd>產品開發的一個步驟,它使得產品能接受不同語言的數据,并且在沒有更改設計
+ 的情況下使產品能用于不同的市場。</dd>
+ <dt><strong>L本地化(L10N)</strong></dt>
+ <dd>國際化的一個細節步驟,它針對某個特定的市場文化對產品進行翻譯和調整。</dd>
+ </dl>
+ <p>PRADO支持以下功能:</p>
+ <ul>
+ <li>文本翻譯</li>
+ <li>屬性翻譯(尚未完成)</li>
+ <li>參數替換(如需要可進行翻譯)</li>
+ <li>日期,數字和貨幣的格式化</li>
+ </ul>
+ <h2>例子</h2>
+ <h3>日期:完整格式,en_GB語言設置</h3>
+ <h4>例: </h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time1" Pattern="full" Culture="en_GB"/>
+</com:TTextHighlighter>
+ <h4>結果: </h4>
+ <com:TDateFormat ID="Time1" Pattern="full" Culture="en_GB"/> <br />
+ <hr />
+
+ <h3>日期:短格式</h3>
+ <h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time2" Pattern="short" />
+</com:TTextHighlighter>
+ <h4>結果:</h4>
+ <com:TDateFormat ID="Time2" Pattern="short" /> <br />
+ <hr />
+
+ <h3>日期:<%= $this->Page->CurrentCulture %>的缺省模式</h3>
+ <h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TDateFormat ID="Time3" Value="2004/12/06" />
+</com:TTextHighlighter>
+ <h4>結果:</h4>
+<com:TDateFormat ID="Time3" Value="2004/12/06" /> <br />
+ <hr />
+
+ <h3>貨幣,缺省格式</h3>
+ <h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat Type="currency" Value="12.4" />
+</com:TTextHighlighter>
+ <h4>結果:</h4>
+<com:TNumberFormat Type="currency" Value="12.4" /> <br />
+ <hr />
+ <h3>貨幣,de_DE語言以及歐幣</h3>
+ <h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat ID="Number2" Type="currency" Culture="de_DE" Currency="EUR"/>
+</com:TTextHighlighter>
+ <h4>結果:</h4>
+ <com:TNumberFormat ID="Number2" Type="currency" Culture="de_DE" Currency="EUR"/> <br />
+
+ <hr />
+
+ <h3>貨幣, 美國格式以及歐幣</h3>
+ <h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" />
+</com:TTextHighlighter>
+ <h4>結果:</h4>
+ <com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" /> <br />
+ <hr />
+
+ <h3>翻譯實例</h3>
+ <h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate>Hello</com:TTranslate>
+</com:TTextHighlighter>
+ <h4>結果:</h4>
+ <com:TTranslate>Hello</com:TTranslate> <br />
+ <h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate Text="Goodbye" />
+</com:TTextHighlighter>
+ <h4>結果:</h4>
+ <com:TTranslate Text="Goodbye" /> <br />
+
+<hr />
+<h3>Using localization tag</h3>
+<h4>Example:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<%[ Goodbye ]%>
+</com:TTextHighlighter>
+
+<h4>Result:</h4>
+<%[ Goodbye ]%>
+<br />
+
+ <hr />
+ <h3>用不同目錄進行翻譯</h3>
+ <h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate Text="Goodbye" Catalogue="tests" />
+</com:TTextHighlighter>
+ <h4>結果:</h4>
+<com:TTranslate Text="Goodbye" Catalogue="tests" />
+ <br />
+
+
+ <hr />
+ <h3>用參數替換進行翻譯</h3>
+ <h4>例:</h4>
+<com:TTextHighlighter Language="prado" CssClass="source">
+<com:TTranslate>
+ {greeting} {name}!, The unix-time is "{time}".
+ <com:TTranslateParameter Key="name">
+ <com:TTranslate Catalogue="tests" Text="World" />
+ </com:TTranslateParameter>
+ <com:TTranslateParameter Key="greeting" Value="Hello" />
+ <com:TTranslateParameter Key="time" Value="<%= Time() %>" />
+</com:TTranslate>
+</com:TTextHighlighter>
+
+ <h4>結果:</h4>
+
+<com:TTranslate>
+ {greeting} {name}!, The unix-time is "{time}".
+ <com:TTranslateParameter Key="name">
+ <com:TTranslate Catalogue="tests" Text="World" />
+ </com:TTranslateParameter>
+ <com:TTranslateParameter Key="greeting" Value="Hello" />
+ <com:TTranslateParameter Key="time" Value="<%= Time() %>" />
+</com:TTranslate>
+
+</com:TContent>
\ No newline at end of file |