Skip to content

Commit

Permalink
Merge pull request #3 from javfres/version2
Browse files Browse the repository at this point in the history
Version2
  • Loading branch information
javfres authored Jun 3, 2021
2 parents 13ebd1c + b8313aa commit 0f7f534
Show file tree
Hide file tree
Showing 23 changed files with 4,054 additions and 775 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
vendor
15 changes: 10 additions & 5 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ It supports the `trans` function and the basic part of the `trans_choice`.

Add this require to the `composer.json`:

`"javfres/laravel-jslang": "^1.1.0"`
`"javfres/laravel-jslang": "^2.0.0"`

And also the repository

Expand Down Expand Up @@ -52,9 +52,14 @@ Generate the javascript dictionaries from the php ones:
Add the script in the blade (this will load the dictionary based on the current locale):

```
<script src="{{ jslang() }}"></script>
{!! jslang() !!}
```

This defines a global `JSLang` object. With the `trans` and `trans_choice` methods.
It has also a `setLocale` async method to change the locale loading it from
the server with ajax.


## Demo

I've created a demo view to test the translations
Expand All @@ -77,7 +82,7 @@ Route::get('/jslang-demo', function (){ return view('jslang::demo'); });
```

`"javfres/laravel-jslang": "^1.1.0"`
`"javfres/laravel-jslang": "^2.0.0"`

`composer update javfres/laravel-jslang`

Expand All @@ -87,7 +92,7 @@ Route::get('/jslang-demo', function (){ return view('jslang::demo'); });
### Compiling the base javascript file

I am using babel to generate the base javascript file that contains
the `trans` function.
the `JSLang` class with the `trans` and `trans_choice` static methods.

```
npm install
Expand All @@ -97,5 +102,5 @@ npm run compile
A demo

```
node src/js/demo_dict.js
npm run demo
```
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "javfres/laravel-jslang",
"description": "Laravel Javascript Translator",
"version": "1.1.0",
"version": "2.0.0",
"type": "library",
"authors": [
{
Expand Down
Loading

0 comments on commit 0f7f534

Please sign in to comment.