summaryrefslogtreecommitdiffstats
path: root/intl/icu_capi/js/package/lib/ICU4XLocale.d.ts
blob: b18b577302d8c0c35c02a4a8e9fca2c1dee20c73 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import { FFIError } from "./diplomat-runtime"
import { ICU4XError } from "./ICU4XError";
import { ICU4XOrdering } from "./ICU4XOrdering";

/**

 * An ICU4X Locale, capable of representing strings like `"en-US"`.

 * See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html Rust documentation for `Locale`} for more information.
 */
export class ICU4XLocale {

  /**

   * Construct an {@link ICU4XLocale `ICU4XLocale`} from an locale identifier.

   * This will run the complete locale parsing algorithm. If code size and performance are critical and the locale is of a known shape (such as `aa-BB`) use `create_und`, `set_language`, `set_script`, and `set_region`.

   * See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.try_from_bytes Rust documentation for `try_from_bytes`} for more information.
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  static create_from_string(name: string): ICU4XLocale | never;

  /**

   * Construct a default undefined {@link ICU4XLocale `ICU4XLocale`} "und".

   * See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#associatedconstant.UND Rust documentation for `UND`} for more information.
   */
  static create_und(): ICU4XLocale;

  /**

   * Clones the {@link ICU4XLocale `ICU4XLocale`}.

   * See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html Rust documentation for `Locale`} for more information.
   */
  clone(): ICU4XLocale;

  /**

   * Write a string representation of the `LanguageIdentifier` part of {@link ICU4XLocale `ICU4XLocale`} to `write`.

   * See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id Rust documentation for `id`} for more information.
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  basename(): string | never;

  /**

   * Write a string representation of the unicode extension to `write`

   * See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.extensions Rust documentation for `extensions`} for more information.
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  get_unicode_extension(bytes: string): string | never;

  /**

   * Write a string representation of {@link ICU4XLocale `ICU4XLocale`} language to `write`

   * See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id Rust documentation for `id`} for more information.
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  language(): string | never;

  /**

   * Set the language part of the {@link ICU4XLocale `ICU4XLocale`}.

   * See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.try_from_bytes Rust documentation for `try_from_bytes`} for more information.
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  set_language(bytes: string): void | never;

  /**

   * Write a string representation of {@link ICU4XLocale `ICU4XLocale`} region to `write`

   * See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id Rust documentation for `id`} for more information.
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  region(): string | never;

  /**

   * Set the region part of the {@link ICU4XLocale `ICU4XLocale`}.

   * See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.try_from_bytes Rust documentation for `try_from_bytes`} for more information.
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  set_region(bytes: string): void | never;

  /**

   * Write a string representation of {@link ICU4XLocale `ICU4XLocale`} script to `write`

   * See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id Rust documentation for `id`} for more information.
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  script(): string | never;

  /**

   * Set the script part of the {@link ICU4XLocale `ICU4XLocale`}. Pass an empty string to remove the script.

   * See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.try_from_bytes Rust documentation for `try_from_bytes`} for more information.
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  set_script(bytes: string): void | never;

  /**

   * Best effort locale canonicalizer that doesn't need any data

   * Use ICU4XLocaleCanonicalizer for better control and functionality

   * See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.canonicalize Rust documentation for `canonicalize`} for more information.
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  static canonicalize(bytes: string): string | never;

  /**

   * Write a string representation of {@link ICU4XLocale `ICU4XLocale`} to `write`

   * See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.write_to Rust documentation for `write_to`} for more information.
   * @throws {@link FFIError}<{@link ICU4XError}>
   */
  to_string(): string | never;

  /**

   * See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.normalizing_eq Rust documentation for `normalizing_eq`} for more information.
   */
  normalizing_eq(other: string): boolean;

  /**

   * See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.strict_cmp Rust documentation for `strict_cmp`} for more information.
   */
  strict_cmp(other: string): ICU4XOrdering;

  /**

   * Deprecated

   * Use `create_from_string("en").
   */
  static create_en(): ICU4XLocale;

  /**

   * Deprecated

   * Use `create_from_string("bn").
   */
  static create_bn(): ICU4XLocale;
}