summaryrefslogtreecommitdiffstats
path: root/intl/icu_capi/js/package/lib/ICU4XDataProvider.d.ts
blob: 88bc5902da7949cbeb7519d743253ebeee0f3be0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import { FFIError } from "./diplomat-runtime"
import { ICU4XError } from "./ICU4XError";
import { ICU4XLocaleFallbacker } from "./ICU4XLocaleFallbacker";

/**

 * An ICU4X data provider, capable of loading ICU4X data keys from some source.

 * See the {@link https://docs.rs/icu_provider/latest/icu_provider/index.html Rust documentation for `icu_provider`} for more information.
 */
export class ICU4XDataProvider {

  /**

   * Constructs an {@link ICU4XDataProvider `ICU4XDataProvider`} that uses compiled data.

   * Requires the `compiled_data` feature.

   * This provider cannot be modified or combined with other providers, so `enable_fallback`, `enabled_fallback_with`, `fork_by_locale`, and `fork_by_key` will return `Err`s.
   */
  static create_compiled(): ICU4XDataProvider;

  /**

   * Constructs an `FsDataProvider` and returns it as an {@link ICU4XDataProvider `ICU4XDataProvider`}. Requires the `provider_fs` Cargo feature. Not supported in WASM.

   * See the {@link https://docs.rs/icu_provider_fs/latest/icu_provider_fs/struct.FsDataProvider.html Rust documentation for `FsDataProvider`} for more information.
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  static create_fs(path: string): ICU4XDataProvider | never;

  /**

   * Deprecated

   * Use `create_compiled()`.
   */
  static create_test(): ICU4XDataProvider;

  /**

   * Constructs a `BlobDataProvider` and returns it as an {@link ICU4XDataProvider `ICU4XDataProvider`}.

   * See the {@link https://docs.rs/icu_provider_blob/latest/icu_provider_blob/struct.BlobDataProvider.html Rust documentation for `BlobDataProvider`} for more information.
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  static create_from_byte_slice(blob: Uint8Array): ICU4XDataProvider | never;

  /**

   * Constructs an empty {@link ICU4XDataProvider `ICU4XDataProvider`}.

   * See the {@link https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/empty/struct.EmptyDataProvider.html Rust documentation for `EmptyDataProvider`} for more information.
   */
  static create_empty(): ICU4XDataProvider;

  /**

   * Creates a provider that tries the current provider and then, if the current provider doesn't support the data key, another provider `other`.

   * This takes ownership of the `other` provider, leaving an empty provider in its place.

   * The providers must be the same type (Any or Buffer). This condition is satisfied if both providers originate from the same constructor, such as `create_from_byte_slice` or `create_fs`. If the condition is not upheld, a runtime error occurs.

   * See the {@link https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fork/type.ForkByKeyProvider.html Rust documentation for `ForkByKeyProvider`} for more information.
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  fork_by_key(other: ICU4XDataProvider): void | never;

  /**

   * Same as `fork_by_key` but forks by locale instead of key.

   * See the {@link https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fork/predicates/struct.MissingLocalePredicate.html Rust documentation for `MissingLocalePredicate`} for more information.
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  fork_by_locale(other: ICU4XDataProvider): void | never;

  /**

   * Enables locale fallbacking for data requests made to this provider.

   * Note that the test provider (from `create_test`) already has fallbacking enabled.

   * See the {@link https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html#method.try_new Rust documentation for `try_new`} for more information.

   * Additional information: {@link https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html 1}
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  enable_locale_fallback(): void | never;

  /**

   * See the {@link https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html#method.new_with_fallbacker Rust documentation for `new_with_fallbacker`} for more information.

   * Additional information: {@link https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html 1}
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  enable_locale_fallback_with(fallbacker: ICU4XLocaleFallbacker): void | never;
}