Skip to content
This repository was archived by the owner on Jul 16, 2020. It is now read-only.

Commit c3e999b

Browse files
committed
README: document template names
1 parent cb17c1b commit c3e999b

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![Build Status](https://travis-ci.org/martinlindhe/laravel-vue-i18n-generator.png?branch=master)](https://travis-ci.org/martinlindhe/laravel-vue-i18n-generator)
33

44

5-
Laravel 5 package that allows you to share your Laravel translations
5+
Laravel 5 package that allows you to share your [Laravel localizations](http://laravel.com/docs/5.1/localization)
66
with your [vue](http://vuejs.org/) front-end, using [vue-i18n](https://github.com/kazupon/vue-i18n).
77

88

@@ -35,6 +35,32 @@ Vue.use(VueInternationalization, {
3535
...
3636
```
3737

38+
## Template names
39+
40+
This generate adjusts the strings in order to work with vue-i18n's template names,
41+
making it simple to share also named templates from your Laravel translations.
42+
43+
resource/lang/message.php:
44+
```php
45+
return [
46+
'hello' => 'Hello :name',
47+
];
48+
```
49+
50+
Blade template:
51+
```php
52+
<div class="message">
53+
<p>{{ trans('message.hello', ['name' => 'visitor']) }}</p>
54+
</div>
55+
```
56+
57+
Vue template:
58+
```js
59+
<div class="message">
60+
<p>{{ $t('message.hello', { name: "visitor"}) }}</p>
61+
</div>
62+
```
63+
3864

3965
## Notice
4066

0 commit comments

Comments
 (0)