{"id":28386456,"url":"https://github.com/igniteui/typedoc-plugin-localization","last_synced_at":"2025-07-29T15:11:19.465Z","repository":{"id":33129791,"uuid":"144993749","full_name":"IgniteUI/typedoc-plugin-localization","owner":"IgniteUI","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-06T13:53:12.000Z","size":173,"stargazers_count":21,"open_issues_count":4,"forks_count":11,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-06-20T12:11:35.889Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IgniteUI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-08-16T13:46:33.000Z","updated_at":"2025-01-06T09:29:02.000Z","dependencies_parsed_at":"2024-01-10T09:40:13.531Z","dependency_job_id":"ca20fddc-ca90-48d8-a170-6bd80ac1ee81","html_url":"https://github.com/IgniteUI/typedoc-plugin-localization","commit_stats":{"total_commits":96,"total_committers":11,"mean_commits":8.727272727272727,"dds":0.25,"last_synced_commit":"4e8487f913cb87c4729c1e5fdbacad4841beb4f2"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/IgniteUI/typedoc-plugin-localization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IgniteUI%2Ftypedoc-plugin-localization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IgniteUI%2Ftypedoc-plugin-localization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IgniteUI%2Ftypedoc-plugin-localization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IgniteUI%2Ftypedoc-plugin-localization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IgniteUI","download_url":"https://codeload.github.com/IgniteUI/typedoc-plugin-localization/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IgniteUI%2Ftypedoc-plugin-localization/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262094416,"owners_count":23257960,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-30T14:43:05.377Z","updated_at":"2025-07-29T15:11:19.454Z","avatar_url":"https://github.com/IgniteUI.png","language":"TypeScript","readme":"## typedoc-plugin-localization\n[![Build Status](https://travis-ci.org/IgniteUI/typedoc-plugin-localization.svg?branch=master)](https://travis-ci.org/IgniteUI/typedoc-plugin-localization)\n[![npm version](https://badge.fury.io/js/typedoc-plugin-localization.svg)](https://badge.fury.io/js/typedoc-plugin-localization)\n\n## Inspired and used by [Ignite UI for Angular](https://github.com/IgniteUI/igniteui-angular)\n\n### Plugin\n\nA plugin for [Typedoc](http://typedoc.org)\n\nWhen using [Typedoc](http://typedoc.org) for API docs generation you may want to generate documentation with different languages.\n\nBy using this plugin you will be able to:\n 1. Merge all code comments(classes, methods, properties, enumerations etc.) that needs localization in a couple of json files.\n 2. Translate them.\n 3. Use the updated files to build a documentation for an entire project in the desired language.\n\n### Installing\n\n```\nnpm install typedoc-plugin-localization --save-dev\n```\n\n### Usage\n\n#### Important notes\n\u003e Please take in mind that you are running your local npm packages by `npx` right before the command execution.\n\u003e \u003cbr /\u003e\n\u003e The alternative would be to install the plugin globally with `-g` at the end of the command.\n\u003e \u003cbr /\u003e\n\u003e Then you won't need to use `npx`.\n\n\u003e The plugin works with [typedoc](https://github.com/TypeStrong/typedoc) version@0.13.0 and above.\n\n#### Arguments\n* `--generate-json \u003cpath/to/jsons/directory/\u003e`\u003cbr\u003e\n  Specifies the location where the JSON's should be written to.\n* `--generate-from-json \u003cpath/to/generated/jsons\u003e`\u003cbr\u003e\n  Specifies from where to get the loclized JSON's data.\n* `--templateStrings \u003cpath/to/template-strings/json\u003e`\u003cbr\u003e\n  Specifies the path to the JSON file which would contains your localized hardcoded template strings. Additional information could be found [here](#additional-information)\n* `--localize \u003clocalizaiton key\u003e`\u003cbr\u003e\n  Specifies your localization key which would match the translations section in your templateStrings file. Additional information could be found [here](#additional-information)\n* `--tags`\u003cbr\u003e\n  Include all commented tags into json exports. For instance /* @memberof Class */\n* `--params`\u003cbr\u003e\n  Include all commented parameters into json exports. For instace /* @param option Options describing your settings.  */\n\n\n#### Path variable descriptions\n`\u003cmain-proj-dir\u003e` - This file has to contain the file structure of the project.\n    \u003cbr /\u003e\n`\u003cjson-exports-dir\u003e` - This file would contains all generated json files with retrieved comments.\n    \u003cbr /\u003e\n`\u003cout-typedoc-dir\u003e` - The directory where the documentation have to be generated\n\n#### Step 1\nIn order to generate the json representation of each module of your application you will have to execute the command below: \n```\nnpx typedoc `\u003cmain-proj-dir\u003e` --generate-json `\u003cjson-export-dir\u003e`\n```\n\nWe can use [Ignite UI for Angular](https://github.com/IgniteUI/igniteui-angular) repository for Example:\n\n```\nnpx typedoc projects\\igniteui-angular\\src\\ --generate-json exports\n```\n\nFolder `exports` will be automatically created\n\n\u003e This command will create `exports` folder.\n\u003e \u003cbr /\u003e\n\u003e`projects\\igniteui-angular\\src\\` This directory contains the file structure of the project.\n\u003e \u003cbr /\u003e\n\u003e For instance when you have a `/directory/inner-dir1/inner-dir2/file.ts` it will create the following structure `exports/directory/inner-dir1/inner-dir2/` which will contains all files that are under it.\n\n\n#### Step 2\n\nAfter the export of the JSON files finished, you should modify the comments in the desired language.\n\n```JSON\n{\n    \"IgxGridComponent\": {\n        \"comment\": {\n            \"text\": [\n                \"The Ignite UI Grid is used for presenting and manipulating tabular data in the simplest way possible.  Once data\",\n                \"has been bound, it can be manipulated through filtering, sorting \u0026 editing operations.\",\n                \"\",\n                \"Example:\",\n                \"```html\",\n                \"\u003cigx-grid [data]=\\\"employeeData\\\" autoGenerate=\\\"false\\\"\u003e\",\n                \"  \u003cigx-column field=\\\"first\\\" header=\\\"First Name\\\"\u003e\u003c/igx-column\u003e\",\n                \"  \u003cigx-column field=\\\"last\\\" header=\\\"Last Name\\\"\u003e\u003c/igx-column\u003e\",\n                \"  \u003cigx-column field=\\\"role\\\" header=\\\"Role\\\"\u003e\u003c/igx-column\u003e\",\n                \"\u003c/igx-grid\u003e\",\n                \"```\",\n                \"\"\n            ],\n            \"shortText\": [\n                \"**Ignite UI for Angular Grid** -\",\n                \"[Documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/grid.html)\"\n            ]\n        },\n        \"properties\": {\n            \"data\": {\n                \"comment\": {\n                    \"shortText\": [\n                        \"An @Input property that lets you fill the `IgxGridComponent` with an array of data.\",\n                        \"```html\",\n                        \"\u003cigx-grid [data]=\\\"Data\\\" [autoGenerate]=\\\"true\\\"\u003e\u003c/igx-grid\u003e\",\n                        \"```\"\n                    ]\n                }\n            },\n        ....\n        },\n        \"methods\": {\n            \"findNext\": {\n                \"comment\": {\n                    \"parameters\": {\n                        \"text\": {\n                            \"comment\": {\n                                \"text\": \"the string to search.\"\n                            }\n                        },\n                        \"caseSensitive\": {\n                            \"comment\": {\n                                \"text\": \"optionally, if the search should be case sensitive (defaults to false).\"\n                            }\n                        },\n                        \"exactMatch\": {\n                            \"comment\": {\n                                \"text\": \"optionally, if the text should match the entire value  (defaults to false).\"\n                            }\n                        }\n                    },\n                    \"tags\": {\n                        \"memberof\": {\n                            \"comment\": {\n                                \"text\": \"IgxGridBaseComponent\",\n                                \"tagName\": \"memberof\"\n                            }\n                        }\n                    },\n                    \"shortText\": [\n                        \"Finds the next occurrence of a given string in the grid and scrolls to the cell if it isn't visible.\",\n                        \"Returns how many times the grid contains the string.\",\n                        \"```typescript\",\n                        \"this.grid.findNext(\\\"financial\\\");\",\n                        \"```\"\n                    ]\n                }\n            }\n        ....\n        }\n    ....\n```\n\nThe structure of every file has the following representation:\n```JSON\n{\n    \"className\": {\n        \"properties\": {},\n        \"methods\": {},\n        \"accessors\": {}\n    }\n}\n```\n\n\u003e If a current file does not contain any comments that have to be exported from the TypeDoc, it won't exists into the section with json files.\n\n\u003e Every directory that would represents all generated JSON's would contains a file `globalFunctions.json`. There you could find all exported global functions witin your application. Please take in mind that if such a funcion doesn't contain any sort of comment it won't be exported!\n\n#### Step 3\n\nWhen you finish with the translations you will have to generate the documentation with the transleted files `(json's)`.\n\u003cbr /\u003e\nSo the following command have to be executed:\n```\nnpx typedoc `\u003cmain-proj-dir\u003e` --generate-from-json `\u003cjson-exports-dir\u003e` --out `\u003cout-typedoc-dir\u003e`\n```\n\nExample:\n```\nnpx typedoc .\\projects\\igniteui-angular\\src\\ --generate-from-json .\\exports\\ --out localized\n```\n\nFolder `localized` will be automatically created.\n\n\n#### Additional Information\n\nFor your convenience we have exposed a way to localize your hardcoded template strings. How? \u003c/br\u003e\nWe have registered a helper function within our plugin which brings you the ability to achieve this. How to use it? \u003c/br\u003e\nLet's take an example of a `partial view`.\n\n```html\n        \u003cul\u003e\n            {{#each sources}}\n                {{#if url}}\n                    \u003cli\u003e\u003cspan\u003eDefined in\u003c/span\u003e \u003ca href=\"{{url}}\"\u003e{{fileName}}:{{line}}\u003c/a\u003e\u003c/li\u003e\n                {{else}}\n                    \u003cli\u003e\u003cspan\u003eDefined in\u003c/span\u003e {{fileName}}:{{line}}\u003c/li\u003e\n                {{/if}}\n            {{/each}}\n        \u003c/ul\u003e\n```\nHere we would like to translate \"Defined in\" hardcoded string. \u003c/br\u003e\n\n1. Create a file somewhere in your app which would contains all your definitions of hordcoded strings you would like to translate. \u003c/br\u003e\n    The structure of the file should be like this:\n    ```json\n    {\n        localize-key: {\n            \"string\": \"translation\"\n        }\n    }\n    ```\n    \u003e The localization key is your responsibility. You can name it however you like. \u003c/br\u003e\n\n    In our case\n    ```json\n    {\n        jp: {\n            \"Defined in\": \"定義：\"\n        }\n    }\n    ```\n\n2. Update your `partial view` with the helper `localize` function.\n    ```html\n        \u003cul\u003e\n            {{#each sources}}\n                {{#if url}}\n                    \u003cli\u003e\u003cspan\u003e{{#localize}}Defined in{{/localize}}\u003c/span\u003e \u003ca href=\"{{url}}\"\u003e{{fileName}}:{{line}}\u003c/a\u003e\u003c/li\u003e\n                {{else}}\n                    \u003cli\u003e\u003cspan\u003e{{#localize}}Defined in{{/localize}}\u003c/span\u003e {{fileName}}:{{line}}\u003c/li\u003e\n                {{/if}}\n            {{/each}}\n        \u003c/ul\u003e\n    ```\n\n3. Execute the translation command which would contain the `localization key` and the `path` to the `template strings` file. \u003c/br\u003e\n    For instance:\n    ```\n    npx typedoc `\u003cmain-proj-dir\u003e` --localize `\u003clocalization-key\u003e` --templateStrings \u003cpath/to/the/file\u003e`\n    ```\n    In case of [igniteui-angular](https://github.com/IgniteUI/igniteui-angular) it would be:\n    ```\n    npx typedoc projects\\igniteui-angular\\src\\ --localize jp --templateStrings ./extras/template/strings/shell-strings.json\n    ```\n    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).\n\n#### Link and Debug\nIn order to run the plugin locally, after it is build, it should be linked to the repo you want to use it.\n\n1. Execute the following commands\n\n```\nnpm run build\n```\n\n```\nnpm pack\n```\n\n```\ncp typedoc-plugin-localization-1.0.4.tgz ~\n```\n\n2. Go to the theme repository where the plugin is included as peer dependency and add the reference to the packed file.\nExample:\n\n```\n  \"peerDependecies\": {\n    \"typedoc-plugin-localization\": \"file:../../../typedoc-plugin-localization-1.0.4.tgz\",\n  }\n```\n\n3. Go to the repository which is using the theme and plugin.\n\n```\nnpm install ~/typedoc-plugin-localization-1.0.4.tgz\n```\n\n4. Add launch.json configuration to enable debbuging\n\nExample:\n```\n{\n    \"configurations\": [\n        {\n            \"name\": \"Typedoc plugin\",\n            \"type\": \"node\",\n            \"request\": \"launch\",\n            \"program\": \"${workspaceFolder}/node_modules/typedoc/bin/typedoc\",\n            \"args\": [\n                \"${workspaceFolder}/projects/igniteui-angular/src/public_api.ts\",\n                \"--generate-json\",\n                \"${workspaceFolder}/dist\",\n                \"--localize\",\n                \"en\",\n                \"--versioning\",\n                \"--product\",\n                \"ignite-ui-angular\",\n                \"--tsconfig\",\n                \"${workspaceFolder}/tsconfig.json\"\n            ],\n            \"sourceMaps\": true,\n            \"resolveSourceMapLocations\": [\n                \"${workspaceFolder}/**\",\n                \"!**/node_modules/**\"\n            ]\n        }\n    ]\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figniteui%2Ftypedoc-plugin-localization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figniteui%2Ftypedoc-plugin-localization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figniteui%2Ftypedoc-plugin-localization/lists"}