| 1 |
import { FFIError } from "./diplomat-runtime" |
| 2 |
import { ICU4XError } from "./ICU4XError"; |
| 3 |
import { ICU4XOrdering } from "./ICU4XOrdering"; |
| 4 |
|
| 5 |
/** |
| 6 |
|
| 7 |
* An ICU4X Locale, capable of representing strings like `"en-US"`. |
| 8 |
|
| 9 |
* See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html Rust documentation for `Locale`} for more information. |
| 10 |
*/ |
| 11 |
export class ICU4XLocale { |
| 12 |
|
| 13 |
/** |
| 14 |
|
| 15 |
* Construct an {@link ICU4XLocale `ICU4XLocale`} from an locale identifier. |
| 16 |
|
| 17 |
* 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`. |
| 18 |
|
| 19 |
* 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. |
| 20 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 21 |
*/ |
| 22 |
static create_from_string(name: string): ICU4XLocale | never; |
| 23 |
|
| 24 |
/** |
| 25 |
|
| 26 |
* Construct a default undefined {@link ICU4XLocale `ICU4XLocale`} "und". |
| 27 |
|
| 28 |
* See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#associatedconstant.UND Rust documentation for `UND`} for more information. |
| 29 |
*/ |
| 30 |
static create_und(): ICU4XLocale; |
| 31 |
|
| 32 |
/** |
| 33 |
|
| 34 |
* Clones the {@link ICU4XLocale `ICU4XLocale`}. |
| 35 |
|
| 36 |
* See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html Rust documentation for `Locale`} for more information. |
| 37 |
*/ |
| 38 |
clone(): ICU4XLocale; |
| 39 |
|
| 40 |
/** |
| 41 |
|
| 42 |
* Write a string representation of the `LanguageIdentifier` part of {@link ICU4XLocale `ICU4XLocale`} to `write`. |
| 43 |
|
| 44 |
* See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id Rust documentation for `id`} for more information. |
| 45 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 46 |
*/ |
| 47 |
basename(): string | never; |
| 48 |
|
| 49 |
/** |
| 50 |
|
| 51 |
* Write a string representation of the unicode extension to `write` |
| 52 |
|
| 53 |
* See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.extensions Rust documentation for `extensions`} for more information. |
| 54 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 55 |
*/ |
| 56 |
get_unicode_extension(bytes: string): string | never; |
| 57 |
|
| 58 |
/** |
| 59 |
|
| 60 |
* Write a string representation of {@link ICU4XLocale `ICU4XLocale`} language to `write` |
| 61 |
|
| 62 |
* See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id Rust documentation for `id`} for more information. |
| 63 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 64 |
*/ |
| 65 |
language(): string | never; |
| 66 |
|
| 67 |
/** |
| 68 |
|
| 69 |
* Set the language part of the {@link ICU4XLocale `ICU4XLocale`}. |
| 70 |
|
| 71 |
* 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. |
| 72 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 73 |
*/ |
| 74 |
set_language(bytes: string): void | never; |
| 75 |
|
| 76 |
/** |
| 77 |
|
| 78 |
* Write a string representation of {@link ICU4XLocale `ICU4XLocale`} region to `write` |
| 79 |
|
| 80 |
* See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id Rust documentation for `id`} for more information. |
| 81 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 82 |
*/ |
| 83 |
region(): string | never; |
| 84 |
|
| 85 |
/** |
| 86 |
|
| 87 |
* Set the region part of the {@link ICU4XLocale `ICU4XLocale`}. |
| 88 |
|
| 89 |
* 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. |
| 90 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 91 |
*/ |
| 92 |
set_region(bytes: string): void | never; |
| 93 |
|
| 94 |
/** |
| 95 |
|
| 96 |
* Write a string representation of {@link ICU4XLocale `ICU4XLocale`} script to `write` |
| 97 |
|
| 98 |
* See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#structfield.id Rust documentation for `id`} for more information. |
| 99 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 100 |
*/ |
| 101 |
script(): string | never; |
| 102 |
|
| 103 |
/** |
| 104 |
|
| 105 |
* Set the script part of the {@link ICU4XLocale `ICU4XLocale`}. Pass an empty string to remove the script. |
| 106 |
|
| 107 |
* 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. |
| 108 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 109 |
*/ |
| 110 |
set_script(bytes: string): void | never; |
| 111 |
|
| 112 |
/** |
| 113 |
|
| 114 |
* Best effort locale canonicalizer that doesn't need any data |
| 115 |
|
| 116 |
* Use ICU4XLocaleCanonicalizer for better control and functionality |
| 117 |
|
| 118 |
* See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.canonicalize Rust documentation for `canonicalize`} for more information. |
| 119 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 120 |
*/ |
| 121 |
static canonicalize(bytes: string): string | never; |
| 122 |
|
| 123 |
/** |
| 124 |
|
| 125 |
* Write a string representation of {@link ICU4XLocale `ICU4XLocale`} to `write` |
| 126 |
|
| 127 |
* See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.write_to Rust documentation for `write_to`} for more information. |
| 128 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 129 |
*/ |
| 130 |
to_string(): string | never; |
| 131 |
|
| 132 |
/** |
| 133 |
|
| 134 |
* See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.normalizing_eq Rust documentation for `normalizing_eq`} for more information. |
| 135 |
*/ |
| 136 |
normalizing_eq(other: string): boolean; |
| 137 |
|
| 138 |
/** |
| 139 |
|
| 140 |
* See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.strict_cmp Rust documentation for `strict_cmp`} for more information. |
| 141 |
*/ |
| 142 |
strict_cmp(other: string): ICU4XOrdering; |
| 143 |
|
| 144 |
/** |
| 145 |
|
| 146 |
* See the {@link https://docs.rs/icu/latest/icu/locid/struct.Locale.html#method.total_cmp Rust documentation for `total_cmp`} for more information. |
| 147 |
*/ |
| 148 |
total_cmp(other: ICU4XLocale): ICU4XOrdering; |
| 149 |
|
| 150 |
/** |
| 151 |
|
| 152 |
* Deprecated |
| 153 |
|
| 154 |
* Use `create_from_string("en"). |
| 155 |
*/ |
| 156 |
static create_en(): ICU4XLocale; |
| 157 |
|
| 158 |
/** |
| 159 |
|
| 160 |
* Deprecated |
| 161 |
|
| 162 |
* Use `create_from_string("bn"). |
| 163 |
*/ |
| 164 |
static create_bn(): ICU4XLocale; |
| 165 |
} |