react-localize-redux
Version:
Localization library for handling translations in React
96 lines (75 loc) • 4.1 kB
Flow
// @flow
import type { ComponentType, Component } from 'react';
import type { Selector, SelectorCreator } from 'reselect';
import type { Language as _Language } from './localize';
import type { NamedLanguage as _NamedLanguage } from './localize';
import type { InitializeOptions as _InitializeOptions } from './localize';
import type { TranslateOptions as _TranslateOptions } from './localize';
import type { LocalizeState as _LocalizeState } from './localize';
import type { Translations as _Translations } from './localize';
import type { SingleLanguageTranslation as _SingleLanguageTranslation } from './localize';
import type { MultipleLanguageTranslation as _MultipleLanguageTranslation } from './localize';
import type { TranslateFunction as _TranslateFunction } from './localize';
import type { InitializeAction as _InitializeAction } from './localize';
import type { AddTranslationAction as _AddTranslationAction } from './localize';
import type { AddTranslationForLanguageAction as _AddTranslationForLanguageAction } from './localize';
import type { SetActiveLanguageAction as _SetActiveLanguageAction } from './localize';
import type { Action as _Action } from './localize';
import type { InitializePayload as _InitializePayload } from './localize';
import type { AddTranslationOptions as _AddTranslationOptions } from './localize';
import type {
TranslateProps as _TranslateProps,
TranslateChildFunction as _TranslateChildFunction
} from './Translate';
import type { LocalizeContextProps as _LocalizeContextProps } from './LocalizeContext';
import type { LocalizeProviderProps as _LocalizeProviderProps } from './LocalizeProvider';
import type { Context } from 'create-react-context';
export type Language = _Language;
export type NamedLanguage = _NamedLanguage;
export type InitializeOptions = _InitializeOptions;
export type TranslateOptions = _TranslateOptions;
export type LocalizeState = _LocalizeState;
export type Translations = _Translations;
export type SingleLanguageTranslation = _SingleLanguageTranslation;
export type MultipleLanguageTranslation = _MultipleLanguageTranslation;
export type TranslateFunction = _TranslateFunction;
export type InitializeAction = _InitializeAction;
export type AddTranslationAction = _AddTranslationAction;
export type AddTranslationForLanguageAction = _AddTranslationForLanguageAction;
export type SetActiveLanguageAction = _SetActiveLanguageAction;
export type Action = _Action;
export type InitializePayload = _InitializePayload;
export type AddTranslationOptions = _AddTranslationOptions;
export type TranslateProps = _TranslateProps;
export type TranslateChildFunction = _TranslateChildFunction;
export type LocalizeContextProps = _LocalizeContextProps;
export type LocalizeProviderProps = _LocalizeProviderProps;
declare export function localizeReducer(
state: LocalizeState,
action: Action
): LocalizeState;
declare export function initialize(
payload: InitializePayload
): InitializeAction;
declare export function addTranslation(
translation: MultipleLanguageTranslation,
options?: AddTranslationOptions
): AddTranslationAction;
declare export function addTranslationForLanguage(
translation: SingleLanguageTranslation,
language: string
): AddTranslationForLanguageAction;
declare export function setActiveLanguage(
languageCode: string
): SetActiveLanguageAction;
declare export function getTranslations(state: LocalizeState): Translations;
declare export function getLanguages(state: LocalizeState): Language[];
declare export function getOptions(state: LocalizeState): InitializeOptions;
declare export function getActiveLanguage(state: LocalizeState): Language;
declare export function getTranslate(state: LocalizeState): TranslateFunction;
declare export function withLocalize<Props: {}>(
WrappedComponent: ComponentType<Props>
): ComponentType<$Diff<Props, { ...LocalizeContextProps }>>;
declare export var LocalizeContext: Context<LocalizeContextProps>;
declare export var LocalizeProvider: ComponentType<LocalizeProviderProps>;
declare export var Translate: ComponentType<TranslateProps>;