Options
All
  • Public
  • Public/Protected
  • All
Menu

Module i18n/server

Index

References

DomainsRegistry

Re-exports DomainsRegistry

LocaleType

Re-exports LocaleType

LocalesRegistry

Re-exports LocalesRegistry

StringsRegistry

Re-exports StringsRegistry

defaultLocale

Re-exports defaultLocale

detectLocale

Re-exports detectLocale

formatLabel

Re-exports formatLabel

getIntlKeys

Re-exports getIntlKeys

getIntlLabel

Re-exports getIntlLabel

getIntlString

Re-exports getIntlString

getValidLocale

Re-exports getValidLocale

initLocale

Re-exports initLocale

isIntlDataField

Re-exports isIntlDataField

isIntlField

Re-exports isIntlField

makeLocalesRegistry

Re-exports makeLocalesRegistry

makeStringsRegistry

Re-exports makeStringsRegistry

schemaHasIntlField

Re-exports schemaHasIntlField

schemaHasIntlFields

Re-exports schemaHasIntlFields

truncateKey

Re-exports truncateKey

validateIntlField

Re-exports validateIntlField

Variables

Const graphql

graphql: { makeResolvers: (registries: { LocalesRegistry: { Locales: LocaleType[]; getLocale: (localeId: string) => undefined | LocaleType; registerLocale: (locale: any) => void }; StringsRegistry: { Strings: {}; addStrings: (language: any, strings: any) => void; getString: (__namedParameters: any) => string; getStrings: (localeId: any) => any } }) => { Query: { locale: (root: any, __namedParameters: Object, context: any) => Promise<{ dynamic?: boolean; id?: string; label?: string; method?: any; originalId?: string; required?: boolean; rtl?: boolean; strings: any }> } }; typeDefs: string } = ...

To be merged in your own schema

Type declaration

  • makeResolvers: (registries: { LocalesRegistry: { Locales: LocaleType[]; getLocale: (localeId: string) => undefined | LocaleType; registerLocale: (locale: any) => void }; StringsRegistry: { Strings: {}; addStrings: (language: any, strings: any) => void; getString: (__namedParameters: any) => string; getStrings: (localeId: any) => any } }) => { Query: { locale: (root: any, __namedParameters: Object, context: any) => Promise<{ dynamic?: boolean; id?: string; label?: string; method?: any; originalId?: string; required?: boolean; rtl?: boolean; strings: any }> } }
      • (registries: { LocalesRegistry: { Locales: LocaleType[]; getLocale: (localeId: string) => undefined | LocaleType; registerLocale: (locale: any) => void }; StringsRegistry: { Strings: {}; addStrings: (language: any, strings: any) => void; getString: (__namedParameters: any) => string; getStrings: (localeId: any) => any } }): { Query: { locale: (root: any, __namedParameters: Object, context: any) => Promise<{ dynamic?: boolean; id?: string; label?: string; method?: any; originalId?: string; required?: boolean; rtl?: boolean; strings: any }> } }
      • Parameters

        • registries: { LocalesRegistry: { Locales: LocaleType[]; getLocale: (localeId: string) => undefined | LocaleType; registerLocale: (locale: any) => void }; StringsRegistry: { Strings: {}; addStrings: (language: any, strings: any) => void; getString: (__namedParameters: any) => string; getStrings: (localeId: any) => any } }
          • LocalesRegistry: { Locales: LocaleType[]; getLocale: (localeId: string) => undefined | LocaleType; registerLocale: (locale: any) => void }
            • Locales: LocaleType[]
            • getLocale: (localeId: string) => undefined | LocaleType
                • Parameters

                  • localeId: string

                  Returns undefined | LocaleType

            • registerLocale: (locale: any) => void
                • (locale: any): void
                • Parameters

                  • locale: any

                  Returns void

          • StringsRegistry: { Strings: {}; addStrings: (language: any, strings: any) => void; getString: (__namedParameters: any) => string; getStrings: (localeId: any) => any }
            • Strings: {}
            • addStrings: (language: any, strings: any) => void
                • (language: any, strings: any): void
                • Parameters

                  • language: any
                  • strings: any

                  Returns void

            • getString: (__namedParameters: any) => string
                • (__namedParameters: any): string
                • Parameters

                  • __namedParameters: any

                  Returns string

            • getStrings: (localeId: any) => any
                • (localeId: any): any
                • Parameters

                  • localeId: any

                  Returns any

        Returns { Query: { locale: (root: any, __namedParameters: Object, context: any) => Promise<{ dynamic?: boolean; id?: string; label?: string; method?: any; originalId?: string; required?: boolean; rtl?: boolean; strings: any }> } }

        • Query: { locale: (root: any, __namedParameters: Object, context: any) => Promise<{ dynamic?: boolean; id?: string; label?: string; method?: any; originalId?: string; required?: boolean; rtl?: boolean; strings: any }> }
          • locale: (root: any, __namedParameters: Object, context: any) => Promise<{ dynamic?: boolean; id?: string; label?: string; method?: any; originalId?: string; required?: boolean; rtl?: boolean; strings: any }>
              • (root: any, __namedParameters: Object, context: any): Promise<{ dynamic?: boolean; id?: string; label?: string; method?: any; originalId?: string; required?: boolean; rtl?: boolean; strings: any }>
              • Parameters

                • root: any
                • __namedParameters: Object
                • context: any

                Returns Promise<{ dynamic?: boolean; id?: string; label?: string; method?: any; originalId?: string; required?: boolean; rtl?: boolean; strings: any }>

  • typeDefs: string

Functions

Const getLocaleFromRegistries

  • getLocaleFromRegistries(registries: { LocalesRegistry: { Locales: LocaleType[]; getLocale: (localeId: string) => undefined | LocaleType; registerLocale: (locale: any) => void }; StringsRegistry: { Strings: {}; addStrings: (language: any, strings: any) => void; getString: (__namedParameters: any) => string; getStrings: (localeId: any) => any } }): (localeId: string) => { dynamic?: boolean; id?: string; label?: string; method?: any; originalId?: string; required?: boolean; rtl?: boolean; strings: any }
  • Reusable helper to avoid calling the "locale" API from graphql, during SSR

    Parameters

    • registries: { LocalesRegistry: { Locales: LocaleType[]; getLocale: (localeId: string) => undefined | LocaleType; registerLocale: (locale: any) => void }; StringsRegistry: { Strings: {}; addStrings: (language: any, strings: any) => void; getString: (__namedParameters: any) => string; getStrings: (localeId: any) => any } }
      • LocalesRegistry: { Locales: LocaleType[]; getLocale: (localeId: string) => undefined | LocaleType; registerLocale: (locale: any) => void }
        • Locales: LocaleType[]
        • getLocale: (localeId: string) => undefined | LocaleType
            • Parameters

              • localeId: string

              Returns undefined | LocaleType

        • registerLocale: (locale: any) => void
            • (locale: any): void
            • Parameters

              • locale: any

              Returns void

      • StringsRegistry: { Strings: {}; addStrings: (language: any, strings: any) => void; getString: (__namedParameters: any) => string; getStrings: (localeId: any) => any }
        • Strings: {}
        • addStrings: (language: any, strings: any) => void
            • (language: any, strings: any): void
            • Parameters

              • language: any
              • strings: any

              Returns void

        • getString: (__namedParameters: any) => string
            • (__namedParameters: any): string
            • Parameters

              • __namedParameters: any

              Returns string

        • getStrings: (localeId: any) => any
            • (localeId: any): any
            • Parameters

              • localeId: any

              Returns any

    Returns (localeId: string) => { dynamic?: boolean; id?: string; label?: string; method?: any; originalId?: string; required?: boolean; rtl?: boolean; strings: any }

      • (localeId: string): { dynamic?: boolean; id?: string; label?: string; method?: any; originalId?: string; required?: boolean; rtl?: boolean; strings: any }
      • Parameters

        • localeId: string

        Returns { dynamic?: boolean; id?: string; label?: string; method?: any; originalId?: string; required?: boolean; rtl?: boolean; strings: any }

        • Optional dynamic?: boolean

          Locale must be fetched from the server (see LocaleContext)

        • Optional id?: string
        • Optional label?: string
        • Optional method?: any
        • Optional originalId?: string

          If the id doesn't exist, we can try to fetch another local. OriginalId is the initial requested id

        • Optional required?: boolean
        • Optional rtl?: boolean

          Right-to-left (arabic, persian...)

        • strings: any

Generated using TypeDoc