1 | <?php namespace Fisharebest\Localization\Locale; |
||
16 | abstract class AbstractLocale |
||
17 | { |
||
18 | // "Source" strings, when translating numbers |
||
19 | const DECIMAL = '.'; // The default decimal mark |
||
20 | const GROUP = ','; // The digit group separator |
||
21 | const NEGATIVE = '-'; // Negative numbers |
||
22 | |||
23 | // "Target" strings, when translating numbers |
||
24 | const ALM = "\xD8\x9C"; // Arabic Letter Mark |
||
25 | const APOSTROPHE = '’'; |
||
26 | const ARAB_DECIMAL = "\xD9\xAB"; |
||
27 | const ARAB_GROUP = "\xD9\xAC"; |
||
28 | const ARAB_MINUS = "\xE2\x88\x92"; |
||
29 | const ARAB_PERCENT = "\xD9\xAA"; |
||
30 | const COMMA = ','; |
||
31 | const DOT = '.'; |
||
32 | const HYPHEN = '-'; |
||
33 | const LTR_MARK = "\xE2\x80\x8E"; // Left-to-right marker |
||
34 | const MINUS_SIGN = "\xE2\x88\x92"; |
||
35 | const NBSP = "\xC2\xA0"; // A non-breaking space |
||
36 | const PRIME = '\''; |
||
37 | const RTL_MARK = "\xE2\x80\x8F"; // Right-to-left marker |
||
38 | |||
39 | // For formatting percentages |
||
40 | const PERCENT = '%%'; |
||
41 | const PLACEHOLDER = '%s'; |
||
42 | |||
43 | /** |
||
44 | * Generate a linux locale code for this locale. Examples include |
||
45 | * "fr", “en_GB”, “ca_ES@valencia” and “sr@latin”. |
||
46 | * |
||
47 | * @return string |
||
48 | */ |
||
49 | public function code() |
||
67 | |||
68 | /** |
||
69 | * Which collation sequence should be used for this locale? |
||
70 | * “unicode_ci” would mean use “utf8_unicode_ci”, “utf8mb4_unicode_ci”, etc. |
||
71 | * |
||
72 | * @link http://dev.mysql.com/doc/refman/5.7/en/charset-unicode-sets.html |
||
73 | * @return string |
||
74 | */ |
||
75 | public function collation() |
||
79 | |||
80 | /** |
||
81 | * Convert (Hindu-Arabic) digits into a localized form |
||
82 | * |
||
83 | * @param string $string e.g. "123.45" |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | public function digits($string) |
||
91 | |||
92 | /** |
||
93 | * When writing large numbers place a separator after this number of digits. |
||
94 | * |
||
95 | * @return int |
||
96 | */ |
||
97 | protected function digitsFirstGroup() |
||
101 | |||
102 | /** |
||
103 | * When writing large numbers place a separator after this number of digits. |
||
104 | * |
||
105 | * @return int |
||
106 | */ |
||
107 | protected function digitsGroup() |
||
111 | |||
112 | /** |
||
113 | * Is text written left-to-right “ltr” or right-to-left “rtl”. |
||
114 | * Most scripts are only written in one direction, but there are a few that |
||
115 | * can be written in either direction. |
||
116 | * |
||
117 | * @return string “ltr” or “rtl” |
||
118 | */ |
||
119 | public function direction() |
||
123 | |||
124 | /** |
||
125 | * A sortable version of the locale name. For example, “British English” |
||
126 | * might sort as “ENGLISH, BRITISH” to keep all the variants of English together. |
||
127 | * |
||
128 | * All-capitals makes sorting easier, as we can use a simple strcmp(). |
||
129 | * |
||
130 | * @return string |
||
131 | */ |
||
132 | public function endonymSortable() |
||
136 | |||
137 | /** |
||
138 | * Markup for an HTML element |
||
139 | * |
||
140 | * @return string e.g. lang="ar" dir="rtl" |
||
141 | */ |
||
142 | public function htmlAttributes() |
||
150 | |||
151 | /** |
||
152 | * The IETF language tag for the locale. Examples include |
||
153 | * “fr, “en-GB”, “ca-ES-valencia” and “sr-Latn”. |
||
154 | * |
||
155 | * @return string |
||
156 | */ |
||
157 | public function languageTag() |
||
172 | |||
173 | /** |
||
174 | * When using grouping digits in numbers, keep this many of digits together. |
||
175 | * |
||
176 | * @return int |
||
177 | */ |
||
178 | protected function minimumGroupingDigits() |
||
182 | |||
183 | /** |
||
184 | * Convert (Hindu-Arabic) digits into a localized form |
||
185 | * |
||
186 | * @param float $number The number to be localized |
||
187 | * |
||
188 | * @return string |
||
189 | */ |
||
190 | public function number($number) |
||
217 | |||
218 | /** |
||
219 | * The symbols used to format numbers. |
||
220 | * |
||
221 | * @return string[] |
||
222 | */ |
||
223 | protected function numberSymbols() |
||
227 | |||
228 | /** |
||
229 | * The numerals (0123456789) used by this locale. |
||
230 | * |
||
231 | * @return string[] |
||
232 | */ |
||
233 | protected function numerals() |
||
237 | |||
238 | /** |
||
239 | * Convert (Hindu-Arabic) digits into a localized form |
||
240 | * |
||
241 | * @param float $number The number to be localized |
||
242 | * |
||
243 | * @return string |
||
244 | */ |
||
245 | public function percent($number) |
||
249 | |||
250 | /** |
||
251 | * How to format a floating point number (%s) as a percentage. |
||
252 | * |
||
253 | * @return string |
||
254 | */ |
||
255 | protected function percentFormat() |
||
259 | |||
260 | /** |
||
261 | * Which plural rule is used in this locale |
||
262 | * |
||
263 | * @return PluralRuleInterface |
||
264 | */ |
||
265 | public function pluralRule() |
||
269 | |||
270 | /** |
||
271 | * The script used by this locale. |
||
272 | * |
||
273 | * @return ScriptInterface |
||
274 | */ |
||
275 | public function script() |
||
279 | |||
280 | /** |
||
281 | * The territory used by this locale. |
||
282 | * |
||
283 | * @return TerritoryInterface |
||
284 | */ |
||
285 | public function territory() |
||
289 | |||
290 | /** |
||
291 | * The variant, if any of this locale. |
||
292 | * |
||
293 | * @return VariantInterface|null |
||
294 | */ |
||
295 | public function variant() |
||
299 | } |
||
300 |