Download the PHP package hsm/lokale without Composer
On this page you can find all versions of the php package hsm/lokale. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package lokale
Short Description Laravel Auto Locale Generator: Scan your Laravel project and automatically generate missing translation keys.
License MIT
Informations about the package lokale
Lokale
Lokale is a Laravel package designed to automatically extract and generate translation files by scanning your source code for translation keys. It also supports syncing translations between different locales.
🧩 Installation
Install the package using Composer:
⚙️ Configuration
This package uses Laravel's package discovery. If for some reason it's not auto-discovered, register it manually:
🚀 Usage
1. Generate Locale Files
You can generate translation files by scanning your source code:
Options
Option | Description |
---|---|
--locale |
Target locale to generate files for (default: value of app.locale ). |
--src |
Directory to scan for translation keys (default: app/ ). |
--default |
Used for generating default translation placeholders (default: default ). |
--comment |
Adds @TODO comments to missing translations with context information. |
--output |
Output directory for language files (default: lang/ ). |
--no-placeholder |
Do not generate placeholder values. |
Example
This will generate files like:
Each file will contain translation keys extracted from __()
, trans()
, or trans_choice()
usage across your source code.
2. Sync Between Locales
You can synchronize translation files between two locales using:
Options
Option | Description |
---|---|
--from |
Source locale. Required. |
--to |
Target locale. Required. |
--output |
Base directory for language files (default: lang/ ). |
--comment |
Adds @TODO comments for untranslated keys in target files. |
--no-placeholder |
Do not generate placeholder values. |
This is useful when adding new keys in one language and you want the same structure in another language.
3. Generate Attribute Translations
This command generates translation files for form request attributes:
Options
Option | Description |
---|---|
--locale |
Target locale. |
--src |
Directory for form requests (default: app/Http/Requests ). |
--output |
Output directory (default: lang/ ). |
--comment |
Add comments for missing translations. |
--no-placeholder |
Do not generate placeholder values. |
This helps to keep validation error messages localized and consistent.
🧠 How It Works
- Scans PHP and Blade files for translation functions (
__()
,trans()
,trans_choice()
). - Extracts keys and organizes them into proper translation files.
- Adds
@TODO
comments for untranslated placeholders when--comment
is enabled. - Generates modern, readable PHP array syntax.
📂 Output Example
resources/lang/fr/messages.php
👨💻 Author
- Amirhesam Bahmankhah
📧 [email protected]
📄 License
MIT © Amirhesam Bahmankhah
All versions of lokale with dependencies
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0
nikic/php-parser Version ^5.4