mirror of
https://github.com/wassname/talk.git
synced 2026-08-18 12:30:39 +08:00
[CORL-800] Fluent Upgrade (#2739)
* feat: upgraded fluent libraries * fix: adjustments to support fluent upgrade
This commit is contained in:
Vendored
+23
-23
@@ -3,8 +3,8 @@
|
||||
// Allowing loading fluent files.
|
||||
declare module "*.ftl";
|
||||
|
||||
declare module "fluent-dom/compat" {
|
||||
import { FluentBundle } from "fluent/compat";
|
||||
declare module "@fluent/dom/compat" {
|
||||
import { FluentBundle } from "@fluent/bundle/compat";
|
||||
|
||||
export class DOMLocalization {
|
||||
constructor(resourceIDs: string[], generateBundles: any);
|
||||
@@ -26,8 +26,8 @@ declare module "fluent-dom/compat" {
|
||||
}
|
||||
}
|
||||
|
||||
declare module "fluent-react/compat" {
|
||||
import { FluentBundle } from "fluent/compat";
|
||||
declare module "@fluent/react/compat" {
|
||||
import { FluentBundle } from "@fluent/bundle/compat";
|
||||
import { ComponentType } from "react";
|
||||
|
||||
export interface LocalizationProviderProps {
|
||||
@@ -43,22 +43,22 @@ declare module "fluent-react/compat" {
|
||||
export const Localized: ComponentType<LocalizedProps>;
|
||||
}
|
||||
|
||||
declare module "fluent-langneg/compat" {
|
||||
export function negotiateLanguages(
|
||||
requestedLocales: ReadonlyArray<string>,
|
||||
available: ReadonlyArray<string>,
|
||||
options: {
|
||||
strategy: "filtering" | "matching" | "lookup";
|
||||
defaultLocale: string;
|
||||
}
|
||||
): string[];
|
||||
}
|
||||
|
||||
declare module "fluent/compat" {
|
||||
declare module "@fluent/bundle/compat" {
|
||||
export interface FluentBundleOptions {
|
||||
functions?: { [key: string]: (...args: any[]) => string | FluentType };
|
||||
useIsolating?: boolean;
|
||||
transform?: ((s: string) => string);
|
||||
transform?: (s: string) => string;
|
||||
}
|
||||
|
||||
export class FluentResource {
|
||||
constructor(source: string);
|
||||
}
|
||||
|
||||
export type Pattern = string;
|
||||
|
||||
export interface RawMessage {
|
||||
value: Pattern | null;
|
||||
attributes: Record<string, Pattern>;
|
||||
}
|
||||
|
||||
export class FluentBundle {
|
||||
@@ -66,13 +66,13 @@ declare module "fluent/compat" {
|
||||
public locales: string[];
|
||||
public readonly messages: Iterator<[string, any]>;
|
||||
public hasMessage(id: string): boolean;
|
||||
public getMessage(id: string): any;
|
||||
public addMessages(source: string): string[];
|
||||
public format(
|
||||
message: any,
|
||||
public getMessage(id: string): RawMessage;
|
||||
public addResource(res: FluentResource, options?: {}): void;
|
||||
public formatPattern(
|
||||
pattern: Pattern,
|
||||
args?: object,
|
||||
errors?: string[]
|
||||
): string | null;
|
||||
errors?: Error[]
|
||||
): string;
|
||||
}
|
||||
|
||||
export class FluentType {
|
||||
|
||||
Reference in New Issue
Block a user