Download the PHP package dereuromark/cakephp-i18n-lint without Composer

On this page you can find all versions of the php package dereuromark/cakephp-i18n-lint. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cakephp-i18n-lint

CakePHP i18n Lint

CI

Checks the translation catalogs of a CakePHP plugin or application:

Extraction uses CakePHP's own i18n extract command, so the result is the same file bin/cake i18n extract would write. It runs without a booted application, which is what makes it usable in the CI of a plugin.

Installation

Requires PHP 8.2+ and CakePHP 5.1+.

Usage

Run the commands from the root of the plugin or application.

By default src/ and templates/ are scanned and the catalogs are expected in resources/locales/. All commands accept:

Option Meaning
--root Project root, defaults to the working directory.
--paths Comma-separated source paths, relative to the root.
--locales Locales directory, relative to the root.
-v Show what the extractor reported and per-string details.

For a plugin inside an application, point --root at it:

check

Extracts into a temporary directory and compares the result with the committed templates, message by message. The creation date in the header and the order of the entries do not count as a difference.

The printed commands can be pasted as they are: they repeat the --root, --paths and --locales options the failing run was called with.

Exits with 1 on any difference. A template whose domain has no strings left in the code is reported as a warning only.

extract

Writes the templates. A template whose messages did not change is left untouched, so the creation date does not produce a diff on every run. Source locations are not written.

sync

Updates every existing resources/locales/<locale>/<domain>.po from its template: missing strings are appended untranslated, strings that left the template are removed. Existing entries keep their exact text, comments and order.

An entry whose plural form changed in the template (singular to plural, or another msgid_plural) is reset to untranslated, because the old translation no longer fits.

Option Meaning
--dry-run Report only, and exit with 1 if a file would change.
--keep-obsolete Do not remove strings that left the template.

lint

Rule Severity Meaning
po.syntax error The file cannot be parsed.
po.encoding error The file is not valid UTF-8.
po.duplicate error The same string (and context) is defined twice.
po.placeholder-unknown error The translation uses a placeholder the source does not have.
po.icu error The translation is not a valid ICU message.
po.printf error The sprintf specifiers differ from the source.
po.plural-count error Number of plural forms differs from nplurals in the header.
po.plural-mismatch error Plural in the template but singular in the PO file, or vice versa.
pot.icu error A source string is not a valid ICU message.
po.placeholder-missing warning The translation drops a placeholder.
po.untranslated warning Empty translation.
po.fuzzy warning Marked fuzzy. CakePHP does not skip fuzzy entries.
po.missing warning A template string is not in the PO file. Fix with sync.
po.obsolete warning A PO string is not in the template anymore. Fix with sync.
po.whitespace warning Leading or trailing whitespace differs from the source.
po.plural-header warning Plural entries exist, but the header has no Plural-Forms.

Errors exit with 1. Pass --strict to fail on warnings too, or --fail-on to promote selected warnings only:

That setup requires every PO file to be in sync with its template, without requiring every string to be translated. sync fixes both rules.

After the findings, a How to fix: block lists one line per reported rule, with the sync or extract command to run where that is the fix.

ICU validation only applies to strings with placeholders. CakePHP returns a string without arguments as it is, so a lone { or an apostrophe in such a string is fine.

CI

One run on the highest PHP and CakePHP version is enough.

On GitHub Actions check and lint emit workflow annotations. Use --format text or --format github to choose explicitly.

As Composer scripts:

Strings the extractor cannot see

A call with a variable, such as __d('feedback', $priority), cannot be extracted. check and extract warn about each of them:

If such strings are added to the template by hand, check reports them as stale. List them as literals in a file that is only there to be scanned, and add its directory to the paths:

Limits


All versions of cakephp-i18n-lint with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
ext-intl Version *
cakephp/cakephp Version ^5.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dereuromark/cakephp-i18n-lint contains the following files

Loading the files please wait ...