1.0.17 • Published 4 years ago

netlify-cms-widget-i18n v1.0.17

Weekly downloads
28
License
MIT
Repository
-
Last release
4 years ago

netlify-cms-widget-i18n

A custom Netlify CMS widget for editing i18n files.

npm version

This is a widget to handle your internationalization files with Netlify CMS that you can use for your MIT projects. This widget uses the awesome table component Handsometable on its Non-commercial version.

Once installed, you will have a widget to manage your key-value internazionalization JSON files with: -Key duplicate detection -Copy/paste capable -Insert/delete rows -Search and filter the content for large files

GIF

Here's an animation of the CMS widget.
Screenshot gif

Installation

As an npm package:

yarn add netlify-cms-widget-i18n

or

npm install --save netlify-cms-widget-i18n
import NetlifyCmsWidgetI18n from 'netlify-cms-widget-i18n'

CMS.registerWidget('I18n', I18nControl, I18nPreview)

Usage

Add to your Netlify CMS configuration a collection per language that you want to support with your i18n files.
A field named title is required to be able to give the JSON file a name when creating new ones, and also a prop named title will have this value inside the i18n JSON file itself.
A second field with widget: 'i18n' will be the widget itself, the field name inside this one will be the name of the prop inside the JSON file.
If name: "en" then the i18n JSON file will be

{
  "en": {
    "MY_KEY": "My literal in english"
  }
}

For example, English and Spanish can be configured like:

collections:
  - name: "english-i18n-file"
    label: "English files"
    folder: "content/i18n/en"
    extension: json
    create: true
    editor:
      preview: false
    fields:
      - {label: "Title", name: "title", widget: "string"}
      - {label: "i18n content", name: "en", widget: "i18n", pattern: ['^(?!.*\.json$).*$','A JSON file name can have no spaces or special characters']}
  - name: "spanish-i18n-file"
    label: "Spanish files"
    folder: "content/i18n/es"
    extension: json
    create: true
    editor:
      preview: false
    fields:
      - {label: "Title", name: "title", widget: "string"}
      - {label: "i18n content", name: "es", widget: "i18n", pattern: ['^(?!.*\.json$).*$','A JSON file name can have no spaces or special characters']}

Support

For help with this widget, open an issue

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.11

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.2

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.10

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1-security

4 years ago