Skip to content

Commit

Permalink
docs: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
cheton committed Jul 8, 2022
1 parent ec38239 commit 308a15b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
42 changes: 31 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ module.exports = {
fallbackKey: function(ns, value) {
return value;
},
supportBasicHtmlNodes: true,
keepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'],
acorn: {
ecmaVersion: 2020,
sourceType: 'module', // defaults to 'module'
Expand All @@ -148,7 +150,9 @@ module.exports = {
interpolation: {
prefix: '{{',
suffix: '}}'
}
},
metadata: {},
allowDynamicKeys: false,
},
transform: function customTransform(file, enc, done) {
"use strict";
Expand Down Expand Up @@ -498,18 +502,25 @@ Below are the configuration options with their default values:
sort: false,
attr: {
list: ['data-i18n'],
extensions: ['.html', '.htm']
extensions: ['.html', '.htm'],
},
func: {
list: ['i18next.t', 'i18n.t'],
extensions: ['.js', '.jsx']
extensions: ['.js', '.jsx'],
},
trans: {
component: 'Trans',
i18nKey: 'i18nKey',
defaultsKey: 'defaults',
extensions: ['.js', '.jsx'],
fallbackKey: false
fallbackKey: false,
supportBasicHtmlNodes: true,
keepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'],
acorn: {
ecmaVersion: 2020,
sourceType: 'module', // defaults to 'module'
// Check out https://github.com/acornjs/acorn/tree/master/acorn#interface for additional options
},
},
lngs: ['en'],
ns: ['translation'],
Expand All @@ -520,7 +531,7 @@ Below are the configuration options with their default values:
loadPath: 'i18n/{{lng}}/{{ns}}.json',
savePath: 'i18n/{{lng}}/{{ns}}.json',
jsonIndent: 2,
lineEnding: '\n'
lineEnding: '\n',
},
nsSeparator: ':',
keySeparator: '.',
Expand All @@ -529,8 +540,10 @@ Below are the configuration options with their default values:
contextDefaultValues: [],
interpolation: {
prefix: '{{',
suffix: '}}'
}
suffix: '}}',
},
metadata: {},
allowDynamicKeys: false,
}
```

Expand Down Expand Up @@ -606,7 +619,14 @@ If an `Object` is supplied, you can specify a list of extensions, or override th
i18nKey: 'i18nKey',
defaultsKey: 'defaults',
extensions: ['.js', '.jsx'],
fallbackKey: false
fallbackKey: false,
supportBasicHtmlNodes: true, // Enables keeping the name of simple nodes (e.g. <br/>) in translations instead of indexed keys.
keepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'], // Which nodes are allowed to be kept in translations during defaultValue generation of <Trans>.
acorn: {
ecmaVersion: 2020,
sourceType: 'module', // defaults to 'module'
// Check out https://github.com/acornjs/acorn/tree/master/acorn#interface for additional options
},
}
}
```
Expand Down Expand Up @@ -819,9 +839,6 @@ interpolation options
}
```

## Integration Guide
Checkout [Integration Guide](https://github.com/i18next/i18next-scanner/wiki/Integration-Guide) to learn how to integrate with [React](https://github.com/i18next/i18next-scanner/wiki/Integration-Guide#react), [Gettext Style I18n](https://github.com/i18next/i18next-scanner/wiki/Integration-Guide#gettext-style-i18n), and [Handlebars](https://github.com/i18next/i18next-scanner/wiki/Integration-Guide#handlebars).

#### metadata

Type: `Object` Default: `{}`
Expand Down Expand Up @@ -881,6 +898,9 @@ Example Usage:
done();
```

## Integration Guide
Checkout [Integration Guide](https://github.com/i18next/i18next-scanner/wiki/Integration-Guide) to learn how to integrate with [React](https://github.com/i18next/i18next-scanner/wiki/Integration-Guide#react), [Gettext Style I18n](https://github.com/i18next/i18next-scanner/wiki/Integration-Guide#gettext-style-i18n), and [Handlebars](https://github.com/i18next/i18next-scanner/wiki/Integration-Guide#handlebars).

## License

MIT
4 changes: 2 additions & 2 deletions src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ const defaults = {
defaultsKey: 'defaults',
extensions: ['.js', '.jsx'],
fallbackKey: false,
supportBasicHtmlNodes: true, // Enables keeping the name of simple nodes (e.g. <br/>) in translations instead of indexed keys.
keepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'], // Which nodes are allowed to be kept in translations during defaultValue generation of <Trans>.
acorn: {
ecmaVersion: 2020, // defaults to 2020
sourceType: 'module', // defaults to 'module'
// Check out https://github.com/acornjs/acorn/tree/master/acorn#interface for additional options
},
supportBasicHtmlNodes: true, // Enables keeping the name of simple nodes (e.g. <br/>) in translations instead of indexed keys
keepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'], // Which nodes are allowed to be kept in translations during defaultValue generation of <Trans>.
},

lngs: ['en'], // array of supported languages
Expand Down

0 comments on commit 308a15b

Please sign in to comment.