i18next-gridly-backend
v1.0.7
Published
A simple i18next backend for gridly.com
Downloads
96
Readme
i18next-gridly-backend
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
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