Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional context options #70

Merged
merged 3 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,68 @@ Here we would like to translate "Defined in" hardcoded string. </br>
npx typedoc projects\igniteui-angular\src\ --localize jp --templateStrings ./extras/template/strings/shell-strings.json
```
You can see how our template strings file looks like here [./extras/template/strings/shell-strings.json](https://github.com/IgniteUI/igniteui-angular/blob/master/extras/template/strings/shell-strings.json).

#### Link and Debug
In order to run the plugin locally, after it is build, it should be linked to the repo you want to use it.

1. Execute the following commands

```
npm run build
```

```
npm pack
```

```
cp typedoc-plugin-localization-1.0.4.tgz ~
```

2. Go to the theme repository where the plugin is included as peer dependency and add the reference to the packed file.
Example:

```
"peerDependecies": {
"typedoc-plugin-localization": "file:../../../typedoc-plugin-localization-1.0.4.tgz",
}
```

3. Go to the repository which is using the theme and plugin.

```
npm install ~/typedoc-plugin-localization-1.0.4.tgz
```

4. Add launch.json configuration to enable debbuging

Example:
```
{
"configurations": [
{
"name": "Typedoc plugin",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/typedoc/bin/typedoc",
"args": [
"${workspaceFolder}/projects/igniteui-angular/src/public_api.ts",
"--generate-json",
"${workspaceFolder}/dist",
"--localize",
"en",
"--versioning",
"--product",
"ignite-ui-angular",
"--tsconfig",
"${workspaceFolder}/tsconfig.json"
],
"sourceMaps": true,
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
]
}
]
}
```
2 changes: 2 additions & 0 deletions utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export class Constants {
static readonly INCLUDE_PARAMS_OPTION = 'params';
static readonly LOCALIZE_OPTION = 'localize'
static readonly TEMPLATE_STRINGS_OPTION = 'templateStrings';
static readonly INCLUDE_VERSIONS_OPTION = 'versioning';
static readonly PRODUCT_OPTION = 'product';

static readonly GLOBAL_FUNCS_FILE_NAME = 'globalFunctions';
}
94 changes: 53 additions & 41 deletions utils/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,57 @@ import { Options, ParameterType } from 'typedoc'
import { Constants } from './constants';

export function pluginOptions(options: Pick<Options, "addDeclaration">) {

options.addDeclaration({
name: Constants.CONVERT_OPTION,
help: 'Specifies the directory where the json files have to be generated.'
});

options.addDeclaration({
name: Constants.RENDER_OPTION,
help: 'Specify from where to get the loclized json data.'
});

options.addDeclaration({
name: Constants.INCLUDE_TAGS_OPTION,
help: 'Specify whether to include tags per comment.',
type: ParameterType.Boolean,
defaultValue: false
});

options.addDeclaration({
name: Constants.INCLUDE_PARAMS_OPTION,
help: 'Specify whether to include params per comment.',
type: ParameterType.Boolean,
defaultValue: false
});

options.addDeclaration({
name: Constants.INCLUDE_WARNS_OPTION,
help: 'Specify whether to throw warnings of missed tags and parameters into the json\'s.',
type: ParameterType.Boolean,
defaultValue: false
});

options.addDeclaration({
name: Constants.LOCALIZE_OPTION,
help: 'Specify your localization for instance (jp)'
});

options.addDeclaration({
name: Constants.TEMPLATE_STRINGS_OPTION,
help: 'Path to the json file which contains your localized template strings'
});

options.addDeclaration({
name: Constants.CONVERT_OPTION,
help: 'Specifies the directory where the json files have to be generated.'
});

options.addDeclaration({
name: Constants.RENDER_OPTION,
help: 'Specify from where to get the loclized json data.'
});

options.addDeclaration({
name: Constants.INCLUDE_TAGS_OPTION,
help: 'Specify whether to include tags per comment.',
type: ParameterType.Boolean,
defaultValue: false
});

options.addDeclaration({
name: Constants.INCLUDE_PARAMS_OPTION,
help: 'Specify whether to include params per comment.',
type: ParameterType.Boolean,
defaultValue: false
});

options.addDeclaration({
name: Constants.INCLUDE_WARNS_OPTION,
help: 'Specify whether to throw warnings of missed tags and parameters into the json\'s.',
type: ParameterType.Boolean,
defaultValue: false
});

options.addDeclaration({
name: Constants.LOCALIZE_OPTION,
help: 'Specify your localization for instance (jp)'
});

options.addDeclaration({
name: Constants.TEMPLATE_STRINGS_OPTION,
help: 'Path to the json file which contains your localized template strings'
});

options.addDeclaration({
name: Constants.INCLUDE_VERSIONS_OPTION,
help: 'Specify whether to include versions dropdown into the header.',
type: ParameterType.Boolean,
defaultValue: false
});

options.addDeclaration({
name: Constants.PRODUCT_OPTION,
help: 'Specify product name.'
});
}
Loading