Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.8.0
* Implement `ILibCountry` class for Country Information

## 1.7.0
* Implement the `ILibScriptInfo` class for ScriptInfomation
* Add new methods to `ILibLocaleInfo`:
Expand Down
67 changes: 49 additions & 18 deletions Docs.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Date

## ILibDateOptions

### Properties

|name|description|
|------|---|
|_\<String?>_ locale | Locales are specified either with a specifier string that follows the BCP-47 convention, <br>(roughly: "language-script-region").|
Expand Down Expand Up @@ -32,18 +32,19 @@ ILibDateOptions (String? locale, int? year, int? month, int? week, int? day, int


# Date Formatting

## ILibDateFmtOptions

### Properties
|name|description|
|------|---|
|_\<String?>_ locale| Locale to use when formatting the date/time |
|_\<String?>_ type| Specifies whether this formatter should format times only, dates only, or both times and dates together. Valid values are "time", "date", and "datetime". <br> Note that in some locales, the standard format uses the order "time followed by date" and in others, the order is exactly opposite,<br> so it is better to create a single "datetime" formatter than it is to create a time formatter and a date formatter separately and concatenate the results. <br> A "datetime" formatter will get the order correct for the locale.<br> The default type if none is specified in with the type option is "date".|
|_\<String?>_ length| Specifies the length of the format to use. The length is the approximate size of the formatted string. <br> - "short": use a short representation of the time. This is the most compact format possible for the locale."<br> - "medium": use a medium length representation of the time. This is a slightly longer format. <br> - "long": use a long representation of the time. This is a fully specified format, but some of the textual components may still be abbreviated <br> - "full": use a full representation of the time. This is a fully specified format where all the textual components are spelled out completely <br><br> Note that the length parameter does not specify which components are to be formatted. Use the "date" and the "time" properties to specify the components.<br> Also, very few of the components of a time format differ according to the length, so this property has little to no effect on time formatting.|
|_\<String?>_ length| Specifies the length of the format to use. The length is the approximate size of the formatted string. <br> - "short": use a short representation of the time. This is the most compact format possible for the locale.<br> - "medium": use a medium length representation of the time. This is a slightly longer format. <br> - "long": use a long representation of the time. This is a fully specified format, but some of the textual components may still be abbreviated <br> - "full": use a full representation of the time. This is a fully specified format where all the textual components are spelled out completely <br><br> Note that the length parameter does not specify which components are to be formatted. Use the "date" and the "time" properties to specify the components.<br> Also, very few of the components of a time format differ according to the length, so this property has little to no effect on time formatting.|
|_\<String?>_ timezone| Time zone to use when formatting times. <br>This may be a time zone instance or a time zone specifier from the IANA list of time zone database names (eg. "America/Los_Angeles"), <br>the string "local", or a string specifying the offset in RFC 822 format. |
|_\<String?>_ calendar|The type of calendar to use for this format. <br> The value should be a string containing the name of the calendar. <br> the supported types are "gregorian", "julian", "persian", "ethiopic", "thaisolar", "arabic", "hebrew", or "chinese". <br> If the calendar is not specified, then the default calendar for the locale is used.|
|_\<String?>_ date| This property tells which components of a date format to use. <br> For example, sometimes you may wish to format a date that only contains the month and date without the year, such as when displaying a person's yearly birthday. <br>The value of this property allows you to specify only those components you want to see in the final output, ordered correctly for the locale. <br> Valid values are: "dmwy", "dmy", "dmw", "dm", "my", "dw", "d", "m","n","y" <br> Default components, if this property is not specified, is "dmy".|
|_\<String?>_ time|This property gives which components of a time format to use.<br> The time will be formatted correctly for the locale with only the time components requested. <br>For example, a clock might only display the hour and minute and not need the seconds or the am/pm component. In this case, the time property should be set to "hm".<br> Valid values for this property are: "ahmsz", "ahms", "hmsz", "hms", "ahmz", "ahm", hmz", ah", "hm", "ms", "h", "m", "s" <br> Default value if this property is not specified is "hma". |
|_\<String?>_ time|This property gives which components of a time format to use.<br> The time will be formatted correctly for the locale with only the time components requested. <br>For example, a clock might only display the hour and minute and not need the seconds or the am/pm component. In this case, the time property should be set to "hm".<br> Valid values for this property are: "ahmsz", "ahms", "hmsz", "hms", "ahmz", "ahm", "hmz", ah", "hm", "ms", "h", "m", "s" <br> Default value if this property is not specified is "hma". |
|_\<bool?>_ useNative|The flag used to determine whether to use the native script settings for formatting the numbers.|
|_\<String?>_ meridiems|String that specifies what style of meridiems to use with this format. The choices are "default", "gregorian", "ethiopic", and "chinese".|

Expand All @@ -55,16 +56,16 @@ ILibDateFmtOptions (String? locale, String? length, String? type, String? calend
## ILibDateFmt

### Properties

|name|description|
|------|---|
| _\<ILibDateFmtOptions>_ options | Options for the DateFormating|
| _\<ILibDateFmtOptions>_ options | Options for the DateFormatting|

### Constructors
### Constructors
```dart
ILibDateFmt(ILibDateFmtOptions options)
```
### Methods

### Methods
|name|description|
|------|---|
|_String_ toJsonString() | A string representation of parameters to call functions of iLib library properly|
Expand All @@ -74,33 +75,36 @@ ILibDateFmt(ILibDateFmtOptions options)
|_List\<MeridiemsInfo>_ getMeridiemsRange()| Return the range of possible meridiems (times of day like "AM" or "PM") in this date formatter.|



# Duration Formatting

## ILibDurationFmtOptions

### Properties
|name|description|
|------|---|
|_\<String?>_ locale| locale to use when formatting the duration. If the locale is not specified, then the default locale of the app will be used |
|_\<String?>_ length| Specify the length of the format to use. The length is the approximate size of the formatted string. <br> <li><i>short</i> - use a short representation of the duration. This is the most compact format possible for the locale. eg. 1y 1m 1w 1d 1:01:01 <br> <li><i>medium</i> - use a medium length representation of the duration. This is a slightly longer format. eg. 1 yr 1 mo 1 wk 1 dy 1 hr 1 mi 1 se <br> <li><i>long</i> - use a long representation of the duration. This is a fully specified format, but some of the textual <br> <li><i>full</i> - use a full representation of the duration. This is a fully specified format where all the textual parts are spelled out completely. eg. 1 year, 1 month, 1 week, 1 day, 1 hour, 1 minute and 1 second parts may still be abbreviated. eg. 1 yr 1 mo 1 wk 1 day 1 hr 1 min 1 sec|
|_\<String?>_ length| Specify the length of the format to use. The length is the approximate size of the formatted string. <br> - "short" - use a short representation of the duration. This is the most compact format possible for the locale. eg. 1y 1m 1w 1d 1:01:01 <br> - "medium" - use a medium length representation of the duration. This is a slightly longer format. eg. 1 yr 1 mo 1 wk 1 dy 1 hr 1 mi 1 se <br> - "long" - use a long representation of the duration. This is a fully specified format, but some of the textual <br> - "full" - use a full representation of the duration. This is a fully specified format where all the textual parts are spelled out completely. eg. 1 year, 1 month, 1 week, 1 day, 1 hour, 1 minute and 1 second parts may still be abbreviated. eg. 1 yr 1 mo 1 wk 1 day 1 hr 1 min 1 sec|
|_\<String?>_ style| whether hours, minutes, and seconds should be formatted as a text string or as a regular time as on a clock. eg. text is "1 hour, 15 minutes", whereas clock is "1:15:00". Valid values for this property are "text" or "clock". Default if this property is not specified is "text". |
|_\<Bool?>_ useNative| the flag used to determaine whether to use the native script settings for formatting the numbers |
|_\<Bool?>_ useNative| the flag used to determine whether to use the native script settings for formatting the numbers |

### Constructors
```dart
ILibDurationFmtOptions (String? locale, String? length, String? style, bool? useNative)
```

## ILibDurationFmt

### Properties
|name|description|
|------|---|
| _\<ILibDurationFmtOptions>_ options | Options for the DurationFormating|
| _\<ILibDurationFmtOptions>_ options | Options for the DurationFormatting|

### Constructors
### Constructors
```dart
ILibDurationFmt(ILibDurationFmtOptions options)
```
### Methods

### Methods
|name|description|
|------|---|
|_String_ toJsonString() | A string representation of parameters to call functions of iLib library properly|
Expand All @@ -111,7 +115,9 @@ ILibDurationFmt(ILibDurationFmtOptions options)


# LocaleInfo

## ILibLocale

### Properties
|name|description|
|------|---|
Expand Down Expand Up @@ -142,17 +148,18 @@ ILibLocale([Object? language, String? region, String? variant, String? script])


## ILibLocaleInfo

### Properties
|name|description|
|------|---|
|_\<String>_ locale| The locale for which the info is sought |

### Constructors
### Constructors
```dart
ILibLocaleInfo(String locale)
```

### Methods
### Methods
|name|description|
|------|---|
|_int_ getFirstDayOfWeek() | Returns the day of week that starts weeks in the current locale. <br>Days are still numbered the standard way with 0 for Sunday through 6 for Saturday, <br> but calendars should be displayed and weeks calculated with the day of week returned from this function as the first day of the week.|
Expand All @@ -171,7 +178,6 @@ ILibLocaleInfo(String locale)
## ILibNumFmtOptions

### Properties

|name|description|
|------|---|
|_\<String?>_ locale| Locale to use for number formatting. |
Expand Down Expand Up @@ -202,7 +208,6 @@ ILibNumFmtOptions({
## ILibNumFmt

### Properties

|name|description|
|------|---|
|_\<ILibNumFmtOptions>_ options| Options for configuring the number formatter. |
Expand All @@ -213,7 +218,6 @@ ILibNumFmt(ILibNumFmtOptions options)
```

### Methods

|name|description|
|------|---|
|_String_ format(dynamic number)| Formats a number according to the settings of this formatter instance. |
Expand All @@ -230,7 +234,9 @@ ILibNumFmt(ILibNumFmtOptions options)
|_bool_ getUseNative()| Returns true if this formatter uses native digits to format the number. |

# ScriptInfo

## ILibScriptInfo

### Properties
|name|description|
|------|---|
Expand All @@ -252,8 +258,11 @@ ILibScriptInfo(String script)
|_bool_ getNeedsIME()|Return true if this script typically requires an input method engine to enter its characters.|
|_bool_ getCasing()|Return true if this script uses lower- and upper-case characters.|


# CaseMapper

## ILibCaseMapper

### Properties
|name|description|
|------|---|
Expand All @@ -270,3 +279,25 @@ ILibCaseMapper({String? locale, String? direction})
|------|---|
|_ILibLocale_ getLocale()|Returns the locale used by this mapper.|
|_String?_ map(String? string)|Maps a string to uppercase or lowercase in a locale-sensitive manner.|

# Country

## ILibCountry
### Properties
|name|description|
|------|---|
|_Object?_ locale|The locale set for this instance.|

### Constructors
```dart
ILibCountry({Object? locale})
```

### Methods
|name|description|
|------|---|
|_List<String>_ getAvailableCode()|Return an array of the ids for all ISO 3166-1 alpha-2 codes that this copy of iLib knows about.|
|_List<String>_ getAvailableCountry()|Return an array of country names that this copy of iLib knows about.|
|_String_ getCode(String ctryname)|Return the country code corresponding to the given country name. Throws an exception if the name is not found.|
|_String_ getName(String code)|Return the country name corresponding to the given country code. Throws an exception if the code is not found.|
|_ILibLocale_ getLocale()|Return the locale that this info object was created with.|
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ mapper.map('Iİ');
// 'ıi'
```

## Country
``` dart
final ILibCountry ctry = ILibCountry(locale: 'ko-KR');
ctry.getName('TR');
// '튀르키예'
ctry.getCode('튀르키예');
// 'TR'
```

## CLASS

### FlutterILib
Expand All @@ -195,6 +204,7 @@ _flutterIlibPlugin.evaluateILib(jscode1);
To give a more efficient way, we provide some classes that can be easily used in a Flutter app.
Currently, we have the following classes:
- `ILibCaseMapper`
- `ILibCountry`
- `ILibDateFmt`
- `ILibDateOptions`
- `ILibDurationFmt`
Expand Down Expand Up @@ -238,6 +248,10 @@ We have a plan to provide more classes and methods.
- Class: [ILibCaseMapper](./Docs.md/#ilibcasemapper)
- Methods: `getLocale()`, `map()`

### ILibCountry
- Class: [ILibCountry](./Docs.md/#ilibcountry)
- Methods: `getAvailableCode()`, `getAvailableCountry()`, `getCode()`, `getName()`, `getLocale()`

## Supported Locales
The results of the following locales are checked by unit tests.
They have the same result as the original iLib methods.
Expand Down
2 changes: 1 addition & 1 deletion assets/js/ilib-init.js

Large diffs are not rendered by default.

Loading
Loading