# Contributing to Selected Line Tools [日本語](CONTRIBUTING.ja.md) Thank you for your interest. Bug reports, ideas, translations and pull requests are welcome. ## Before you start - For bugs and requests, please open an [issue](https://github.com/akiratamcat/joplin-plugin-selected-line-tools/issues) first. English or Japanese is fine. - For security problems, do not open a public issue. See [SECURITY.md](SECURITY.md). - The documents in `docs/` are written only in Japanese. [docs/README.md](docs/README.md) is the index: - `docs/01_requirements/`: the requirements, their review, and the open issues with the decisions made. - `docs/02_design/`: the design. - `docs/03_test/`: the manual test checklist for checks inside Joplin. - `docs/research/`: investigations of the Joplin plugin API. ## Build and test Requirements: Node.js 18 or later and npm. ```sh npm install npm test # checks README.md, then runs the unit tests (Jest) npm run dist # builds the plugin archive (.jpl) into publish/ ``` Install `publish/io.github.akiratamcat.selected-line-tools.jpl` with "Install from file" on Joplin's plugin screen. See [GENERATOR_DOC.md](GENERATOR_DOC.md) for details on the build tooling. The unit tests cover the code that does not depend on the Joplin API or CodeMirror. How the commands behave inside Joplin (menus, undo, settings, languages) is tested by hand with [docs/03_test/manual-test-checklist.md](docs/03_test/manual-test-checklist.md). ## Source layout | Path | Contents | | --- | --- | | `src/core/` | Target lines from the selection, comparison, whitespace, character widths, join and wrap, and the line operations (no Joplin or CodeMirror code). `eastAsianWide.ts` is generated from Unicode data | | `src/contentScripts/` | CodeMirror 6 content script: applies an operation to the editor as one transaction | | `src/index.ts`, `src/commands.ts`, `src/settings.ts` | Plugin entry point, commands and menus, settings | | `src/i18n/` | gettext lookup (`index.ts`), locale choice (`locale.ts`) and the compiled catalogs | | `locales/` | Translations (`.po`) and the template (`.pot`) | | `tests/` | Unit tests | | `scripts/` | `readme.mjs` (builds the Japanese half of README.md), `compile-po.js` (translations), `generate-east-asian-width.js` (builds `src/core/eastAsianWide.ts` from Unicode's `EastAsianWidth.txt`; run it only when moving to a new Unicode version, and update THIRD_PARTY_NOTICES) | ## Documents in two languages User-facing documents have an English and a Japanese version with the same content: `README.md` / `README.ja.md`, `CHANGELOG.md` / `CHANGELOG.ja.md`, `CONTRIBUTING.md` / `CONTRIBUTING.ja.md`, `SECURITY.md` / `SECURITY.ja.md`, `THIRD_PARTY_NOTICES.md` / `THIRD_PARTY_NOTICES.ja.md`. The Japanese half of `README.md` is generated from `README.ja.md`: edit `README.ja.md`, then run `npm run readme`. `npm test` fails when `README.md` is out of date. ## Translations The user interface is translated with gettext. The English texts are in the source (`_('...')` in `src/index.ts` and `src/settings.ts`, and the labels in `src/commands.ts`), and the translations are in `locales/.po`, compiled into `src/i18n/generated/catalogs.ts` at build time (not committed). - `npm run i18n:compile`: builds the catalogs (run by `npm test` and `npm run dist`). It fails when a `.po` file has an entry that is not in `locales/selected-line-tools.pot`. - `npm test` also fails when a text in the source is missing from the template, when the template has unused entries, or when a `.po` file does not translate every entry. To fix or add a translation, edit the `.po` file with any PO editor or a text editor. Untranslated texts are shown in English. When you change a text in the source, update `locales/selected-line-tools.pot` and every `.po` file. To add a language, add it to `SUPPORTED_LOCALES` in `src/i18n/locale.ts` and copy the template to `locales/.po`. ## Pull requests - Keep each pull request to one change, and describe what it changes and why. - Run `npm test` and `npm run dist` before opening it. - If the change is visible to users, add it to both `CHANGELOG.md` and `CHANGELOG.ja.md` under "Unreleased". - The plugin must change only the selected lines, through the editor, as one undo step. It must not change other parts of the note or make network requests.