Repository navigation
feat: modernize Jigsaw localization package - #10
Merged
Merged
Conversation
Add tool-agnostic source collection, deterministic JSON catalog IO, placeholder validation, configurable localization loading, and stronger cross-version test coverage. Also repair the test fixtures after locale resolution started validating configured locales. Signed-off-by: Vitor Mattos <vitor@php.rio>
vitormattos
force-pushed
the
feat/translation-catalog-foundation
branch
from
September 26, 2026 15:12
23fa981 to
04df351
Compare
Handle escaped printf percents correctly, remove a PHPStan 2 option that no longer exists, avoid Composer command-name collisions, and apply the Pint format expected by the current toolchain. Signed-off-by: Vitor Mattos <vitor@php.rio>
Normalize not-operator spacing and PHPDoc alignment required by the current Laravel Pint release. Signed-off-by: Vitor Mattos <vitor@php.rio>
Use explicit boolean comparisons around directory creation so the code remains clear and stable across the current Pint rule set. Signed-off-by: Vitor Mattos <vitor@php.rio>
Always terminate generated JSON catalogs with LF instead of PHP_EOL so the same catalog has identical bytes on Linux and Windows. Signed-off-by: Vitor Mattos <vitor@php.rio>
Temporarily surface Pint's exact formatting changes in CI so the branch can be aligned with the current formatter without guessing fixer output. Signed-off-by: Vitor Mattos <vitor@php.rio>
Apply the formatter's exact constructor layout and restore the lint workflow to non-mutating test mode. Signed-off-by: Vitor Mattos <vitor@php.rio>
Introduce locale-aware translation sources, pluggable extractors, safe catalog path resolution and conservative catalog synchronization. Extraction filters non-source locales before invoking adapters so translated content cannot pollute the canonical source catalog. Keep the implementation translation-tool agnostic and preserve the declared PHP 8.0 runtime compatibility. Signed-off-by: Vitor Mattos <vitor@php.rio>
Use PHPUnit attributes for data providers and validate extractor output before normalization so PHPStan can narrow the result type correctly. Signed-off-by: Vitor Mattos <vitor@php.rio>
Validate catalog values before writing and force object encoding so empty or numeric-key catalogs never become JSON arrays. Signed-off-by: Vitor Mattos <vitor@php.rio>
Keep defensive checks for public-library callers while marking boundary values as runtime mixed so PHPStan does not treat PHPDoc declarations as guarantees. Signed-off-by: Vitor Mattos <vitor@php.rio>
Temporarily export the resolved lockfile from the stable PHP 8.2 job so the library CI can move to reproducible installs while retaining dedicated compatibility jobs. Signed-off-by: Vitor Mattos <vitor@php.rio>
Add a one-time branch workflow to materialize the development lockfile from the package constraints before switching normal CI to composer install. Signed-off-by: Vitor Mattos <vitor@php.rio>
Use a real GitHub Actions matrix for supported PHP and operating-system combinations, reserve composer update for the explicit prefer-lowest compatibility job, enable Dependabot for Composer and Actions, update checkout to v7.0.1 by full SHA, and expand placeholder coverage with data providers. Signed-off-by: Vitor Mattos <vitor@php.rio>
Temporarily let the existing test workflow create the first Composer lockfile on this same-repository pull request. The bootstrap job is removed after the lockfile is committed. Signed-off-by: Vitor Mattos <vitor@php.rio>
Track composer.lock so normal development and CI installs are reproducible. The lockfile remains irrelevant to downstream consumers of this library. Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Keep only the steady-state CI now that composer.lock is tracked: locked installs for normal jobs and one explicit prefer-lowest compatibility job. Signed-off-by: Vitor Mattos <vitor@php.rio>
Move path resolution, JSON catalog encoding, placeholder parsing and extractor result normalization into focused services. Keep public helpers as compatible facades while reducing branching and IO coupling in the core classes. Add direct unit coverage for each pure service and edge cases. Signed-off-by: Vitor Mattos <vitor@php.rio>
Wrap constructed locale resolvers before method chaining so the helpers parse on every PHP runtime supported by the package. Signed-off-by: Vitor Mattos <vitor@php.rio>
Add PHPMD with a cyclomatic-complexity threshold of 5 and an NPath guard, run it in pull requests, and refresh development/tool lockfiles so static analysis remains reproducible. Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Move locale display-name resolution and URL-key mapping out of global helpers into independently testable services with injectable name resolution. Remove the temporary lock refresh workflow now that all development lockfiles are committed. Signed-off-by: Vitor Mattos <vitor@php.rio>
Replace compound path-segment branching with a dedicated predicate and split ExtractedString constructor validation into focused guards. Expand data-driven coverage for required fields and invalid line numbers. Signed-off-by: Vitor Mattos <vitor@php.rio>
Move PHPStan and PHPMD into dedicated vendor-bin projects and make all tool scripts invoke their isolated binaries explicitly. Keep the root require-dev limited to the composer-bin plugin and Jigsaw integration dependency. Extend Dependabot coverage to every isolated Composer manifest. Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Keep only the steady-state Composer Bin Plugin setup now that the root and per-tool lockfiles are committed. Signed-off-by: Vitor Mattos <vitor@php.rio>
Disable composer-bin proxy links and invoke PHPUnit and Pint directly from their isolated vendor-bin projects. This keeps both dependencies and executable entry points scoped to each development tool. Signed-off-by: Vitor Mattos <vitor@php.rio>
Add a temporary branch workflow to update only Composer lock metadata after disabling root bin links. Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Keep only the steady-state isolated Composer Bin Plugin configuration now that the refreshed root lock metadata is committed. Signed-off-by: Vitor Mattos <vitor@php.rio>
Drop PHP 8.0-8.2 from the package contract and CI matrix. PHP 8.2 is already security-only and reaches end of life at the end of 2026, so a newly modernized library should start from PHP 8.3. Move prefer-lowest and complexity validation to PHP 8.3 and update the published requirements accordingly. Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Keep only the steady-state PHP 8.3+ support policy now that the root lockfile metadata reflects the new minimum runtime. Signed-off-by: Vitor Mattos <vitor@php.rio>
Replace the historical README with focused usage documentation for the current package architecture. Remove obsolete badges, banner, TODOs, locale-format assumptions and project-specific page-layout advice. Move contribution guidance to CONTRIBUTING.md. Signed-off-by: Vitor Mattos <vitor@php.rio>
Run the supported PHP versions on Ubuntu only and keep the prefer-lowest job separate. The package targets the Linux-based PHP/Jigsaw development workflow. Signed-off-by: Vitor Mattos <vitor@php.rio>
Restore the upstream MIT license text under the conventional LICENSE filename so GitHub and package consumers can identify the repository license directly. Signed-off-by: Vitor Mattos <vitor@php.rio>
Replace the abandoned php-json-tongue runtime dependency with an injectable LocalizationLoader contract and a strict JSON directory loader. Preserve the historical per-locale and multi/ formats while rejecting malformed catalogs instead of silently treating them as empty. Add compatibility and custom-loader coverage so consuming Jigsaw projects can replace storage without changing the Jigsaw integration. Signed-off-by: Vitor Mattos <vitor@php.rio>
Add a temporary branch workflow to regenerate the development lockfile after removing the abandoned php-json-tongue runtime dependency. Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Split root and per-locale validation into focused methods instead of relaxing the configured cyclomatic-complexity threshold. Signed-off-by: Vitor Mattos <vitor@php.rio>
Add a temporary branch workflow to apply the repository's Pint rules to the new loader implementation. Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Document the storage extension point and remove temporary lock/formatting workflows now that the loader refactor is committed and formatted. Signed-off-by: Vitor Mattos <vitor@php.rio>
Exercise LoadLocalization through Jigsaw's container to ensure the optional loader contract does not require consumer bindings for the default setup. Signed-off-by: Vitor Mattos <vitor@php.rio>
Rename the Composer package to libresign/jigsaw-localization and migrate the PHP namespace to LibreSign\\JigsawLocalization across source, tests, mocks and documentation. Preserve original authorship and document the upstream fork. Add package discovery metadata for Packagist and the maintained repository. Signed-off-by: Vitor Mattos <vitor@php.rio>
Add a temporary branch workflow to refresh Composer lock metadata after the package and PSR-4 namespace rename. Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Apply the repository import ordering rules after moving the package to the LibreSign namespace and remove the temporary lock refresh workflow. Signed-off-by: Vitor Mattos <vitor@php.rio>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Modernizes the Jigsaw localization package and moves the maintained fork to the LibreSign package identity.
Breaking changes
elaborate-code/jigsaw-localization→libresign/jigsaw-localizationElaborateCode\JigsawLocalization→LibreSign\JigsawLocalizationThis should be released as a new major version.
Main changes
LocalizationLoadercontract;php-json-tonguedependency;multi/catalogs;The README keeps attribution to the original
elaborate-code/jigsaw-localizationproject.Reusability
The package contains no LibreSign-specific translation rules or translation-platform integration. Jigsaw projects can use the default JSON loader, inject another storage backend, plug in custom string extractors, or consume the catalog APIs independently.
The
__()helper remains available for the familiar translation API, while the underlying functionality is also exposed through testable object-oriented services.Validation
prefer-lowest;composer validate --strict;