You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to edit the default template, the views must be published as well. The views will then be placed in `resources/views/vendor/translation-manager`.
49
+
Moreover, you have to disable `ONLY_FULL_GROUP_ID` strict mode for database connection. There are two ways:
Routes are added in the ServiceProvider. You can set the group parameters for the routes in the configuration.
53
-
You can change the prefix or filter/middleware for the routes. If you want full customisation, you can extend the ServiceProvider and override the `map()` function.
58
+
or
59
+
60
+
```php
61
+
'mysql' => [
62
+
// ...
63
+
'modes' => [
64
+
'NO_ZERO_DATE',
65
+
// you can specify what you want, without ONLY_FULL_GROUP_ID
66
+
],
67
+
],
68
+
```
69
+
70
+
Workflow
71
+
------------
72
+
73
+
This package doesn't replace the Translation system, only import/export PHP files to a database and make them editable in browser.
74
+
Package contains helper for live editing content on website.
75
+
76
+
The workflow would be:
54
77
55
-
This example will make the translation manager available at `http://yourdomain.com/translations`
78
+
- Import translations: Read all translation files and save them in the database
79
+
- Find all translations in php/twig sources
80
+
- Optionally: Listen to missing translation with the custom Translator
81
+
- Translate all keys through the webinterface
82
+
- Export: Write all translations back to the translation files.
56
83
57
84
Usage
58
85
------
59
86
60
-
### Web interface
87
+
You can access package in `http://yourdomain.com/translations` in default configuration. You can change as you pleased.
61
88
62
-
When you have imported your translation (via buttons or command), you can view them in the webinterface (on the url you defined with the controller).
63
-
You can click on a translation and an edit field will popup. Just click save and it is saved :)
64
-
When a translation is not yet created in a different locale, you can also just edit it to create it.
89
+
Configuration
90
+
-------------
65
91
66
-
Using the buttons on the webinterface, you can import/export the translations. For publishing translations, make sure your application can write to the language directory.
| highlight_locale_marked | Highlight lines with locale marked as not translated. | false |
99
+
| live_translation_enabled | Enable live translation of content. | false |
100
+
| permissions | Define whow and when can edit translations. | function () {return env('APP_ENV') == 'local'; } |
67
101
68
-
You can also use the commands below.
102
+
103
+
Commands
104
+
---------
69
105
70
106
### Import command
71
107
@@ -85,35 +121,36 @@ The found keys will be added to the database, so they can be easily translated.
85
121
This can be done through the webinterface, or via an Artisan command.
86
122
87
123
```bash
88
-
$ php artisan translations:find
124
+
php artisan translations:find
89
125
```
90
126
91
127
### Export command
92
128
93
-
The export command will write the contents of the database back to app/lang php files.
129
+
The export command will write the contents of the database back to resources/lang php files.
94
130
This will overwrite existing translations and remove all comments, so make sure to backup your data before using.
95
131
Supply the group name to define which groups you want to publish.
132
+
If you want to export all groups, provide `*` as name of group.
96
133
97
134
```bash
98
-
$ php artisan translations:export <group>
135
+
php artisan translations:export <group>
99
136
```
100
137
101
-
For example, `php artisan translations:export reminders` when you have 2 locales (en/nl), will write to `app/lang/en/reminders.php` and `app/lang/nl/reminders.php`
138
+
For example, `php artisan translations:export reminders` when you have 2 locales (en/pl), will write to `resources/lang/en/reminders.php` and `resources/lang/pl/reminders.php`
102
139
103
140
### Clean command
104
141
105
142
The clean command will search for all translation that are NULL and delete them, so your interface is a bit cleaner. Note: empty translations are never exported.
106
143
107
144
```bash
108
-
$ php artisan translations:clean
145
+
php artisan translations:clean
109
146
```
110
147
111
148
### Reset command
112
149
113
150
The reset command simply clears all translation in the database, so you can start fresh (by a new import). Make sure to export your work if needed before doing this.
114
151
115
152
```bash
116
-
$ php artisan translations:reset
153
+
php artisan translations:reset
117
154
```
118
155
119
156
### Detect missing translations
@@ -131,12 +168,98 @@ This will extend the Translator and will create a new database entry, whenever a
131
168
This way it shows up in the webinterface and can be edited and later exported.
132
169
You shouldn't use this in production, just in production to translate your views, then just switch back.
133
170
171
+
Live editing
172
+
---------
173
+
174
+
When you have translations in database, you can use `transEditable` method instead of `trans` whenever it's suitable. To do this, you have to make few steps:
175
+
176
+
Update `config/app.php` by adding an entry for the service provider (another one):
0 commit comments