-
-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
188 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,33 @@ | ||
declare module "react-native-localize" { | ||
export type LocalizationEvent = "change"; | ||
|
||
export type Calendar = "gregorian" | "japanese" | "buddhist"; | ||
export type TemperatureUnit = "celsius" | "fahrenheit"; | ||
|
||
export interface LanguagesConfig { | ||
readonly languages: string[]; | ||
readonly currencies: string[]; | ||
readonly calendar: Calendar; | ||
readonly country: string; | ||
readonly temperatureUnit: TemperatureUnit; | ||
readonly timeZone: string; | ||
readonly uses24HourClock: boolean; | ||
readonly usesMetricSystem: boolean; | ||
} | ||
|
||
export type LanguagesEmitterSubscription = { | ||
remove: () => void; | ||
export type Locale = { | ||
readonly languageCode: string; | ||
readonly scriptCode?: string; | ||
readonly countryCode: string; | ||
readonly languageTag: string; | ||
readonly isRTL: boolean; | ||
}; | ||
export type LanguagesEvent = "configDidChange"; | ||
export type LanguagesEventHandler = (config: LanguagesConfig) => any; | ||
|
||
interface RNLocalizeModule extends LanguagesConfig { | ||
addListener: ( | ||
type: LanguagesEvent, | ||
handler: LanguagesEventHandler, | ||
) => LanguagesEmitterSubscription; | ||
} | ||
export function getCalendar(): Calendar; | ||
export function getCountry(): string; | ||
export function getCurrencies(): string[]; | ||
export function getLocales(): Locale[]; | ||
export function getTemperatureUnit(): TemperatureUnit; | ||
export function getTimeZone(): string; | ||
export function uses24HourClock(): boolean; | ||
export function usesMetricSystem(): boolean; | ||
|
||
export function addEventListener( | ||
type: LocalizationEvent, | ||
handler: Function, | ||
): void; | ||
|
||
let Module: RNLocalizeModule; | ||
export default Module; | ||
export function removeEventListener( | ||
type: LocalizationEvent, | ||
handler: Function, | ||
): void; | ||
} |
Oops, something went wrong.