1.0.6 • Published 1 year ago

i18next-gridly-backend v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

i18next-gridly-backend

npm release bundlephobia

A simple i18next backend for Gridly, a spreadsheet for multi-language content.

Installation

npm install i18next i18next-gridly-backend

Basic usage

IMPORTANT: make sure to use read-only apiKey in the production build to avoid misuse by strangers

import i18next from 'i18next';
import GridlyBackend, { GridlyBackendOptions } from 'i18next-gridly-backend';

const isProduction = process.env.NODE_ENV === 'production';
const gridlyOptions: GridlyBackendOptions = {
  apiKey: 'API_KEY', // Use read-only API key in production env for security reason
  viewId: 'VIEW_ID',
};

i18next
  .use(GridlyBackend)
  // for all options read: https://www.i18next.com/overview/configuration-options
  .init({
    debug: true,
    lng: 'en',
    fallbackLng: 'en',
    backend: gridlyOptions,
    saveMissing: !isProduction,
  });

React

See example

Gridly Backend Options

{
    // Also used in production, please restrict this API key for your own risk
    apiKey: string;

    // View id
    viewId: string;

    // Namespace column id
    namespaceColumnId?: string;

    // Run after adding missing translation success
    onSaveSuccess?: (languages: readonly string[], namespace: string) => void;
}

License

MIT

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago