• Preparing search index...
  • The search index is not available
devowl-wp
  • devowl-wp
  • wordpress-plugins/real-cookie-banner/src/public/ts/admin
  • createLocalizationFactory

Function createLocalizationFactory

  • createLocalizationFactory(slug): {
        __: ((single, ...args) => string);
        _i: ((translation, components?) => any);
        _n: ((single, plural, count, ...args) => string);
        _nx: ((single, plural, context, count, ...args) => string);
        _x: ((single, context, ...args) => string);
    }
  • Create multiple functions for a specific plugin so they can be localized.

    Parameters

    • slug: string

      The slug which you have registered your i18n assets

    Returns {
        __: ((single, ...args) => string);
        _i: ((translation, components?) => any);
        _n: ((single, plural, count, ...args) => string);
        _nx: ((single, plural, context, count, ...args) => string);
        _x: ((single, context, ...args) => string);
    }

    • __: ((single, ...args) => string)
        • (single, ...args): string
        • Retrieve the translation of text. For arguments sprintf is used, see http://www.diveintojavascript.com/projects/javascript-sprintf for specification and usage.

          Parameters

          • single: string
          • Rest ...args: any[]

          Returns string

          See

          • https://github.com/WordPress/gutenberg/tree/master/packages/i18n#_n
          • https://github.com/WordPress/gutenberg/tree/master/packages/i18n#sprintf
    • _i: ((translation, components?) => any)
        • (translation, components?): any
        • This function allows you to interpolate react components to your translations. You have to pass an already translated string as argument! For this you can use the other i18n functions like _n() or __().

          A translation can look like this: "Hello {{a}}click me{{/a}}." and you have to pass a component with key "a".

          Parameters

          • translation: string
          • Optional components: {
                [placeholder: string]: ReactElement;
            }
            • [placeholder: string]: ReactElement

          Returns any

    • _n: ((single, plural, count, ...args) => string)
        • (single, plural, count, ...args): string
        • Translates and retrieves the singular or plural form based on the supplied number. For arguments sprintf is used, see http://www.diveintojavascript.com/projects/javascript-sprintf for specification and usage.

          Parameters

          • single: string
          • plural: string
          • count: number
          • Rest ...args: any[]

          Returns string

          See

          • https://github.com/WordPress/gutenberg/tree/master/packages/i18n#_n
          • https://github.com/WordPress/gutenberg/tree/master/packages/i18n#sprintf
    • _nx: ((single, plural, context, count, ...args) => string)
        • (single, plural, context, count, ...args): string
        • Translates and retrieves the singular or plural form based on the supplied number, with gettext context. For arguments sprintf is used, see http://www.diveintojavascript.com/projects/javascript-sprintf for specification and usage.

          Parameters

          • single: string
          • plural: string
          • context: string
          • count: number
          • Rest ...args: any[]

          Returns string

          See

          • https://github.com/WordPress/gutenberg/tree/master/packages/i18n#_n
          • https://github.com/WordPress/gutenberg/tree/master/packages/i18n#sprintf
    • _x: ((single, context, ...args) => string)
        • (single, context, ...args): string
        • Retrieve translated string with gettext context. For arguments sprintf is used, see http://www.diveintojavascript.com/projects/javascript-sprintf for specification and usage.

          Parameters

          • single: string
          • context: string
          • Rest ...args: any[]

          Returns string

          See

          • https://github.com/WordPress/gutenberg/tree/master/packages/i18n#_n
          • https://github.com/WordPress/gutenberg/tree/master/packages/i18n#sprintf
    • Defined in ../../wordpress-packages/utils/lib/factory/i18n.tsx:19

Settings

Member Visibility

Theme

devowl-wp
  • Loading...

Generated using TypeDoc