Aman-Mittal opened a new pull request, #183:
URL: https://github.com/apache/fineract-consumer-facing/pull/183
Part of #172. It follows #169, adding the two remaining adapters of
apache/fineract-backoffice-ui's adapter set.
## Changes
**I18N** (`core/adapters/i18n`)
- An `I18nAdapter` contract (`currentLang` signal, `translate`, `use`) with
an ngx-translate implementation.
- An `appTranslate` pipe. It has the same name as in the back-office UI, and
it is impure and memoised as ngx-translate's own pipe is.
- New rule `local/no-i18n-library-import`. It is a rule of its own so its
suppression count cannot be traded against another boundary. It reports
`@ngx-translate/*` imports outside the adapter, `app.config.ts` and
`testing/i18n-testing.ts`, which provides `provideI18nTesting()` and
`setTestTranslations()`.
**STORAGE** (`core/adapters/storage`)
- Reads and writes never throw. Web Storage does throw in private browsing
and under storage-denying browser policies.
- Keys come from `STORAGE_KEYS` under the names already in use
(`bff.device-id`, `app.lang`), so values already stored in browsers are still
found.
- `no-restricted-globals` reports `localStorage` and `sessionStorage`
outside the adapter.
**Suppressions baseline (the ratchet)**
- The 34 files that predate the adapters (37 violations) are recorded in
`frontend/eslint-suppressions.json` using ESLint's bulk suppressions.
- `npm run lint` now runs `eslint src --suppressions-location
eslint-suppressions.json`, as the back-office UI does. Checked locally:
- a new violation fails (exit 1);
- a migrated file whose entry is still recorded also fails (exit 2) until
`npm run lint:prune` drops it;
- so the baseline can only shrink.
- `ng lint` does not read the baseline; the docs say to use `npm run lint`.
- The file is generated JSON and cannot carry a licence header, so it is
added to `rat-excludes`.
**Docs**
- The Adapter Boundary page covers the new adapters, the rules, the baseline
and how to migrate a component.
- The build-and-test script table and `AGENTS.md` are updated.
## No behavioural change
- **No existing file is migrated.** Every current use is in the baseline, so
the app runs exactly the same code.
- **New code only:** the adapters, the pipe and the spec helpers. They are
covered by 9 new specs:
- the I18N default binding, missing-key fallback, language switch and
interpolation;
- the pipe re-rendering on a language change;
- storage round-trips under the existing key names;
- storage swallowing `SecurityError` and `QuotaExceededError`.
- **i18n check:** `npm run i18n:check` inspects literal template text and
does not depend on the pipe's name, so migrated templates will pass it. Only
its message now mentions `appTranslate`.
## Verification (local)
- `npm run lint` (with the baseline), `npm run format:check` and `tsc` for
app and specs all pass.
- `npm run test:eslint-rules` passes 28/28, including the new rule's tests.
- `npm test` passes 144/144 (135 before, plus 9).
- `npm run build` and `npm run i18n:check` pass.
## Burn-down
Migration is tracked in #172, with sub-issues by area: #173 (core:
`I18nService` and the device fingerprint), #174–#182 (feature screens, shell
and shared components).
Each is a mechanical swap of the import, the pipe name and the spec helper,
followed by `npm run lint:prune`, so most are marked `good first issue`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]