Zum Inhalt

Development

How to build, check and test Paperless Sync, where the pictures and the look of the website come from, and how a change becomes a release. CONTRIBUTING.md has the rules for a change: its tests, the sign-off of every commit and the title of its pull request.

The way of a change into a release: A change on a branch passes bash scripts/check.sh and the end-to-end tests in Docker on the machine of its author. Its pull request, titled as a Conventional Commit, passes the required checks: the CI, the end-to-end tests against every supported Nextcloud version when the change can affect the app, CodeQL, the secret scan, the licenses of every file and the sign-off. A failed check sends it back to the branch. Once every check passes, it is squashed into main, and the release bot adds it to the pull request of the next release; merging that one publishes the signed package on GitHub and in the Nextcloud App Store. Your steps are orange, the checks and the bots blue, and the release green.The way of a change into a release: A change on a branch passes bash scripts/check.sh and the end-to-end tests in Docker on the machine of its author. Its pull request, titled as a Conventional Commit, passes the required checks: the CI, the end-to-end tests against every supported Nextcloud version when the change can affect the app, CodeQL, the secret scan, the licenses of every file and the sign-off. A failed check sends it back to the branch. Once every check passes, it is squashed into main, and the release bot adds it to the pull request of the next release; merging that one publishes the signed package on GitHub and in the Nextcloud App Store. Your steps are orange, the checks and the bots blue, and the release green.

Set-up

You need PHP 8.3+ for the tools (the app itself runs on the PHP that appinfo/info.xml names), Composer, Node.js and Docker; the dev container in .devcontainer/ has them ready, for VS Code and for GitHub Codespaces.

composer install
bash scripts/check.sh
bash tests/e2e/run.sh

scripts/check.sh runs the checks of the CI: Composer, appinfo/info.xml against the schema of the App Store, PHP syntax, the coding standard, Psalm, PHPUnit, the package that krankerl builds, which scripts/check-package.sh compares file by file with the runtime files of the commit (what the package holds), and the checks of this app alone in scripts/check-project.sh: the version of Playwright in the end-to-end tests, the rules of tests/e2e/affected.sh, the pipes of the shell scripts, none of which may hand a download to a program, such as curl … | bash, which Scorecard would report on main as a download that runs without a pinned hash, the icon of the website, the tests of its hook, the versions in the README, the outline of the German pages, the same description of the app on GitHub, on the website and in composer.json, an area label for every file of the app and of its unit tests, an explanation for the PR coach of every check of this app, the tests of scripts/check-package.sh, the JavaScript with the rules of ESLint, and the translations. When a check fails, it says what it found and how to fix it, here and on the pull request; a new check of this app comes with its explanation in .github/checks.project.toml, with the commands that fix what it finds or the reason why none can, and tests/coach/test_checks_project.py fails without one.

Tests

Unit tests cover path generation, state transitions, export, metadata moves, exclusions, trash handling, guarded deletion, with permanent deletion off and without direct deletion too, incomplete scans of Paperless, the batch size with failing writes, inbox success and failure, dry-run behavior, and release version management. The plans of the export and the inbox have tables of their own, one line for each action, and the tests of the executors and of the synchronization run each kind of change as a dry-run and as a run and compare the two reports (Architecture). scripts/check.sh fails when a line of lib/ runs in no test. The doubles of the tests are strict and Nextcloud's clock stands still in them, and mutation tests check every week that the tests notice a change of the code; Architecture shows how, with the score and the way to run them on your computer.

tests/package/test_check_package.sh tests the check of the release package in a throwaway repository, in a few seconds and without krankerl: the package of a small app passes, packed as krankerl packs it and again as the release workflow packs it after signing, and every package that lacks a runtime file, holds a stray, changed or linked one, or the wrong signature fails with the difference. scripts/check-project.sh runs it.

The Docker end-to-end suite mounts this checkout into real Nextcloud containers and uses a deterministic Paperless API mock. It configures the app, runs dry-runs, exports, moves, the trash and its restore, conflicts, documents that vanish, guarded deletion and the inbox, and starts the background job as system cron would. At its end, Chromium checks the settings, the actions of the app in Files and the form of its rule in Flow with axe-core against WCAG 2.1 AA, in the light and the dark theme, at 1280 and at 320 pixels, where the settings must fit without scrolling sideways, and walks the settings with the keyboard alone: every control in the order of the page, with a focus that shows and that the bar of the buttons never covers. On the newest version, the checks in the browser also measure how much of the JavaScript of the app they run, and the last one opens the settings in every language of the app, as a new installation in French first and then as an administrator of each other language: a catalog that Nextcloud doesn't find or read, or that lacks a text or a form of a plural that the page shows, fails the run. run-all.sh runs it against the current release of every Nextcloud version from min-version to max-version in appinfo/info.xml, side by side, and the newest of them also on PostgreSQL, and on MariaDB with S3 object storage, and the upgrade of an installation in use from the last release to the package of the commit on PostgreSQL and MariaDB; run.sh runs it against one version, on SQLite by default:

bash tests/e2e/run-all.sh
bash tests/e2e/run.sh
E2E_DATABASE=mysql E2E_OBJECTSTORE=s3 bash tests/e2e/run.sh
E2E_DATABASE=pgsql E2E_UPGRADE=1 bash tests/e2e/run.sh
E2E_ONLY=files bash tests/e2e/run.sh  # one scenario alone, with what it needs

The upgrade installs the signed package of the last release, uses it until its tables hold rows, replaces it with the package of the commit and runs occ upgrade: the only run in which the migrations meet the rows of an installation in use. It takes the commit, not the working tree, so commit a change of a migration before you run it (the end-to-end tests, The upgrade from the last release, and decision 0028).

CI runs run-all.sh on every push to main, every night, and in every pull request that can affect the app, in two required checks that share the runs: nextcloud the oldest and the newest version, the other PostgreSQL, MariaDB, S3 and the upgrade, and each version between goes to the one with the lighter load, where a version, with its browser checks, counts as five, a variant as three and an upgrade as two. A pull request that changes only the documentation, other workflows or the version of a release passes both at once. One runs PostgreSQL, MariaDB and S3 only when it changes the migrations, the state, the files in Nextcloud, the uploads to Paperless or the tests, and the upgrade from the last release only for a change of the migrations, the stored settings and state, the package or the tests. The suite needs Docker 25 or newer and Python 3.11 or newer. The contract tests start a real Paperless-ngx instead of the mock, the last release of 2.x or the current release of 3.x, check every answer that the app reads, run the app against it, and record the answers as the fixtures of the unit tests in tests/fixtures/; CI runs them every Monday and in every pull request that changes how the app talks to Paperless, which merges only once both lines pass (the required check contract tests, decision 0595):

bash tests/e2e/run-contract.sh 3
CONTRACT_RECORD=1 bash tests/e2e/run-contract.sh 2

The second command records the answers of Paperless as the fixtures of the unit tests, the same bytes for one image of Paperless. You rarely need it: when the app passes against the new answers in a pull request from a branch of this repository, such as the update of the image by Renovate, a bot commits the fixtures that differ.

The demo that the README offers has a smoke test of its own: it starts demo/compose.yaml with real containers and fails unless the archive has every seeded document and the generated password signs in. CI runs it every Monday and in every pull request that changes the demo.

bash tests/e2e/demo.sh
bash tests/e2e/demo.sh --local

A job of the end-to-end tests that fails names the first error of each run that failed, with the last step that passed, in its summary, and keeps the evidence for 14 days as its artifact: the log of the run, the log of Nextcloud, its apps, the logs of the containers and, of a check in the browser that failed, its Playwright trace and screenshots, which npx playwright show-trace opens. E2E_ARTIFACTS=build/e2e-evidence bash tests/e2e/run-all.sh keeps the same on your machine, as When a run fails in tests/e2e/README.md describes.

See tests/e2e/README.md for details and tests/e2e/MANUAL_ACCEPTANCE_TESTS.md for the release matrix.

Pictures

The pictures of the documentation and of the App Store come from the same Docker setup, with a synthetic household archive, once with Nextcloud in English, for docs/images/ and screenshots/, and once in German, for docs/images/de/, which the German pages show; take them anew after a change of the interface:

bash tests/e2e/screenshots.sh        # English and German
bash tests/e2e/screenshots.sh de     # German only

You rarely need to: two runs draw the same pixels, since the pictures show a frozen story, with the moments of its runs, an example secret of the webhook and fixed data instead of the clock, and bots keep them current. A pull request that changes the app or the story, any file of .github/screenshots-paths.txt, gets the Visual check: it renders the pictures of both languages side by side and comments with every picture that looks different and the share of its changed pixels, and its artifact holds each one before and after, and of each one that kept its size and frames, PNG and GIF alike, the comparison: the place of the change before and after in one picture, in its own colors, with a red frame around each change, of the frame with the most changes of an animation, which the comment names. The artifact also has its changed pixels in red. It only reports. After the merge, after every release and every week, the screenshot bot renders the pictures of main with scripts/screenshots.sh, and when pixels changed, it opens docs: update the screenshots, which merges itself once every check passes. The section The screenshot bot and the visual check of tests/e2e/README.md has the details.

How the pictures stay current: A pull request that changes the app or the story of the pictures, the files of .github/screenshots-paths.txt, gets the visual check: it renders the English and the German pictures from the Paperless mock with its frozen story, side by side, keeps each picture whose pixels stayed the same, and comments on the pull request with the pictures that look different and the share of their changed pixels; the artifact holds each one before and after, with its changed pixels in red. It only reports. Once the pull request is merged, and after every release and every week, the screenshot bot renders the pictures of main the same way; when pixels changed, it opens the pull request docs update the screenshots from the branch bot/screenshots as the release app, which merges itself once every check passes. Your steps are orange, the checks and the bots blue, and the pictures green.How the pictures stay current: A pull request that changes the app or the story of the pictures, the files of .github/screenshots-paths.txt, gets the visual check: it renders the English and the German pictures from the Paperless mock with its frozen story, side by side, keeps each picture whose pixels stayed the same, and comments on the pull request with the pictures that look different and the share of their changed pixels; the artifact holds each one before and after, with its changed pixels in red. It only reports. Once the pull request is merged, and after every release and every week, the screenshot bot renders the pictures of main the same way; when pixels changed, it opens the pull request docs update the screenshots from the branch bot/screenshots as the release app, which merges itself once every check passes. Your steps are orange, the checks and the bots blue, and the pictures green.

The README and the website

The first screen of the README shows the version in the App Store and the versions of Nextcloud in badges that read appinfo/info.xml on main, so that they follow every release and every raise of max-version by the upstream bot without an edit. scripts/check-project.sh fails when one of them reads anything else, and when a version in the text of the README, of the home page or of the comparison, such as <span data-app="nextcloud">33–35</span>, names another lowest version or more than appinfo/info.xml; text that still names a lower max-version after the upstream bot raised it only gets a note, so that the pull request of the bot passes on its own.

The website takes its look from the app. The icon of the app is its logo, its favicon and the logo of its preview cards, from a copy in docs/images/app.svg that scripts/check-project.sh keeps equal to img/app.svg. Nextcloud itself shows img/app-dark.svg instead, the same picture as one dark shape: in the sections of the administration settings, the list of apps, the activity and its filter and the notifications, where it sits beside the black icons of Nextcloud and turns white on the active entry and in the dark theme. tests/Unit/AppInfo/IconsTest.php fails when that icon paints in more than one color, or when the code hands Nextcloud the colored img/app.svg. The operation of Flow has the white img/flow.svg, which Nextcloud draws on a colored circle and turns dark itself. docs/stylesheets/brand.css holds the colors of the icon, in shades that pass WCAG AA in the light and the dark palette. A link to the home page shows the social preview of the repository, .github/social-preview.png, which bash scripts/social-preview.sh renders from .github/social-preview.html. The versions of Nextcloud and PHP on the website come from appinfo/info.xml through the hook .github/mkdocs_project.py, which writes them into the fields such as <span data-app="php">8.2+</span> of every page, those of the requirements that the guide takes from the README included; GitHub shows the text of the fields as written:

Where the website of Paperless Sync takes its look from: The icon of the app, img/app.svg, is copied to docs/images/app.svg, which scripts/check-project.sh compares with it; the website shows the copy as its logo, its favicon and on the preview cards of its pages. The social preview of the repository, rendered from .github/social-preview.html, is the preview card of the home page. The colors come from docs/stylesheets/brand.css, and the hook .github/mkdocs_project.py writes the versions of appinfo/info.xml into the pages. The files of the repository are green, the parts of the website blue.Where the website of Paperless Sync takes its look from: The icon of the app, img/app.svg, is copied to docs/images/app.svg, which scripts/check-project.sh compares with it; the website shows the copy as its logo, its favicon and on the preview cards of its pages. The social preview of the repository, rendered from .github/social-preview.html, is the preview card of the home page. The colors come from docs/stylesheets/brand.css, and the hook .github/mkdocs_project.py writes the versions of appinfo/info.xml into the pages. The files of the repository are green, the parts of the website blue.

The same hook shows an alert of GitHub, a quote that begins with [!NOTE], [!TIP], [!IMPORTANT], [!WARNING] or [!CAUTION], as an admonition of the website. So a page, or a part of the README that the website takes by a snippet, writes an alert once for both, such as the warning about edits of the archive in the conflict policy.

The App Store links the documentation that <documentation> in appinfo/info.xml names: Using the archive for the people who use the archive, and the guide for administrators. The App Store takes them from the release, so after the build scripts/check-site.sh, which the check docs runs with the folder of the website, fails when an address of the website in info.xml leads to no page, or to no element with the id of its anchor; run it yourself with bash scripts/check-site.sh site after mkdocs build.

In English and German

The README and the pages that administrators and the people who use the archive read first have a German twin: README.de.md, and docs/index.de.md, docs/guide.de.md, docs/use.de.md, docs/faq.de.md, docs/troubleshooting.de.md and docs/alternatives.de.md next to their English pages. A language switch leads between the READMEs, and on the website, which MkDocs builds in English and, with the plugin i18n of mkdocs.yml, in German in de/, the switch in the header keeps the page; a page without a German twin shows in English there. The German guide takes its snippets from README.de.md, as the English one from README.md, and a German page shows the German diagrams, docs/diagrams/NAME.de.mmd for NAME.mmd, in the words of the settings page in German, from l10n/de.json.

How the German documentation stays in step: README.md and README.de.md link to each other. The English pages of the website, such as guide.md, take their snippets from README.md, and the German ones, such as guide.de.md, from README.de.md; an English page shows the diagram NAME.mmd, its German twin NAME.de.mmd. scripts/check-project.sh compares the outline of each German page with that of its English twin. MkDocs builds the English website and, with the plugin i18n, the German one in de/, with a language switch in the header. The English sources are blue, the German ones orange, the check and the website green.How the German documentation stays in step: README.md and README.de.md link to each other. The English pages of the website, such as guide.md, take their snippets from README.md, and the German ones, such as guide.de.md, from README.de.md; an English page shows the diagram NAME.mmd, its German twin NAME.de.mmd. scripts/check-project.sh compares the outline of each German page with that of its English twin. MkDocs builds the English website and, with the plugin i18n, the German one in de/, with a language switch in the header. The English sources are blue, the German ones orange, the check and the website green.

So a change of an English page changes its German twin in the same pull request. scripts/check-project.sh fails when the two part: it compares their outlines, the headings with their levels, the snippet markers and includes, and the diagrams, in order, and names the first entry where they part, with the line in both files. Run it alone with bash scripts/check-project.sh. The hook .github/mkdocs_project.py titles an alert of a German page in German, such as Warnung, and leads the path of a picture of HTML, such as a screenshot, to its file from the German pages in de/ and from the snippets of the README alike. An English page that links to a heading of a German twin, such as guide.md#requirements, finds it on the German website through an anchor above the German heading, <a id="requirements"></a>, and mkdocs build --strict names one that is missing. The same anchors let the Help links of the settings and the links of the setup checks open the German guide for an administrator whose Nextcloud speaks German (AppConstants::guide): each part that the app links to has its English anchor above its German heading, such as <a id="being-notified"></a>, which tests/Unit/Settings/AdminSettingsTest.php checks. The German pages and README.de.md show the screenshots of the German interface, from docs/images/de/, which bash tests/e2e/screenshots.sh de takes, and the English pages those of the English interface.

The roadmap says what is planned for the next twelve months and what is done. When an issue that its section The next twelve months links is closed, scripts/check-project.sh fails and asks to move what shipped to Done, with its link into the guide: it asks GitHub through gh, where gh is signed in, as on your machine, whose hook runs the checks before every push. The CI gives the checks no token, so there, and without gh or a network, it names the issues that it couldn't ask about and passes.

Code

The app ID is paperless_sync and the PHP namespace is OCA\PaperlessSync. Psalm analyzes the PHP code, ESLint and CodeQL the JavaScript, and the SBOM workflow continuously inventories dependencies. The architecture describes the parts of the app, and the decisions why it works as it does.

JavaScript

The scripts of the app, js/settings.js, js/files.js and js/flow.js, have no build (decision 0023): Nextcloud serves them as they are written, as classic scripts beside its globals OC, OCA, t and n. So nothing compiles them, and they have no unit tests of their own; two checks stand in for both.

How the JavaScript of the app is checked: The scripts of the app, js/settings.js, js/files.js and js/flow.js, run in the browser as they are written, without a build. scripts/check.sh runs ESLint on them, and on the tests and scripts, with the rules of scripts/eslint/eslint.config.mjs. A finding fails the check with its file, line and rule; the fix bot runs bash scripts/eslint.sh --fix, which turns a var and a let that never changes into a const, and a person fixes the rest. On the newest Nextcloud, the checks in the browser record in Chromium which parts of the scripts each page runs. coverage.mjs merges the coverage of every page and shows the share of the lines, branches and functions of each script in the summary of the job, with the lines that no check runs, and keeps lcov.info in the artifact e2e-coverage. A script that runs a smaller share of its lines or branches than its floor in tests/e2e/coverage-floor.json fails the check, and a new test in the browser raises the floor. The scripts of the app are light blue, the checks and the bot blue, your steps orange, and a check that passes green.How the JavaScript of the app is checked: The scripts of the app, js/settings.js, js/files.js and js/flow.js, run in the browser as they are written, without a build. scripts/check.sh runs ESLint on them, and on the tests and scripts, with the rules of scripts/eslint/eslint.config.mjs. A finding fails the check with its file, line and rule; the fix bot runs bash scripts/eslint.sh --fix, which turns a var and a let that never changes into a const, and a person fixes the rest. On the newest Nextcloud, the checks in the browser record in Chromium which parts of the scripts each page runs. coverage.mjs merges the coverage of every page and shows the share of the lines, branches and functions of each script in the summary of the job, with the lines that no check runs, and keeps lcov.info in the artifact e2e-coverage. A script that runs a smaller share of its lines or branches than its floor in tests/e2e/coverage-floor.json fails the check, and a new test in the browser raises the floor. The scripts of the app are light blue, the checks and the bot blue, your steps orange, and a check that passes green.

ESLint checks the scripts of the app, the words of the catalogs l10n/*.js, the end-to-end tests and the scripts with the rules of scripts/eslint/eslint.config.mjs: the recommended rules of ESLint and five more against what a script without a build gets wrong quietly, eqeqeq (=== instead of ==, which converts its sides first), no-unused-vars, no-implicit-globals (a function or a var at the top of a script becomes a global of the page, which another script may overwrite), prefer-const and no-var. scripts/check-project.sh runs it in its step JavaScript and translations, so every pull request does, and a warning fails as well:

bash scripts/eslint.sh            # what the rules find
bash scripts/eslint.sh --fix      # and fix what a rule fixes by itself
bash scripts/eslint.sh js/flow.js # one file

scripts/eslint.sh installs the ESLint of scripts/eslint/package-lock.json with npm ci on its first run and after a change of the lock file, into scripts/eslint/node_modules/; Renovate updates ESLint, its rules and its globals together. They live in scripts/eslint/ rather than at the root of the repository, which krankerl would pack into the package of the app. overrides in scripts/eslint/package.json gives ESLint a newer minimatch than it asks for, because only minimatch 11.0.1 and newer are free of the advisory GHSA-g3hv-75wg-m249, which OSV-Scanner reports; scripts/eslint/minimatch.test.mjs holds the lock file to that version and shows that ESLint still matches its globs with it, until ESLint asks for a fixed minimatch itself and the override goes. When the check fails on a pull request, the fix bot runs bash scripts/eslint.sh --fix, which turns a var and a let that never changes into a const; the rest, such as a variable that nothing uses, needs you. Turn a rule off for a single line only, with the reason: // eslint-disable-next-line no-alert -- the reason. A comment that turns off a rule that no longer fires fails too, and scripts/check-project.sh first checks that ESLint finds each of the five in a seeded script.

The coverage in the browser shows which parts of the scripts the end-to-end tests run. On the newest Nextcloud, every page of every check in the browser records with V8 in Chromium which functions and blocks of the scripts of the app it runs, and tests/e2e/coverage.mjs shows the share of the lines, branches and functions of each script in the summary of the job, with the lines that no check runs. The artifact e2e-coverage holds lcov.info, which an editor or genhtml shows line by line. A script that runs a smaller share of its lines or branches than its floor in tests/e2e/coverage-floor.json fails the job. The floor is the share that the checks reached, less a point; when the checks pass it by more, the summary says so, and the pull request that adds a check in the browser raises it. A new script of js/ gets its floor in its pull request, 0 until the end-to-end tests have measured it. V8 counts a block as a branch only when it ran a different number of times than the block around it, so a way through a page that depends on timing, such as a late answer, would change the count from run to run: a check in the browser runs both ways of such a place on purpose. Coverage of the JavaScript in the end-to-end tests has the details and the command for your machine.

Translations

Paperless Sync speaks English, German, with du and with Sie, French, Spanish, Dutch, Simplified Chinese and Traditional Chinese. The settings page, its messages and the connection checklist follow the language that Nextcloud has for the administrator, the Activity stream that of the target user, and the times on the page the locale of the personal settings. The texts of each language are in l10n/<language>.json, which PHP reads, and in its copy l10n/<language>.js for the browser.

node scripts/check-l10n.mjs, which scripts/check-project.sh runs, compares every catalog with the code, so that no message stays English on a page in another language:

What the check of the translations finds: scripts/check-l10n.mjs reads the texts that the code translates, translate() and translatePlural() in js, ->t() and ->n() in templates and lib, and the texts that lib translates later, of a ConnectionCheck, an InvalidSettingException and the errors that a run keeps, with the constants that they name. It compares them with every catalog l10n/LANGUAGE.json. A text that a catalog lacks, a translation with other placeholders than its English one or with a lone percent sign, or a plural with other forms than the rule of its language fails the check with its place; it needs words. A text that no code translates, a text twice, or an l10n/LANGUAGE.js that differs from its l10n/LANGUAGE.json fails as well, and node scripts/check-l10n.mjs --fix drops the text and writes l10n/LANGUAGE.js anew. Otherwise the check passes.What the check of the translations finds: scripts/check-l10n.mjs reads the texts that the code translates, translate() and translatePlural() in js, ->t() and ->n() in templates and lib, and the texts that lib translates later, of a ConnectionCheck, an InvalidSettingException and the errors that a run keeps, with the constants that they name. It compares them with every catalog l10n/LANGUAGE.json. A text that a catalog lacks, a translation with other placeholders than its English one or with a lone percent sign, or a plural with other forms than the rule of its language fails the check with its place; it needs words. A text that no code translates, a text twice, or an l10n/LANGUAGE.js that differs from its l10n/LANGUAGE.json fails as well, and node scripts/check-l10n.mjs --fix drops the text and writes l10n/LANGUAGE.js anew. Otherwise the check passes.

  • A text that the code translates is the first argument of translate() and translatePlural() in js/, of $l->t() and $l->n() in templates/ and lib/, and a text that lib/ translates later, when it knows the language of the reader: the message and the hint of a ConnectionCheck, the text of an InvalidSettingException, and the text of an error that a run keeps, a RunError, a RunException or a FullStorageException. Write it as a string at that place, or as a class constant that the call names, such as self::STATUS_HINT, never as a variable: the check can't read it, so it fails with the file and the line, and --fix then changes nothing, instead of dropping the words of a text that looks unused.
  • A missing text fails with its file and line, and a translation whose placeholders differ from those of its English one, {name} in JavaScript, %s or %1$s in PHP, %n in a plural, fails with both texts: PHP stops at a placeholder without its value, and one that is missing loses it. So does a lone %, such as in 100 %, as PHP reads the text as a format.
  • A plural has as many forms as the pluralForm of its catalog names. Nextcloud picks a form in PHP by that rule, but in the browser by a table of its own: for French and Spanish, the rule has a form for millions in the middle, and the browser shows that one for every count but one, so the check asks for it to repeat the third form, as Nextcloud's own catalogs do. Chinese, Japanese and Korean have one form for every count, so a plural of l10n/zh_CN.json and l10n/zh_TW.json has one.
  • A label in quotes: a message that names a setting by its label, such as "Create missing tags", must hold the translation of that label.
  • Chinese writes a dash as two, ——, without spaces, never as one —, and Traditional Chinese takes the words of Taiwan: a word of Simplified Chinese in Traditional characters, such as 日誌 for a log or 用戶 for a user, fails with the word that the catalogs of Nextcloud for Taiwan write instead, 記錄檔 or 使用者. The check reads the catalogs and the Chinese texts of appinfo/info.xml; taiwanWords in scripts/check-l10n.mjs lists the words.
  • A variant of a language, such as l10n/de_DE.json, the formal German, names the folders and the fallbacks for metadata as its language does, here l10n/de.json: a Nextcloud in the variant proposed the names of its language before the variant had a catalog, so names of its own would move an archive that never stored them. The check takes the names from NAMES of lib/Service/ConfigService.php, fails with each name that differs, and --fix writes that of the language.
  • A language without its texts for the App Store fails: appinfo/info.xml needs a <summary lang="…"> and a <description lang="…"> for each catalog, with the code that the App Store has for the language: the language itself, such as fr for fr and es for es_419, or one of the few variants of its schema, such as zh-hans for zh_CN, zh-hant for zh_TW, pt-br for pt_BR and sr-latn for sr@latin. The check names the code that it misses.
  • A description with other sections or bullets than the English one fails in tests/Unit/AppInfo/DescriptionTest.php: each <description lang="…"> of appinfo/info.xml has the headings ### of the English <description>, in the same order, with as many bullets - below each, so that a new feature reaches the App Store in every language at once. The test names the language and the bullets of each section; translate a new bullet into every description, at its place.
  • A text that no code translates any more, a text twice and an l10n/<language>.js that differs fail as well; node scripts/check-l10n.mjs --fix removes them and writes each l10n/<language>.js from its l10n/<language>.json.

A new text is English in the code; add it with its words to every l10n/<language>.json, in the terms of the settings page, such as Basisordner for Base folder in German, and run node scripts/check-l10n.mjs --fix. If you don't speak a language, write the text as well as you can, with a translator if you need one: a native speaker can correct it later, and a missing one shows in English. A message about a setting names it by its label in quotes, and an InvalidSettingException names the setting as well, so that the page moves the focus there.

A run, also a scheduled one, has no reader when it writes its errors, so it keeps each in English, as the log, occ paperless_sync:status and the status API show it, together with its record: the English text with %s or %1$s for its values, the values and the setting that it names. The settings page translates the records when it reads the status, through StatusTranslation: in the status that it opens with (AdminSettings::getForm()), in that of SyncController::status() and in the answer of a dry-run. Write an error of a run as new RunError('Tags P%1$s: %2$s', [(string)$id, RunError::of($exception)]), never by joining strings: RunError::of() keeps the text of an exception that the app wrote, such as an InvalidSettingException, and takes the message of Paperless or of Nextcloud as it came, which no translation changes. A status of an earlier version, which kept the English text alone, shows as it is. The unit tests read the German of l10n/de.json through tests/Doubles/GermanTranslations.php, and fail on a text that it lacks.

Translate Paperless Sync

The app speaks English, German, with du and with Sie, French, Spanish, Dutch, Simplified Chinese and Traditional Chinese. The French, Spanish, Dutch and Chinese texts were drafted with the help of an AI, and so was the formal German, from the German of the maintainer; they wait for native speakers to read them: a word that sounds wrong is worth a note in the discussions or a pull request, and so is a language that the app doesn't speak yet. You need a text editor or the editor of GitHub, no PHP and no build.

How a translation reaches its readers: A translator corrects or adds a text in l10n/fr.json, the catalog of French, and the summary and the description in French in appinfo/info.xml. node scripts/check-l10n.mjs --fix writes l10n/fr.js, which the browser loads, from the catalog. The check of the translations then asks whether every text of the code has its translation, with its placeholders and the forms of its plurals, whether l10n/fr.js holds the same as l10n/fr.json, and whether appinfo/info.xml has a summary and a description in French. If not, its output names each problem and its fix. If so, the pull request is merged and released, and Nextcloud shows the settings, the notes in Files, the Activity stream and the notifications in French to every account set to French, a new French instance proposes the French folder names, and the App Store shows the summary and the description in French.How a translation reaches its readers: A translator corrects or adds a text in l10n/fr.json, the catalog of French, and the summary and the description in French in appinfo/info.xml. node scripts/check-l10n.mjs --fix writes l10n/fr.js, which the browser loads, from the catalog. The check of the translations then asks whether every text of the code has its translation, with its placeholders and the forms of its plurals, whether l10n/fr.js holds the same as l10n/fr.json, and whether appinfo/info.xml has a summary and a description in French. If not, its output names each problem and its fix. If so, the pull request is merged and released, and Nextcloud shows the settings, the notes in Files, the Activity stream and the notifications in French to every account set to French, a new French instance proposes the French folder names, and the App Store shows the summary and the description in French.

Language Catalog Addresses you with Written by
English the texts in the code you the maintainer
German l10n/de.json du the maintainer
German, formal l10n/de_DE.json Sie an AI, from the German of the maintainer, waiting for review
French l10n/fr.json vous an AI, waiting for review
Spanish l10n/es.json tú an AI, waiting for review
Dutch l10n/nl.json je an AI, waiting for review
Simplified Chinese l10n/zh_CN.json 您 an AI, waiting for review
Traditional Chinese, as written in Taiwan l10n/zh_TW.json 您 an AI, waiting for review

Each line of a catalog pairs a text of the code, in English, with its translation. Change only the right side: the code looks a translation up by the English text, character for character. Placeholders stay, such as %s, %1$s, %n and {document}, and the words around them may move; %1$s and %2$s may swap places.

  • The words of Nextcloud and of Paperless: a word that one of them shows as well takes its translation, such as the permission View of Documents in Paperless, which is Afficher in French, Ver in Spanish, 查看 in Simplified and 檢視 in Traditional Chinese, or Files of Nextcloud, which is Fichiers, Archivos, 文件 and 檔案. Simplified Chinese takes 往来方 for the correspondent of Paperless and 动态 for the Activity of Nextcloud, and Traditional Chinese the words of Taiwan, 關聯方 and 活動: write it in the words that Nextcloud and Paperless-ngx use there, not as Simplified Chinese in other characters, such as 檔案 for a file and 文件 for a document of Paperless. Each names its log and its administrator in its own words there: 記錄檔 for the log of Nextcloud or of a server, 事件記錄 for the logs of Paperless, 管理員 for an administrator of Nextcloud and 管理者 for an Admin of Paperless, never 日誌. The Traditional Chinese of Paperless Unified Search takes the same words, so that both apps read as one. Dutch writes labels for the tags, as Nextcloud and Paperless-ngx do in Dutch, Bekijken for the permission View and Bestanden for Files, and addresses the reader with je, as the catalogs of Nextcloud do. The catalogs of Nextcloud and those of Paperless-ngx have them.
  • The words of this app stay the same throughout:

    English French Spanish Dutch Simplified Chinese Traditional Chinese
    archive archive archivo archief 归档 封存
    file fichier fichero, as archivo is the archive bestand 文件 檔案
    inbox boîte de réception bandeja de entrada inbox 收件箱 收件匣
    to mirror refléter reflejar spiegelen 镜像 鏡像
    run exécution ejecución run 运行 執行
    dry-run simulation simulación proefrun 试运行 試執行
    scan analyse análisis scan 扫描 掃描
    target user utilisateur cible usuario de destino doelgebruiker 目标用户 目標使用者
    background job tâche de fond tarea en segundo plano achtergrondtaak 后台任务 背景作業
  • French typography: a no-break space before :, ;, ? and ! and inside « and », and the apostrophe ’.

  • Chinese typography: the full-width punctuation of Chinese, such as ,, 。, : and (), with the quotes “” in Simplified and 「」 in Traditional Chinese, as Nextcloud has them, the dash as two, ——, without spaces, such as 试运行——未做任何更改, and a space between a Chinese word and a word in Latin letters, a number or a placeholder, such as 发送到 Paperless and %n 个文档. Names, such as Paperless, Nextcloud, Webhook and cron, stay as they are.
  • What stays in English: the log, the command line and the lines of Copy report, for bug reports. The website and the pictures stay in English and German, so the Help links of the other languages open the English guide.
  • A regional variant: Nextcloud takes the catalog of the exact language of an account, so an account set to Español (México), es_MX, reads the app in English until it has a catalog of its own. The names of the folders fall back to those of es. The formal German of Deutsch (Förmlich: Sie), de_DE, which many organizations set as the default language, has a catalog of its own: the German of l10n/de.json with Sie in place of du, and with the same names of the folders. Change a German text in both catalogs. Traditional Chinese of Hong Kong, zh_HK, reads the app in English as well, also its folders, as the catalog of Traditional Chinese is that of Taiwan, zh_TW, and no catalog of zh exists.

Correct a translation

  1. Open the catalog in l10n/ on GitHub, such as fr.json, and edit it with the pencil, which makes a fork and a branch for you, or edit it in a clone. For the App Store, change <summary lang="fr"> or <description lang="fr"> in appinfo/info.xml.
  2. With Node.js, write the catalog for the browser and check the translations. Without it, open the pull request anyway: its check names each problem with its fix, and the fix bot writes the catalog for the browser, or suggests it on a fork.

    node scripts/check-l10n.mjs --fix
    node scripts/check-l10n.mjs
    
  3. Open a pull request with a title such as fix(i18n): correct the French of the report, and say what read wrong. Each commit needs a sign-off, git commit -s, which the editor of GitHub adds when you tick its box. CONTRIBUTING.md has the rest.

Add a language

  1. Start its catalogs with the code that Nextcloud has for the language, such as it for Italian or pt_BR for Brazilian Portuguese. For a language without a rule in scripts/check-l10n.mjs, the command says to copy pluralForm from core/l10n/<language>.json of Nextcloud:

    node scripts/check-l10n.mjs --new it
    node scripts/check-l10n.mjs --new sv --plural-form "nplurals=2; plural=(n != 1);"
    
  2. Translate every text of l10n/<language>.json; the check lists those that are still empty. A plural has one entry for each form of its rule, and where the rule has a form for millions, the second repeats the third. The names of the folders, such as Archive and _Deleted, become the folders of new installations in this language: keep them short, without a / and different from each other. A variant of a language with a catalog, such as de_DE beside de, takes the names of that catalog, which --new leaves empty and --fix writes.

  3. Add <summary lang="it"> and <description lang="it"> to appinfo/info.xml, after those of the other languages, with the same versions of Nextcloud as the English one and its sections and bullets, each translated at its place. A few variants have a code of their own in the App Store, such as zh-hans for zh_CN and zh-hant for zh_TW: the check names the code that it misses.
  4. Give the language its line in LANGUAGES of tests/e2e/language.mjs, with its locale and the form of a plural that Nextcloud picks for a number in the browser, by the table of getPlural() in @nextcloud/l10n: the end-to-end test of the languages then opens the settings in it, and node --test tests/e2e/language.test.mjs fails for a catalog without its line.
  5. Run node scripts/check-l10n.mjs --fix and node scripts/check-l10n.mjs, and name the language in Translations, in the table above and in the table of Folder names in README.md and README.de.md.
  6. Open a pull request with a title such as feat(i18n): speak Italian. An installation in use keeps the folders that it has: a run stores the names that it uses (decision 0036), so a new language needs no step of the update.

Release process

The protected main branch requires the checks of the CI, the Docker end-to-end tests against every supported Nextcloud version, the dependency review, CodeQL, the secret scan, the licenses of every file (REUSE), the sign-off of every commit and a Conventional Commit title. Renovate keeps the dependencies, the actions and the images current, and Dependabot the Features of the dev container; routine updates merge on their own once every check passes. Automation shows every workflow and bot, and when it runs.

The release bot keeps a pull request for the next release. Its version follows from the titles of the merged pull requests, and the fragments that they added in changelog.d/, with whatever is under Unreleased in CHANGELOG.md, become its notes. Merging it publishes the release: the package, checked before and after signing with the app's certificate, its detached signature, the SBOM as SPDX and as CycloneDX, THIRD_PARTY_NOTICES.md, the OpenVEX document when the project accepts an advisory, and signed build provenance, then the same package in the Nextcloud App Store, verified afterwards as users can verify it. See the release guide.

Project decisions and support expectations are documented in GOVERNANCE.md, SUPPORT.md, and CODE_OF_CONDUCT.md.