@@ -102,15 +102,15 @@ private function getCategories()
102
102
*/
103
103
private function makeTranslatableItem ($ item , $ output_type , $ context , $ translatable_field )
104
104
{
105
- $ toTranslate = $ item ->$ translatable_field ;
106
- if ($ toTranslate === null || $ toTranslate === "" ) {
105
+ $ to_translate = $ item ->$ translatable_field ;
106
+ if ($ to_translate === null || $ to_translate === "" ) {
107
107
return false ;
108
108
}
109
- if (is_array ($ toTranslate ) && count ($ toTranslate ) === 0 ) {
109
+ if (is_array ($ to_translate ) && count ($ to_translate ) === 0 ) {
110
110
return false ;
111
111
}
112
- if (is_array ($ toTranslate ) || is_object ($ toTranslate )) {
113
- $ toTranslate = json_encode ($ toTranslate );
112
+ if (is_array ($ to_translate ) || is_object ($ to_translate )) {
113
+ $ to_translate = json_encode ($ to_translate );
114
114
}
115
115
return [
116
116
// the item id, to be used when importing
@@ -120,9 +120,9 @@ private function makeTranslatableItem($item, $output_type, $context, $translatab
120
120
// the field name we want to translate
121
121
"attribute_name " => $ translatable_field ,
122
122
// the content of the field we want to translate
123
- "to_translate " => $ toTranslate ,
123
+ "to_translate " => $ to_translate ,
124
124
// this field remains empty since it's what the translator will use to create a translation
125
- "translation " => "" ,
125
+ "translation " => $ to_translate ,
126
126
// output_type is used when importing to know what we need to save
127
127
"output_type " => $ output_type ,
128
128
// context is just there to help translators understand more of what they are doing
@@ -135,7 +135,6 @@ private function makeTranslatableItem($item, $output_type, $context, $translatab
135
135
*/
136
136
protected function generateCategoryEntities ()
137
137
{
138
- echo OutputText::info ("Gathering translatable Category entities. " );
139
138
$ attributes = Collection::make (Category::translatableAttributes ());
140
139
$ categoriesByLang = $ this ->getCategories ();
141
140
$ categoriesByLang ->each (function ($ categories , $ language ) use ($ attributes ) {
@@ -153,7 +152,8 @@ protected function generateCategoryEntities()
153
152
* all the survey related entities base text
154
153
*/
155
154
$ this ->generateFile ($ items ->toJson (), $ language , 'categories ' );
156
- echo OutputText::info ("Created file for categories - based on language: $ language. " );
155
+ echo OutputText::success ("Created file for categories - based on language: $ language. " );
156
+ echo OutputText::info ("Total entities to translate: " . $ items ->count ());
157
157
});
158
158
}
159
159
@@ -195,7 +195,6 @@ private function getPosts()
195
195
*/
196
196
protected function generatePostEntities ()
197
197
{
198
- echo OutputText::info ("Gathering translatable Post entities. " );
199
198
$ attributes = Collection::make (Post::translatableAttributes ());
200
199
$ postsByLang = $ this ->getPosts ();
201
200
if (!$ postsByLang ) {
@@ -231,7 +230,8 @@ protected function generatePostEntities()
231
230
* all the post related entities base text
232
231
*/
233
232
$ this ->generateFile ($ items ->toJson (), $ language , 'posts ' );
234
- echo OutputText::info ("Created file for posts - based on language: $ language. " );
233
+ echo OutputText::success ("Created file for posts - based on language: $ language. " );
234
+ echo OutputText::info ("Total entities to translate: " . $ items ->count ());
235
235
});
236
236
}
237
237
/**
@@ -253,7 +253,6 @@ private function getSurveys()
253
253
*/
254
254
protected function makeSurveyEntities ()
255
255
{
256
- echo OutputText::info ("Gathering translatable Surveys entities. " );
257
256
$ surveyAttributes = Collection::make (Survey::translatableAttributes ());
258
257
259
258
$ surveysByLang = $ this ->getSurveys ();
@@ -303,13 +302,13 @@ protected function makeSurveyEntities()
303
302
});
304
303
});
305
304
});
306
- OutputText::info ("Count " . $ items ->count ());
307
305
/**
308
306
* Generates a file per each language containing
309
307
* all the post related entities base text
310
308
*/
311
309
$ this ->generateFile ($ items ->toJson (), $ language , 'surveys ' );
312
- echo OutputText::info ("Created file for surveys - based on language: $ language. " );
310
+ echo OutputText::success ("Created file for surveys - based on language: $ language. " );
311
+ echo OutputText::info ("Total entities to translate: " . $ items ->count ());
313
312
});
314
313
}
315
314
/**
0 commit comments