Skip to content

Commit b89a0a1

Browse files
committed
Update Docs and README
1 parent 82e3a74 commit b89a0a1

7 files changed

Lines changed: 55 additions & 35 deletions

File tree

Docs.md

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,37 @@ ILibDurationFmt(ILibDurationFmtOptions options)
111111

112112

113113
# LocaleInfo
114+
## ILibLocale
115+
### Properties
116+
|name|description|
117+
|------|---|
118+
|_String_ language|The ISO 639 2-letter code for the language, or a full locale spec in BCP-47 format, or another `ILibLocale` instance to copy from.|
119+
|_String?_ script|The ISO 15924 code of the script for this locale, if any.|
120+
|_String?_ region|The ISO 3166 2-letter code for the region.|
121+
|_String?_ variant|The name of the variant of this locale, if any.|
122+
123+
### Constructors
124+
```dart
125+
ILibLocale([Object? language, String? region, String? variant, String? script])
126+
```
127+
128+
### Methods
129+
|name|description|
130+
|------|---|
131+
|_String_ getLanguage()|Return the ISO 639 language code of the locale.|
132+
|_String?_ getLanguageAlpha3()|Return the ISO 639-3 language code of the locale.|
133+
|_String?_ getScript()|Return the ISO 15924 script code of the locale.|
134+
|_String?_ getRegion()|Return the ISO 3166 region code of the locale.|
135+
|_String?_ getRegionAlpha3()|Return the ISO 3166-3 region code of the locale.|
136+
|_String?_ getVariant()|Return the variant code of the locale.|
137+
|_String_ getSpec()|Return the full locale specifier as a string.|
138+
|_String_ getLangSpec()|Return the language and script specifier of the locale.|
139+
|_bool_ equals(ILibLocale other)|Check if another locale is exactly equal to this one.|
140+
|_bool_ isPseudo()|Check if the locale is a pseudo-locale. Pseudo-locales are used for testing localization.|
141+
|_bool_ isValid()|Check if the locale uses valid ISO codes for its components. Validates language, script, and region codes.|
142+
|_List<String>_ getAvailableLocales()|Return a list of all available locales (not implemented).|
143+
144+
114145
## ILibLocaleInfo
115146
### Properties
116147
|name|description|
@@ -222,23 +253,3 @@ ILibScriptInfo(String script)
222253
|_bool_ getNeedsIME()|Return true if this script typically requires an input method engine to enter its characters.|
223254
|_bool_ getCasing()|Return true if this script uses lower- and upper-case characters.|
224255

225-
# CaseMapper
226-
## ILibCaseMapper
227-
### Constructors
228-
```dart
229-
ILibCaseMapper({String? locale, String? direction})
230-
```
231-
232-
### Properties
233-
|name|description|
234-
|------|---|
235-
|_bool_ up|Indicates whether the mapper is set to convert to upper case (true) or lower case (false).|
236-
|_ILibLocale_ locale|The locale used for locale-sensitive case mapping.|
237-
|_Map<String, String>_ mapData|The mapping data used for case conversion.|
238-
239-
### Methods
240-
|name|description|
241-
|------|---|
242-
|_ILibLocale_ getLocale()|Return the locale that this mapper was constructed with.|
243-
|_String?_ map(String? string)|Map a string to upper or lower case in a locale-sensitive manner.|
244-

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -196,33 +196,35 @@ To give a more efficient way, we provide some classes that can be easily used in
196196
Currently, we have the following classes:
197197
- `ILibCaseMapper`
198198
- `ILibDateFmt`
199-
- `ILibLocaleInfo`
199+
- `ILibDateOptions`
200200
- `ILibDurationFmt`
201+
- `ILibLocale`
202+
- `ILibLocaleInfo`
201203
- `ILibNumFmt`
202204
- `ILibScriptInfo`
203205

204206
We have a plan to provide more classes and methods.
205207

206-
### ILibDate
207-
- Class: [ILibDateOptions](./Docs.md/#ilibdateoptions)
208-
209208
### ILibDateFmt
210-
- Class: [ILibDateFmtOptions](./Docs.md/#ilibdatefmtoptions)
209+
- Class: [ILibDateFmtOptions](./Docs.md/#ilibdatefmtoptions)
211210
- Class: [ILibDateFmt](./Docs.md#ilibdatefmt)
212211
- Methods: `format()`, `getClock()`, `getTemplate()`, `getMeridiemsRange()`
213212

213+
### ILibDurationFmt
214+
- Class: [ILibDurationFmtOptions](./Docs.md/#ilibdurationfmtoptions)
215+
- Class: [ILibDurationFmt](./Docs.md/#ilibdurationfmt)
216+
- Methods: `format()`, `getLocale()`, `getStyle()`, `getLength()`
217+
218+
### ILibDateOptions
219+
- Class: [ILibDateOptions](./Docs.md/#ilibdateoptions)
220+
214221
### ILibLocale
215222
- Class: [ILibLocale](./Docs.md/#iliblocale)
216223

217224
### ILibLocaleInfo
218225
- Class: [ILibLocaleInfo](./Docs.md/#iliblocaleinfo)
219226
- Methods: `getLanguageName()`, `getRegionName()`, `getClock()`, `getLocale()`, `getUnits()`, `getCalendar()`, `getFirstDayOfWeek()`, `getWeekEndStart()`, `getWeekEndEnd()`, `getTimeZone()`, `getDecimalSeparator()`, `getNativeDecimalSeparator()`, `getGroupingSeparator()`, `getNativeGroupingSeparator()`, `getPrimaryGroupingDigits()`, `getSecondaryGroupingDigits()`, `getPercentageFormat()`, `getNegativePercentageFormat()`, `getPercentageSymbol()`, `getExponential()`, `getNativeExponential()`, `getNativePercentageSymbol()`, `getNegativeNumberFormat()`, `getCurrencyFormats()`, `getCurrency()`, `getDigitsStyle()`, `getDigits()`, `getNativeDigits()`, `getRoundingMode()`, `getScript()`, `getDefaultScript()`, `getAllScripts()`, `getMeridiemsStyle()`, `getPaperSize()`, `getDelimiterQuotationStart()`, `getDelimiterQuotationEnd()`
220227

221-
### ILibDurationFmt
222-
- Class: [ILibDurationFmtOptions](./Docs.md/#ilibdurationfmtoptions)
223-
- Class: [ILibDurationFmt](./Docs.md/#ilibdurationfmt)
224-
- Methods: `format()`, `getLocale()`, `getStyle()`, `getLength()`
225-
226228
### ILibNumFmt
227229
- Clasee: [ILibNumFmtOptions](./Docs.md/#ilibnumfmtoptions)
228230
- Class: [ILibNumFmt](./Docs.md/#ilibnumfmt)

lib/ilib_casemapper.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@ class ILibCaseMapper {
2828
};
2929
}
3030

31-
const Set<String> specialLanguages = {'az', 'tr', 'crh', 'kk', 'krc', 'tt'};
31+
const Set<String> specialLanguages = <String>{
32+
'az',
33+
'tr',
34+
'crh',
35+
'kk',
36+
'krc',
37+
'tt'
38+
};
3239
if (specialLanguages.contains(this.locale.getLanguage())) {
3340
_setUpMap('iı', 'İI');
3441
}

lib/ilib_date.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ILibDateOptions {
4747
String toJsonString() {
4848
int? y = year;
4949
int? m = month;
50-
int? w = week;
50+
final int? w = week;
5151
int? d = day;
5252
int? h = hour;
5353
int? min = minute;

lib/ilib_datefmt.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class ILibDateFmt {
101101
List<MeridiemsInfo> getMeridiemsRange() {
102102
String result = '';
103103
final String formatOptions = toJsonString();
104-
final List<MeridiemsInfo> meridems = [];
104+
final List<MeridiemsInfo> meridems = <MeridiemsInfo>[];
105105
final String jscode1 =
106106
'JSON.stringify(new DateFmt($formatOptions).getMeridiemsRange())';
107107
result = ILibJS.instance.evaluate(jscode1).stringResult;

lib/ilib_locale.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ class ILibLocale {
926926
}
927927

928928
/// A list of all known pseudo-locales.
929-
static List<String> pseudoLocales = [
929+
static List<String> pseudoLocales = <String>[
930930
'zxx-XX',
931931
'zxx-Cyrl-XX',
932932
'zxx-Hans-XX',

lib/internal/ilib_utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ bool isValidLocale(String lo) {
3232
}
3333

3434
List<String> getSupportedLanguages() {
35-
final List<String> locales = [
35+
final List<String> locales = <String>[
3636
'af',
3737
'am',
3838
'ar',

0 commit comments

Comments
 (0)