forked from Skillshare/formatphp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLocaleInterface.php
More file actions
177 lines (152 loc) · 4.86 KB
/
LocaleInterface.php
File metadata and controls
177 lines (152 loc) · 4.86 KB
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
<?php
/**
* This file is part of formatphp/formatphp
*
* formatphp/formatphp is open source software: you can distribute
* it and/or modify it under the terms of the MIT License
* (the "License"). You may not use this file except in
* compliance with the License.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* @copyright Copyright (c) Skillshare, Inc. <https://www.skillshare.com>
* @copyright Copyright (c) FormatPHP Contributors <https://formatphp.dev>
* @license https://opensource.org/licenses/MIT MIT License
*/
declare(strict_types=1);
namespace FormatPHP\Intl;
/**
* An ECMA-402 locale identifier
*
* This defines an interface for PHP that conforms to Intl.Locale defined in the
* ECMAScript 2022 Internationalization API Specification (ECMA-402 9th Edition).
*
* @link https://tc39.es/ecma402/#locale-objects
*
* @phpstan-import-type CalendarType from DateTimeFormatOptions
* @phpstan-import-type HourType from DateTimeFormatOptions
* @phpstan-import-type NumeralType from NumberFormatOptions
* @phpstan-import-type CaseFirstType from LocaleOptions
* @phpstan-import-type CollationType from LocaleOptions
*/
interface LocaleInterface
{
/**
* Returns a substring of this locale that provides basic locale information
*/
public function baseName(): ?string;
/**
* Returns this locale's calendar era
*
* @return CalendarType | null
*/
public function calendar(): ?string;
/**
* Returns a new instance of the locale, combined with the given calendar
*
* @param CalendarType $calendar
*/
public function withCalendar(string $calendar): self;
/**
* Returns whether case is accounted for in this locale's collation rules
*
* @return CaseFirstType | null
*/
public function caseFirst(): ?string;
/**
* Returns a new instance of the locale, combined with the given case
* collation
*
* @param CaseFirstType $caseFirst
*/
public function withCaseFirst(string $caseFirst): self;
/**
* Returns this locale's collation type
*
* @return CollationType | null
*/
public function collation(): ?string;
/**
* Returns a new instance of the locale, combined with the given collation
*
* @param CollationType $collation
*/
public function withCollation(string $collation): self;
/**
* Returns this locale's time-keeping convention
*
* @return HourType | null
*/
public function hourCycle(): ?string;
/**
* Returns a new instance of the locale, combined with the given hour cycle
*
* @param HourType $hourCycle
*/
public function withHourCycle(string $hourCycle): self;
/**
* Returns this locale's language
*/
public function language(): ?string;
/**
* Returns a new instance of the locale, combined with the given language
*/
public function withLanguage(string $language): self;
/**
* Using the existing values set on this locale instance, returns the most
* likely values that can be determined for language, script, and region
*/
public function maximize(): LocaleInterface;
/**
* Removes any information from the locale that would be added by calling
* maximize()
*/
public function minimize(): LocaleInterface;
/**
* Returns this locale's numeral system
*
* @return NumeralType | null
*/
public function numberingSystem(): ?string;
/**
* Returns a new instance of the locale, combined with the given numbering
* system
*
* @param NumeralType $numberingSystem
*/
public function withNumberingSystem(string $numberingSystem): self;
/**
* Returns whether this locale has special collation handling for
* numeric strings
*/
public function numeric(): bool;
/**
* Returns a new instance of the locale, with the numeric collation handling
* toggled on or off
*/
public function withNumeric(bool $numeric): self;
/**
* Returns this locale's region
*/
public function region(): ?string;
/**
* Returns a new instance of the locale, combined with the given region
*/
public function withRegion(string $region): self;
/**
* Returns this locale's script used for writing
*/
public function script(): ?string;
/**
* Returns a new instance of the locale, combined with the given script
*/
public function withScript(string $script): self;
/**
* Returns the full string identifier for this locale
*/
public function toString(): string;
}