docs: add I18n interface
This commit is contained in:
parent
e111d03b8f
commit
7c93e63ca4
|
@ -163,7 +163,7 @@ The `new Picker(options)` constructor supports several options:
|
|||
Name | Type | Default | Description |
|
||||
------ | ------ | ------ | ------ |
|
||||
`dataSource` | string | "https://cdn.jsdelivr.net/npm/emojibase-data@5/en/data.json" | URL to fetch the emojibase data from |
|
||||
`i18n` | object | - | i18n object (see below for details) |
|
||||
`i18n` | I18n | - | i18n object (see below for details) |
|
||||
`locale` | string | "en" | Locale string |
|
||||
|
||||
**Returns:** *Picker*
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import {PickerConstructorOptions} from "./shared";
|
||||
import {I18n, PickerConstructorOptions} from "./shared";
|
||||
|
||||
export default class Picker extends HTMLElement {
|
||||
dataSource: string;
|
||||
locale: string;
|
||||
i18n: object;
|
||||
i18n: I18n;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -14,7 +14,7 @@ export default class Picker extends HTMLElement {
|
|||
constructor({
|
||||
dataSource = 'https://cdn.jsdelivr.net/npm/emojibase-data@5/en/data.json',
|
||||
locale = 'en',
|
||||
i18n = {}
|
||||
i18n
|
||||
}: PickerConstructorOptions = {}) {
|
||||
super()
|
||||
}
|
||||
|
|
|
@ -18,5 +18,29 @@ export interface DatabaseConstructorOptions {
|
|||
export interface PickerConstructorOptions {
|
||||
dataSource?: string,
|
||||
locale?: string,
|
||||
i18n?: object
|
||||
i18n?: I18n
|
||||
}
|
||||
|
||||
export interface I18n {
|
||||
emojiUnsupported: string,
|
||||
loading: string,
|
||||
networkError: string,
|
||||
regionLabel: string,
|
||||
search: string,
|
||||
skinToneLabel: string,
|
||||
searchResultsLabel: string,
|
||||
categoriesLabel: string,
|
||||
categories: I18nCategories
|
||||
}
|
||||
|
||||
export interface I18nCategories {
|
||||
'smileys-emotion': string,
|
||||
'people-body': string,
|
||||
'animals-nature': string,
|
||||
'food-drink': string,
|
||||
'travel-places': string,
|
||||
activities: string,
|
||||
objects: string,
|
||||
symbols: string,
|
||||
flags: string
|
||||
}
|
Loading…
Reference in New Issue