web-ui-pack
Version:
Web package with UI elements
56 lines (55 loc) • 2.66 kB
TypeScript
export declare class WUPlocaleInfo {
/** Last pointed locale
* @defaultValue "" (en-US with custom dateTime format) */
locale: string;
/** User's locale */
localeUser: string;
/** Decimal separator for number 123.4 it's dot */
sepDecimal: string;
/** Thousands separator for number 1,234.5 it's comma */
sep1000: string;
/** Date format, example YYYY-MM-DD */
date: string;
/** Time format, example hh:mm:ss A */
time: string;
/** Date+Time format, example YYYY-MM-DD hh:mm:ss A */
dateTime: string;
/** First day of week where 1-Monday, 7-Sunday;
* @tutorial Troubleshooting
* * detection depends on `Intl.Locale.prototype.weekInfo` https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/weekInfo
* and works from Chrome99 & Safari 15.4 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/weekInfo#browser_compatibility
*/
firstWeekDay: number;
/** Re-define all values (call it if localization changed or you want to set another locale) */
refresh(locale?: string): void;
/** Returns number format according to pointed locale or (user-locale if pointed undefined) */
getNumberOptions(locale?: string): {
sepDecimal: string;
sep1000: string;
};
/** Returns date-time formats according to pointed locale or (user-locale if pointed undefined) */
getDateFormat(locale?: string): {
date: string;
time: string;
dateTime: string;
};
private getDateNames;
/** Names of months: [ "January", "February", "March", ...] */
get namesMonth(): string[];
set namesMonth(v: string[] | undefined);
/** Short names of months: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] */
get namesMonthShort(): string[];
set namesMonthShort(v: string[] | undefined);
/** Short names of days (starts with Monday): ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] */
get namesDayShort(): string[];
set namesDayShort(v: string[] | undefined);
}
/** Locale-object with definitions related to user-locale; call localeInfo.refresh() to update according to userLocale
* @defaultValue 'en-US' with custom dateTime format;
* @tutorial Troubleshooting
* * in JS impossible to define whether user-settings is different from user-locale
* * there is no way to define firstWeekDay for calendar
* * you can redefine/set any property if somehow it locale-definitions don't fit your expectations */
declare const localeInfo: WUPlocaleInfo;
export default localeInfo;