Download the PHP package adiartawibawa/language-generator without Composer
On this page you can find all versions of the php package adiartawibawa/language-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download adiartawibawa/language-generator
More information about adiartawibawa/language-generator
Files in adiartawibawa/language-generator
Package language-generator
Short Description A Laravel package to generate and translate language files using Google Translate
License MIT
Informations about the package language-generator
Language Generator
language-generator
is a Laravel package that allows you to generate and translate language files from one language to another using Google Translate.
Installation
You can install the package via Composer:
Service Provider Registration
If you are using Laravel 5.5 or later, the service provider will be automatically registered. For earlier versions of Laravel, you need to manually add the service provider in your config/app.php
file:
Configuration
To publish the configuration file, run the following command:
This will create a language-generator.php
configuration file in your config
directory. You can customize the configuration as needed.
Usage
Once the package is installed and configured, you can use it via Artisan commands to generate and translate language files.
Commands
The package provides an Artisan command for generating and translating language files.
Generating and Translating Language Files
To generate and translate language files from one language to another, use the following command:
Arguments:
{from}
: The source language code.{to*}
: The target language codes (you can specify multiple target languages).
Options:
--file=
: (Optional) Specify a particular file to translate.--json
: (Optional) If specified, the source language file is assumed to be a JSON file.
Examples:
-
Generate and translate all language files from English to Spanish and French:
-
Translate a specific file from English to Spanish:
- Translate a JSON file from English to Spanish:
Example Workflow
-
Generating and Translating Language Files
Generate and translate language files from English to Spanish and French:
This will create Spanish and French language files with translated strings.
-
Translating a Specific File
Translate the
messages.php
file from English to Spanish: -
Translating a JSON File
Translate the
lang/en.json
file to Spanish:
Configuration Options
The language-generator.php
configuration file contains various options that you can customize:
License
This package is open-source and licensed under the MIT license.
Troubleshooting
If you encounter any issues, ensure you have the necessary configurations set up in the language-generator.php
configuration file. Check for any API limitations or errors from Google Translate as well.
Contributing
Contributions are welcome! Please open an issue or submit a pull request for any bugs or feature requests.
Contact
For any questions or inquiries, please contact Adi Arta Wibawa at [email protected].