All Projects → kkomelin → Laravel Translatable String Exporter

kkomelin / Laravel Translatable String Exporter

Licence: mit
Translatable String Exporter for Laravel

Projects that are alternatives of or similar to Laravel Translatable String Exporter

Keycloak Config Cli
Import YAML/JSON-formatted configuration files into Keycloak - Configuration as Code for Keycloak.
Stars: ✭ 147 (-1.34%)
Mutual labels:  json, export
Lumen Api Starter
Quickstarter for Lumen
Stars: ✭ 54 (-63.76%)
Mutual labels:  json, laravel
Laracsv
A Laravel package to easily generate CSV files from Eloquent model
Stars: ✭ 583 (+291.28%)
Mutual labels:  export, laravel
Stream Parser
⚡ PHP7 / Laravel Multi-format Streaming Parser
Stars: ✭ 391 (+162.42%)
Mutual labels:  json, laravel
Nova Translatable
Making Nova fields translatable
Stars: ✭ 119 (-20.13%)
Mutual labels:  laravel, translations
Performance
⏱ PHP performance tool analyser your script on time, memory usage and db query. Support Laravel and Composer for web, web console and command line interfaces.
Stars: ✭ 429 (+187.92%)
Mutual labels:  export, laravel
Laravel Translatable
It's a Laravel database translations manager
Stars: ✭ 47 (-68.46%)
Mutual labels:  laravel, translations
I18n Editor
GUI for editing your i18n translation files
Stars: ✭ 290 (+94.63%)
Mutual labels:  json, translations
Laravel Translations Loader
Webpack loader to import Laravel translation files (PHP or JSON) into your JS bundle as JSON.
Stars: ✭ 109 (-26.85%)
Mutual labels:  laravel, translations
Invoice As A Service
💰 Simple invoicing service (REST API): from JSON to PDF
Stars: ✭ 106 (-28.86%)
Mutual labels:  json, laravel
Polr
🚡 A modern, powerful, and robust URL shortener
Stars: ✭ 4,147 (+2683.22%)
Mutual labels:  json, laravel
Report
Report management package in PHP that aims to help you export information in a variety of formats
Stars: ✭ 125 (-16.11%)
Mutual labels:  export, laravel
Laravel Json Api Paginate
A paginator that plays nice with the JSON API spec
Stars: ✭ 351 (+135.57%)
Mutual labels:  json, laravel
Laravel Api Response Builder
Builds nice, normalized and easy to consume Laravel REST API JSON responses.
Stars: ✭ 433 (+190.6%)
Mutual labels:  json, laravel
Laravel5 Jsonapi
Laravel 5 JSON API Transformer Package
Stars: ✭ 313 (+110.07%)
Mutual labels:  json, laravel
Laravel Schemaless Attributes
Add schemaless attributes to Eloquent models
Stars: ✭ 595 (+299.33%)
Mutual labels:  json, laravel
Laravel Nova Lang
🌌 Language files for Laravel Nova translated into 40+ languages. Feel free to submit your language or update an existing one!
Stars: ✭ 275 (+84.56%)
Mutual labels:  laravel, translations
Slack History Export
A NPM module that allows slack users export their history
Stars: ✭ 284 (+90.6%)
Mutual labels:  json, exporter
Eslint Plugin I18n Json
Fully extendable eslint plugin for JSON i18n translation files.
Stars: ✭ 101 (-32.21%)
Mutual labels:  json, translations
Api Response
Simple and ready to use API response wrapper for Laravel.
Stars: ✭ 123 (-17.45%)
Mutual labels:  json, laravel

Translatable String Exporter for Laravel

Build Status

As we know, Laravel 5.4 has introduced a "new" way of string translation. Now you can use __('Translate me') or @lang('Translate me') with translations in JSON files to translate strings. Translatable String Exporter is aimed to collect all translatable strings of an application and create corresponding translation files in JSON format to simplify the process of translation.

Installation

  1. Add kkomelin/laravel-translatable-string-exporter to your project:
composer require kkomelin/laravel-translatable-string-exporter
  1. [Laravel < 5.5 only] Add ExporterServiceProvider to the providers array in config/app.php:
KKomelin\TranslatableStringExporter\Providers\ExporterServiceProvider::class,

Configuration

To change project defaults, use the following command to create a configuration file in your config folder and make necessary changes in there:

php artisan vendor:publish --provider="KKomelin\TranslatableStringExporter\Providers\ExporterServiceProvider"

Usage

Export translatable strings

php artisan translatable:export <lang>

Where <lang> is a language code or a comma-separated list of language codes.
For example:

php artisan translatable:export es
php artisan translatable:export es,bg,de

The command with the "es,bg,de" parameter passed will create es.json, bg.json, de.json files with translatable strings or update the existing files in the resources/lang folder of your project.

Find untranslated strings in a language file (command)

To inspect an existing language file (find untranslated strings), use this command:

php artisan translatable:inspect-translations fr

Only one language at a time, please.

To export translatable strings for a language and then inspect translations in it, use the following command:

php artisan translatable:inspect-translations fr --export-first

Find untranslated strings in a language file (IDE)

An alternative way to find untranslated strings in your language files is to search for entries with the same string for original and translated. You can do this in most editors using a regular expression.

In PhpStorm, you can use this pattern: "([^"]*)": "\1"

Persistent strings

Some strings are not included in the export, because they are being dynamically generated. For example:

{{ __(sprintf('Dear customer, your order has been %s', $orderStatus)) }}

Where $orderStatus can be 'approved', 'paid', 'cancelled' and so on.

In this case, you can add the strings to the <lang>.json file manually. For example:

  "Dear customer, your order has been approved": "Dear customer, your order has been approved",
  "Dear customer, your order has been paid": "Dear customer, your order has been paid",
  ...

In order for those, manually added, strings not to get removed the next time you run the export command, you should add them to a json file named persistent-strings.json. For example:

[
  "Dear customer, your order has been approved",
  "Dear customer, your order has been paid",
  ...
]

License & Copyright

MIT, (c) 2017 Konstantin Komelin

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].