mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-04 01:09:20 +02:00
fix(v2): i18n perf issue: getTranslationFile() should not load content again (#4593)
* Fix getTranslationFiles() perf issue * improve doc
This commit is contained in:
parent
e99bb43823
commit
cb403afa93
5 changed files with 22 additions and 20 deletions
|
@ -601,7 +601,7 @@ For example, the in docusaurus-plugin-content-docs:
|
|||
|
||||
## i18n lifecycles {#i18n-lifecycles}
|
||||
|
||||
### `getTranslationFiles()` {#get-translation-files}
|
||||
### `getTranslationFiles({content})` {#get-translation-files}
|
||||
|
||||
Plugins declare the JSON translation files they want to use.
|
||||
|
||||
|
@ -619,7 +619,7 @@ module.exports = function (context, options) {
|
|||
return {
|
||||
name: 'my-plugin',
|
||||
// highlight-start
|
||||
async getTranslationFiles() {
|
||||
async getTranslationFiles({content}) {
|
||||
return [
|
||||
{
|
||||
path: 'sidebar-labels',
|
||||
|
@ -628,6 +628,7 @@ module.exports = function (context, options) {
|
|||
message: 'Some Sidebar Label',
|
||||
description: 'A label used in my plugin in the sidebar',
|
||||
},
|
||||
someLabelFromContent: content.myLabel,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue