summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.page
blob: 9f66bad85a1704dade156c3b14b2007dabe2ed59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
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 id="u1" class="block-content">
  <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">
&lt;com:TDateFormat ID="Time1" Pattern="full" Culture="en_GB"/&gt;
</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">
&lt;com:TDateFormat ID="Time2" Pattern="short" /&gt;
</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">
&lt;com:TDateFormat ID="Time3" Value="2004/12/06" /&gt;
</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">
&lt;com:TNumberFormat Type="currency" Value="12.4" /&gt;
</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">
&lt;com:TNumberFormat ID="Number2" Type="currency" Culture="de_DE" Currency="EUR"/&gt;
</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">
&lt;com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" /&gt;
</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">
&lt;com:TTranslate&gt;Hello&lt;/com:TTranslate&gt;
</com:TTextHighlighter>

<h4>Result:</h4>
<com:TTranslate>Hello</com:TTranslate> <br />
<h4>Example:</h4>
<com:TTextHighlighter Language="prado" CssClass="source">
&lt;com:TTranslate Text="Goodbye" /&gt;
</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">
&lt;%[ Goodbye ]%&gt;
</com:TTextHighlighter>

<h4>Result:</h4>
<%[ Goodbye ]%>
<br />


<hr />
<h3>Translation using a different catalogue </h3>
<h4>Example:</h4>
<com:TTextHighlighter Language="prado" CssClass="source">
&lt;com:TTranslate Text="Goodbye" Catalogue="tests" /&gt;
</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">
&lt;com:TTranslate&gt;
	{greeting} {name}!, The unix-time is "{time}". 
	&lt;com:TTranslateParameter Key="name"&gt;
		&lt;com:TTranslate Catalogue="tests" Text="World" /&gt;
	&lt;/com:TTranslateParameter&gt;	
	&lt;com:TTranslateParameter Key="greeting" Value="Hello" /&gt;
	&lt;com:TTranslateParameter Key="time" Value="&lt;%= Time() %&gt;" /&gt;
&lt;/com:TTranslate&gt;
</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>