Translation Toolkit
Toolkit is the command-line tool for maintaining translation packs. Run it from a Mona checkout after installing the root Composer dependencies. For publishing translations in a Laravel application, use the Artisan commands.
composer install
php src/Toolkit/bin/toolkit list
php src/Toolkit/bin/toolkit migrate-locales --help
Check translation status
php src/Toolkit/bin/toolkit status src/Library
The command writes locales/<locale>/_status.json within the project. It lists entries whose saved translation matches the source phrase and groups them by style. It combines exclusions from locales/_settings.json and locales/<locale>/_settings.json and deletes empty reports. To find phrases entirely absent from a dictionary, compare it with the pack's source files.
Manage locale directories
php src/Toolkit/bin/toolkit create-locale src/Library
php src/Toolkit/bin/toolkit delete-locale src/Library
create-locale creates missing directories for all canonical locale codes. The new directories start empty. delete-locale deletes each immediate directory under locales/ whose name is outside that list. Check the target before running it, especially if it contains locale aliases or custom codes.
Remove obsolete dictionary entries
php src/Toolkit/bin/toolkit sync:library src
php src/Toolkit/bin/toolkit sync:package path/to/translation-pack
sync:librarycollects source phrases from packages with alaravel_lang.jsonmanifest undersrc/and rewrites dictionaries insrc/Library/locales/.sync:packagereads one pack'ssource/directory and prunes unused entries in itslocales/directory. It deletes dictionaries left empty by pruning.
Both keep existing translations for active phrases and preserve underscore-prefixed files such as _settings.json. Add translations for new phrases directly to the dictionary.
Migrate legacy dictionaries
php src/Toolkit/bin/toolkit migrate-locales path/to/legacy-pack --target=path/to/new-pack/locales
Pass a legacy pack containing source/ and locales/. The target is the directory that should contain the locale subdirectories. Pass --target in scripts. An interactive run prompts for it when omitted.
php.jsonandjson.jsonbecomedefault.json. The new keys are the original source phrases.php-inline.jsonandjson-inline.jsonbecomeinline.jsonfor source phrases that contain:attribute._excludes.jsonentries move into the target locale's_settings.jsonunderexcludes.
Toolkit keeps the legacy files and merges into the target dictionaries. On a key collision, the migrated translation wins. If both legacy formats supply a translation for the same phrase, the PHP dictionary wins. Use a separate destination to review the migration before replacing an active dictionary. See the upgrade guide for changes to your application or plugin manifest.
Import sources from a ZIP archive
php src/Toolkit/bin/toolkit download \
--url=https://github.com/laravel/framework/archive/refs/heads/12.x.zip \
--directory=workbench/downloads/framework/12.x \
--paths=src/Illuminate/Translation/lang/en \
--only-copy
--directorysets the final destination.--pathscan be repeated for directories relative to the archive root.- Selected PHP and JSON files are copied by filename into the destination. PHP files are copied as bytes. JSON files with the same name are merged, with incoming values taking precedence.
- Without
--only-copy, Toolkit scans for supported translation calls with literal keys. If it finds phrases, it writes a JSON source named for the destination's parent directory, such asframework.jsonin the example. - The command requires PHP's ZIP extension. It stages changes before publishing and attempts to restore the previous destination if publication fails.