feat(core): support TypeScript + ESM configuration (#9317)

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
Chongyi Zheng 2023-10-13 20:46:03 -04:00 committed by GitHub
parent 336a44f3ea
commit 45f1a669b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
126 changed files with 2054 additions and 914 deletions

View file

@ -19,8 +19,8 @@ These files will be written by the [`write-translations` CLI](../../cli.mdx#docu
Example:
```js
module.exports = function (context, options) {
```js title="my-plugin.js"
export default function (context, options) {
return {
name: 'my-plugin',
// highlight-start
@ -40,7 +40,7 @@ module.exports = function (context, options) {
},
// highlight-end
};
};
}
```
## `translateContent({content,translationFiles})` {#translateContent}
@ -53,8 +53,8 @@ The `contentLoaded()` lifecycle will be called with the localized plugin content
Example:
```js
module.exports = function (context, options) {
```js title="my-plugin.js"
export default function (context, options) {
return {
name: 'my-plugin',
// highlight-start
@ -69,7 +69,7 @@ module.exports = function (context, options) {
},
// highlight-end
};
};
}
```
## `translateThemeConfig({themeConfig,translationFiles})` {#translateThemeConfig}
@ -80,8 +80,8 @@ Returns the localized `themeConfig`.
Example:
```js
module.exports = function (context, options) {
```js title="my-plugin.js"
export default function (context, options) {
return {
name: 'my-theme',
// highlight-start
@ -96,7 +96,7 @@ module.exports = function (context, options) {
},
// highlight-end
};
};
}
```
## `async getDefaultCodeTranslationMessages()` {#getDefaultCodeTranslationMessages}
@ -107,8 +107,8 @@ It should return messages in `Record<string, string>`, where keys are translatio
Example:
```js
module.exports = function (context, options) {
```js title="my-plugin.js"
export default function (context, options) {
return {
name: 'my-theme',
// highlight-start
@ -117,5 +117,5 @@ module.exports = function (context, options) {
},
// highlight-end
};
};
}
```