How to use the i18n-calypso.I18N function in i18n-calypso

To help you get started, we’ve selected a few i18n-calypso examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matzeeable / wp-reactjs-starter / public / src / util / i18n.tsx View on Github external
// @see https://github.com/Automattic/wp-calypso/blob/master/packages/i18n-calypso/src/index.js

/**
 * Internal dependencies
 */
// @ts-ignore i18n-calpyso has no types, yet
import { I18N } from "i18n-calypso";
import React from "react";
import { pluginOptions, process } from "./";
import $ from "jquery";

const i18n = new I18N();

$.each(pluginOptions.i18n, (key: string, value: string) => {
    i18n.addTranslations({
        [key]: [value]
    });
});

// All available exports but do not export because there are no typings available officially
// export const moment = i18n.moment;
// export const numberFormat = i18n.numberFormat.bind(i18n);
// export const translate = i18n.translate.bind(i18n);
// export const configure = i18n.configure.bind(i18n);
// export const setLocale = i18n.setLocale.bind(i18n);
// export const getLocale = i18n.getLocale.bind(i18n);
// export const getLocaleSlug = i18n.getLocaleSlug.bind(i18n);
// export const addTranslations = i18n.addTranslations.bind(i18n);