dev-master
9999999-dev
GPL-2.0
The Requires
- php >=5.4.0
- illuminate/support 4.2.*
by Philippe Gilbert
Wallogit.com
2017 © Pedro Peláez
Convert your .NET resource files to Laravel language files, (*1)
The first step is to install the package through Composer, for that require "itx-technologies/artisan-resx-to-lang" in your composer.json file, (*2)
"require-dev": {
"itx-technologies/artisan-resx-to-lang": "~2.0"
}
Then update composer from the command line, (*3)
composer update --dev
And finally add the following to the providers array of the /app/config/app.php file, (*4)
'ItxTechnologies\ArtisanResxToLang\ArtisanResxToLangServiceProvider',
You can then call php artisan to see the installed resxToLang command, (*5)
First of all, make sure that the folders for every language you are trying to convert are present in your /app/lang directory.
Then, make sure that the base language, the one in the flat [name].resx files, is set as your fallback locale in /app/config/app.php.
Finally, transfer your .resx files in a folder called resx in your public folder. When that is done, simply call the command from the command line:, (*6)
php artisan resxToLang [filename]
When entering the filename, don't add the .resx., (*7)
The command will do it's magic, once it's finished, you can open your app/lang/[locale] folder and see a file named [filename].php that includes every string from your original resx file. In the other locale folders, you will see the same php file containing the same strings in that language., (*8)
if you used the razor templating engine in your original C# project, the translation is really fast. A line that looked like this:, (*9)
@Resources.File.String
becomes:, (*10)
@lang('file.String')
in a blade file or:, (*11)
echo Lang::get('file.String');
in a php block., (*12)
Please note that the file names are all lowercased during the conversion but not the string name, (*13)
GPL-2.0