Skip to content

Latest commit

 

History

History
303 lines (246 loc) · 16.6 KB

File metadata and controls

303 lines (246 loc) · 16.6 KB

Date

ILibDateOptions

Properties

name description
<String?> locale Locales are specified either with a specifier string that follows the BCP-47 convention,
(roughly: "language-script-region").
<int?> year The year
<int?> month The month
<int?> week The week
<int?> day The day of the month
<int?> hour The hour of the day
<int?> minute The minute [0..59]
<int?> second The second [0..59]
<int?> millisecond The millisecond [0..999]
<int?> unixtime Sets the time of this instance according to the given unix time.
Unix time is the number of milliseconds since midnight on Jan 1, 1970.
<String?> timezone Time zone name as a string
<String?> type Specifies the type/calendar of the date desired.
The list of valid values changes depending on which calendars are defined. i.e. "gregorian", "ethiopic", "thaisolar", "persian" etc.
This property may also be given as "calendar" instead of "type".
<String?> calendar Same as "type" property
<DateTime?> dateTime DateTime class of flutter

Constructors

ILibDateOptions (String? locale, int? year, int? month, int? week, int? day, int? hour, int? minute, int? second, int? millisecond, int? unixtime, String? type, String? calendar, DateTime? dateTime)

Methods

name description
String toJsonString() A string representation of parameters to call functions of iLib library properly

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".
Note that in some locales, the standard format uses the order "time followed by date" and in others, the order is exactly opposite,
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.
A "datetime" formatter will get the order correct for the locale.
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.
- "short": use a short representation of the time. This is the most compact format possible for the locale.
- "medium": use a medium length representation of the time. This is a slightly longer format.
- "long": use a long representation of the time. This is a fully specified format, but some of the textual components may still be abbreviated
- "full": use a full representation of the time. This is a fully specified format where all the textual components are spelled out completely

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.
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.
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"),
the string "local", or a string specifying the offset in RFC 822 format.
<String?> calendar The type of calendar to use for this format.
The value should be a string containing the name of the calendar.
the supported types are "gregorian", "julian", "persian", "ethiopic", "thaisolar", "arabic", "hebrew", or "chinese".
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.
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.
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.
Valid values are: "dmwy", "dmy", "dmw", "dm", "my", "dw", "d", "m","n","y"
Default components, if this property is not specified, is "dmy".
<String?> time This property gives which components of a time format to use.
The time will be formatted correctly for the locale with only the time components requested.
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".
Valid values for this property are: "ahmsz", "ahms", "hmsz", "hms", "ahmz", "ahm", "hmz", ah", "hm", "ms", "h", "m", "s"
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".

Constructors

ILibDateFmtOptions (String? locale, String? length, String? type, String? calendar, String? timezone, String? date, String? time, bool? useNative, String? meridiems)

ILibDateFmt

Properties

name description
<ILibDateFmtOptions> options Options for the DateFormatting

Constructors

ILibDateFmt(ILibDateFmtOptions options)

Methods

name description
String toJsonString() A string representation of parameters to call functions of iLib library properly
String format() Formats a particular date instance according to the settings of this formatter object
int getClock() Returns the default clock from the locale is returned instead."12" or "24" depending on whether this formatter uses the 12-hour or 24-hour clock
String getTemplate() Return the template string that is used to format date/times for this formatter instance
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.
- "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
- "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
- "long" - use a long representation of the duration. This is a fully specified format, but some of the textual
- "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 determine whether to use the native script settings for formatting the numbers

Constructors

ILibDurationFmtOptions (String? locale, String? length, String? style, bool? useNative)

ILibDurationFmt

Properties

name description
<ILibDurationFmtOptions> options Options for the DurationFormatting

Constructors

ILibDurationFmt(ILibDurationFmtOptions options)

Methods

name description
String toJsonString() A string representation of parameters to call functions of iLib library properly
String format() Formats a particular date instance according to the settings of this formatter object
String getLocale() Return the locale that was used to construct this duration formatter object.
String getLength() Return the length that was used to construct this duration formatter object.
String getStyle() Return the style that was used to construct this duration formatter object.

LocaleInfo

ILibLocale

Properties

name description
Object? 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.
String? script The ISO 15924 code of the script for this locale, if any.
String? variant The name of the variant of this locale, if any.
String? region The ISO 3166 2-letter code for the region.

Constructors

ILibLocale([Object? language, String? region, String? variant, String? script])

Methods

name description
String getLanguage() Return the ISO 639 language code of the locale.
String? getLanguageAlpha3() Return the ISO 639-3 language code of the locale.
String? getScript() Return the ISO 15924 script code of the locale.
String? getRegion() Return the ISO 3166 region code of the locale.
String? getRegionAlpha3() Return the ISO 3166-3 region code of the locale.
String? getVariant() Return the variant code of the locale.
String getSpec() Return the full locale specifier as a string.
String getLangSpec() Return the language and script specifier of the locale.
bool equals(ILibLocale other) Check if another locale is exactly equal to this one.
bool isPseudo() Check if the locale is a pseudo-locale. Pseudo-locales are used for testing localization.
bool isValid() Check if the locale uses valid ISO codes for its components. Validates language, script, and region codes.

ILibLocaleInfo

Properties

name description
<String> locale The locale for which the info is sought

Constructors

ILibLocaleInfo(String locale)

Methods

name description
int getFirstDayOfWeek() Returns the day of week that starts weeks in the current locale.
Days are still numbered the standard way with 0 for Sunday through 6 for Saturday,
but calendars should be displayed and weeks calculated with the day of week returned from this function as the first day of the week.
int getWeekEndStart() Returns the day of week that starts weekend in the current locale.
Days are still numbered the standard way with 0 for Sunday through 6 for Saturday.
int getWeekEndEnd() Returns the day of week that ends weekend in the current locale.
Days are still numbered the standard way with 0 for Sunday through 6 for Saturday.
String getDecimalSeparator() Returns the decimal separator for formatted numbers in this locale.
String getGroupingSeparator() Returns the separator character used to separate groups of digits on the integer side of the decimal character.
String getPercentageFormat() Returns the format template used to format percentages in this locale.
String getNegativePercentageFormat() Returns the format template used to format percentages in this locale with negative amounts.
CurrencyFormats getCurrencyFormats() Returns an object containing the format templates for formatting currencies in this locale.
String getCurrency() Returns the currency that is legal in the locale or most commonly used in commerce.

Number Formatting

ILibNumFmtOptions

Properties

name description
<String?> locale Locale to use for number formatting.
<String?> type Specifies the formatter type. Valid values: "number", "currency", "percentage". Default: "number".
<String?> currency ISO 4217 currency code for "currency" type. Required for currency formatting.
<int?> maxFractionDigits Maximum digits after the decimal. -1 means unlimited, 0 means no fractional digits.
<int?> minFractionDigits Minimum digits after the decimal. Pads with zeros if necessary.
<int?> significantDigits Maximum significant digits, applied before and after the decimal.
<String?> style Formatting style. For "currency": "common" (symbol) or "iso" (ISO code). For "number": "standard", "scientific", "native", or "nogrouping".
<String?> roundingMode Governs rounding behavior. Examples: "up", "down", "halfup", "halfeven".
<bool?> useNative Determines whether to use native script settings for formatting numbers.

Constructors

ILibNumFmtOptions({
  String? locale,
  String? type,
  String? currency,
  int? maxFractionDigits,
  int? minFractionDigits,
  int? significantDigits,
  String? style,
  String? roundingMode,
  bool? useNative,
})

ILibNumFmt

Properties

name description
<ILibNumFmtOptions> options Options for configuring the number formatter.

Constructors

ILibNumFmt(ILibNumFmtOptions options)

Methods

name description
String format(dynamic number) Formats a number according to the settings of this formatter instance.
String constrain(int number) Applies the constraints used in the current formatter to the given number.
String getLocale() Returns the locale used to construct this number formatter object.
String getType() Returns the type of formatter. Valid values are "number", "currency", and "percentage".
bool isGroupingUsed() Returns true if this formatter groups together digits in the integral portion of a number.
int getMaxFractionDigits() Returns the maximum fraction digits set up in the constructor.
int getMinFractionDigits() Returns the minimum fraction digits set up in the constructor.
int getSignificantDigits() Returns the significant digits set up in the constructor.
int? getCurrency() Returns the ISO 4217 code for the currency that this formatter formats.
String getRoundingMode() Returns the rounding mode set up in the constructor.
String getStyle() Returns the style used to construct this number formatter object.
bool getUseNative() Returns true if this formatter uses native digits to format the number.

ScriptInfo

ILibScriptInfo

Properties

name description
String? script The ISO 15924 4-letter identifier for the script.

Constructors

ILibScriptInfo(String script)

Methods

name description
String? getCode() Return the 4-letter ISO 15924 identifier associated with this script.
int? getCodeNumber() Get the ISO 15924 code number associated with this script.
String? getName() Get the name of this script in English.
String? getLongCode() Get the long identifier associated with this script.
String getScriptDirection() Return the usual direction that text in this script is written in. Possible values: "rtl", "ltr", "ttb".
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
String? locale The locale to use for case mapping. Defaults to the system locale if not provided.
String? direction Indicates whether the mapper is set to convert to uppercase (true) or lowercase (false).

Constructors

ILibCaseMapper({String? locale, String? direction})

Methods

name description
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

ILibCountry({Object? locale})

Methods

name description
List getAvailableCode() Return an array of the ids for all ISO 3166-1 alpha-2 codes that this copy of iLib knows about.
List 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.