Closed kaneymhf closed 4 years ago
Does this fix the issue where having multi dimensional array you get an empty translation file
I use multidimensional arrays in my project, and has worked correctly in my tests. I tested various scenarios and all tests passed.
I think my issue might lay somewhere different as
<?php
return [
'names' => [
'user' => 'User',
'users' => 'Users',
'supplier' => 'Supplier',
'suppliers' => 'Suppliers',
'customer' => 'Customer',
'customers' => 'Customers',
'order' => 'Order',
'orders' => 'Orders',
'order_line' => 'Order line',
'order_lines' => 'Order lines',
],
'fields' => [
'reference' => 'Reference',
'name' => 'Name',
'email' => 'Email',
'password' => 'Password',
'role' => 'Role',
'location' => 'Location',
'webhook' => 'Webhook',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
'deleted_at' => 'Deleted At',
'order_ref' => 'Order Ref',
'file_ref' => 'File Ref',
'make' => 'Make',
'vin' => 'VIN',
'first_reg' => 'First Registration',
'preferred_supply_date' => 'Preferred Supply Date',
'comments' => 'Comments',
'exported_at' => 'Exported At',
'position' => 'Position',
'part_number' => 'Part Number',
'part_description' => 'Part Description',
'quantity' => 'Quantity',
'gross_price' => 'Gross Price',
'price' => 'Net price',
'ordered_at' => 'Ordered At',
'delivered_at' => 'Delivered At',
'cancelled_at' => 'Cancelled At',
],
];
fails and just gives me an empty array as translated file while
return [
'mail' => [
'success' => 'Notification mail was sent successfully.',
],
'login' => [
'success' => 'Welcome! You are now logged in!',
],
];
succeeds. Both are the exact same of build (expect the size) but one fails and one succeeds. guess i'll have to manualy translate :(
Changed the name of the file from resources to customResources and it worked...
Thank you for the contribution. Please use dev-master for testing. If no problem occurs within 2 weeks I am planning a new version release.
When working with multidimensional arrays, the function doesn't work when is checking for already translated strings and printing the skipped value, because try to convert Array to String. I just left the search function for strings already translated working recursively.