library langjs
Compile lang files to be used within js
awkwardideas/langjs
Compile lang files to be used within js
- Thursday, March 2, 2017
- by awkwardideas
- Repository
- 1 Watchers
- 5 Stars
- 28 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 3 Versions
- 8 % Grown
LangJS: Compile lang files to a js file for use on client side
, (*1)
Install Via Composer
composer require awkwardideas/langjs, (*2)
Add to config/app.php
Under Package Service Providers Add, (*3)
AwkwardIdeas\LangJS\LangJSServiceProvider::class,, (*4)
Build LangJS script file
- run
php artisan langjs:build --d js/LangJS.js
- Adjust the --d path to whatever you would like under your public directory
- Include this script file into your layout
- You must run the build command any time you want to recompile the language file changes. A watchdog may be built in the future but is not currently available
- This only compiles the lang files within your resources/lang folder. Vendor lang files are not included currently.
Javascript commands
-
_lang(key [, replace, locale])
, (*5)
- Same setup as
@lang('auth.user')
, will retrieve your language for password which you put in your php lang file auth.php.
- Replace and locale are optional parameters
- Locale will default to en, if not provided.
- If key has a plural form, the singular version will be returned, instead of the full term value
-
_choice(key, number [, replace, locale])
, (*6)
- Same setup as
@choice('auth.user',2)
- Replace and locale are optional parameters
- Locale will default to en, if not provided.
1.0.x-dev
1.0.9999999.9999999-dev
Compile lang files to be used within js
Sources
Download
MIT
The Requires
by
Chad Haney
by
Awkward Ideas
dev-master
9999999-dev
Compile lang files to be used within js
Sources
Download
MIT
The Requires
by
Chad Haney
by
Awkward Ideas
v1.0.0
1.0.0.0
Compile lang files to be used within js
Sources
Download
MIT
The Requires
by
Chad Haney
by
Awkward Ideas