-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
290 lines (266 loc) · 11.3 KB
/
index.html
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Punic - PHP Unicode CLDR Tooktit</title>
<meta name="description" content="An open-source bridge between PHP and the Unicode CLDR data: a fantastic mix to help you translating and localizing your projects">
<meta name="author" content="Michele Locati">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/punic.css">
<script src="js/jquery.js"></script>
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.js"></script>
<![endif]-->
</head>
<body data-spy="scroll" data-target="#menu-main">
<div class="navbar navbar-default navbar-fixed-top" id="menu-main">
<div class="container">
<div class="navbar-header">
<a href="#header" class="navbar-brand">Punic</a>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#navbar-main">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="navbar-main">
<ul class="nav navbar-nav">
<li><a href="#Getting-started">Getting started</a></li>
<li><a href="#Data-class">Data</a></li>
<li><a href="#Calendar-class">Calendar</a></li>
<li><a href="#Language-class">Language</a></li>
<li><a href="#Territory-class">Territory</a></li>
<li><a href="#Number-class">Number</a></li>
<li><a href="#Unit-class">Unit</a></li>
<li><a href="#Misc-class">Misc</a></li>
<li><a href="#Plural-class">Plural</a></li>
<li><a href="#Phone-class">Phone</a></li>
<li><a href="#Currency-class">Currency</a></li>
<li class="visible-xs-block"><a href="https://github.com/punic/punic">Fork</a></li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="clearfix page-header punic-section" id="header">
<h1>Punic</h1>
<p class="lead">PHP-Unicode CLDR Toolkit</p>
<p>Punic is a PHP library using the CLDR data to help you localize various variables like numbers, dates, units, lists, …</p>
<p>Below you'll find an introduction to Punic. For full API reference see the <a href="docs">APIs reference</a>.</p>
</div>
<div class="clearfix punic-section" id="Getting-started">
<h2>Getting started</h2>
<div class="row">
<div class="col-lg-12">
<h3>Manual installation</h3>
</div>
</div>
<div class="row">
<div class="col-lg-5">
<p>In case you can't use composer (or even if you don't know it), you can manually add Punic to your project and use it. Simply download the latest version from the <a href="https://github.com/punic/punic/releases">Punic releases page</a>.<br />
Extract the zip archive somewhere accessible by your project and make sure you include the <code>punic.php</code> found in the zip.</p>
</div>
<div class="col-lg-7">
<script src="//githubist.ortic.com/punic/examples/setup/manual.php"></script>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h3>Installation using composer</h3>
</div>
</div>
<div class="row">
<div class="col-lg-5">
<p>As Punic is written using PSR-4, it's highly recommended to use composer to use it. Begin by editing your project's <code>composer.json</code> to require <code>punic/punic</code>.</p>
<pre>"require": {
"punic/punic": "3.*"
}</pre>
<p>Next, go to your favourite terminal and run <code>composer update</code>.</p>
<p>That's all it takes, you're ready to go! Have a look at the example on the right to see how a basic call to punic can look like.</p>
</div>
<div class="col-lg-7">
<script src="//githubist.ortic.com/punic/examples/setup/composer.php"></script>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h3>Main classes</h3>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<p>Here's the list of the main classes that you may want to use in your projects:</p>
<ul>
<li><code>Punic/Data</code> To set the default locale, so that you don't need to specify it every you use Punic functions.</li>
<li><code>Punic/Calendar</code> To work with dates</li>
<li><code>Punic/Language</code> To work with languages.</li>
<li><code>Punic/Territory</code> To work with countries and continents.</li>
<li><code>Punic/Number</code> Number-related functions.</li>
<li><code>Punic/Unit</code> To work with units (acceleration, angles, area, duration, distance, volume… too many to list them!).</li>
<li><code>Punic/Misc</code> Miscellaneous functions (lists, case, …).</li>
<li><code>Punic/Plural</code> It's mainly for internal use, but you may want to use it.</li>
<li><code>Punic/Phone</code> To work with phone numbers.</li>
<li><code>Punic/Currency</code> To work with currencies.</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h3>Language support</h3>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<p>To keep the size of the package at a reasonable level, only data for a limited set of languages
(about 40, defined <a href="https://github.com/punic/punic/blob/3.1.0/bin/punic-data#L111">here</a>) is included by default.
If you need more, you can get them yourself using the bundled <code>punic-data</code> script.<br />
To get help about how to run this command:</p>
<pre><Path/to/Punic>/bin/punic-data --help</pre>
<i>(On Windows, use <code>\</code> instead of <code>/</code>)</i>
<p>Please remark that when you upgrade your locally installed Punic with Composer, the language files are reverted to the default ones.<br />
In the case you want to be sure that you have the languages you need even after Punic is upgraded (for instance, <code>af</code> and <code>zu_ZA</code>),
you can add this section to your <code>composer.json</code> file:
</p>
<pre><code>
"scripts": {
"post-install-cmd": [
"punic-data --locale=+af,+zu_ZA"
],
"post-update-cmd": [
"punic-data --locale=+af,+zu_ZA"
]
}
</code></pre>
<p>Language data is fetched from a remote repository. If you plan to install many languages on a regular basis, you can also evaluate to
use a local language repository, fetching <a href="https://github.com/punic/data" target="_blank">this repository</a> and instructing
<code>bin/punic-data</code> to use it with the <code>--source-location</code> option.</p>
</div>
</div>
</div>
<hr>
<div class="clearfix punic-section" id="Data-class">
<h2>Data <a href="docs/class-Punic.Data.html"></a></h2>
<div class="row">
<div class="col-lg-5">
If you work with a larger application, you probably don't want to specify the locale for each string you want to localize.
You can use the Data class to set a globally active locale and then skip the locale parameter when calling a method to localize a string.
</div>
<div class="col-lg-7">
<script src="//githubist.ortic.com/punic/examples/data.php"></script>
</div>
</div>
</div>
<hr>
<div class="clearfix punic-section" id="Calendar-class">
<h2>Calendar <a href="docs/class-Punic.Calendar.html"></a></h2>
<div class="row">
<div class="col-lg-5">
The calendar class contains a number of methods to localize date object related outputs. <code>formatDate</code> to format a date, <code>getEraName</code> to return the name of an era, <code>getMonthName</code> to do the same for months.
You can also find some helper methods like <code>toDateTime</code> to convert a date/time representation to a DateTime object.
</div>
<div class="col-lg-7">
<script src="//githubist.ortic.com/punic/examples/calendar.php"></script>
</div>
</div>
</div>
<hr>
<div class="clearfix punic-section" id="Language-class">
<h2>Language <a href="docs/class-Punic.Language.html"></a></h2>
<div class="row">
<div class="col-lg-5">
The language class helps you to convert a locale code into a language name. Want to know what it_IT is called in American English? Use this class to show all the languages in the right way.
</div>
<div class="col-lg-7">
<script src="//githubist.ortic.com/punic/examples/language.php"></script>
</div>
</div>
</div>
<hr>
<div class="clearfix punic-section" id="Territory-class">
<h2>Territory <a href="docs/class-Punic.Territory.html"></a></h2>
<div class="row">
<div class="col-lg-5">
The territory class contains several methods to work with regions, countries and continents.
</div>
<div class="col-lg-7">
<script src="//githubist.ortic.com/punic/examples/territory.php"></script>
</div>
</div>
</div>
<hr>
<div class="clearfix punic-section" id="Number-class">
<h2>Number <a href="docs/class-Punic.Number.html"></a></h2>
<div class="row">
<div class="col-lg-5">
The number class offers methods to convert a numerical variable into a properly formatted string. After all, a string like 1,234.56 is easier to read than 1234.56.
</div>
<div class="col-lg-7">
<script src="//githubist.ortic.com/punic/examples/number.php"></script>
</div>
</div>
</div>
<hr>
<div class="clearfix punic-section" id="Unit-class">
<h2>Unit <a href="docs/class-Punic.Unit.html"></a></h2>
<div class="row">
<div class="col-lg-5">
Whether you need an abbreviation or a long form of a number with a unit, use this class. Properly formatted numbers and units in every the language.
</div>
<div class="col-lg-7">
<script src="//githubist.ortic.com/punic/examples/unit.php"></script>
</div>
</div>
</div>
<hr>
<div class="clearfix punic-section" id="Misc-class">
<h2>Misc <a href="docs/class-Punic.Misc.html"></a></h2>
<div class="row">
<div class="col-lg-5">
Use the misc class to join a list of numbers correctly into a single string.
</div>
<div class="col-lg-7">
<script src="//githubist.ortic.com/punic/examples/misc.php"></script>
</div>
</div>
</div>
<hr>
<div class="clearfix punic-section" id="Plural-class">
<h2>Plural <a href="docs/class-Punic.Plural.html"></a></h2>
<div class="row">
<div class="col-lg-5">
Need to know the plural of a number, use this class.
</div>
<div class="col-lg-7">
<script src="//githubist.ortic.com/punic/examples/plural.php"></script>
</div>
</div>
</div>
<div class="clearfix punic-section" id="Phone-class">
<h2>Phone <a href="docs/class-Punic.Phone.html"></a></h2>
<div class="row">
<div class="col-lg-5">
Need to know the country calling codes of a country? Need to know the countries associated to a country calling code? Use this class!
</div>
<div class="col-lg-7">
<script src="//githubist.ortic.com/punic/examples/phone.php"></script>
</div>
</div>
</div>
<div class="clearfix punic-section" id="Currency-class">
<h2>Currency <a href="docs/class-Punic.Currency.html"></a></h2>
<div class="row">
<div class="col-lg-5">
Need to know the currency used in a country? Do you want to have a list of all the currencies and their localized name? Use this class!
</div>
<div class="col-lg-7">
<script src="//githubist.ortic.com/punic/examples/currency.php"></script>
</div>
</div>
</div>
<a href="https://github.com/punic/punic" class="hidden-xs"><img style="position: fixed; top: 0; right: 0; border: 0; z-index: 2000" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a>
<script src="js/bootstrap.js"></script>
</body>
</html>