-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Importing Laravel system translations #1
Comments
Thx for your comment. |
Maybe a seperate command to import the php files to the json files could be an idea. |
Could easily be better structured, but i used this to get the translations: Arr::dot(collect(\Illuminate\Support\Facades\File::files(base_path('resources/lang/en')))->mapWithKeys(function($file) {
$group = str_replace('.php', '', $file->getFilename());
return [
$group =>
(new \Illuminate\Translation\FileLoader(
new Illuminate\Filesystem\Filesystem(),
base_path('resources/lang')
))->load('en', $group)
];
})->toArray()); |
Yes, but the problem is not in the scan, it already scans those files, the problem is with POEditor and how to write it back in different folders and files. The solution is to change your system translations in
to:
Then it will on next scan it will add it to the translation sync and you are all good. I'll update the README soon. |
Ohh.. Is that why it removes the translations i imported, when doing a new scan? |
Good question, do you mean in POEditor or in Laravel project? |
Ohh. That's why. As it is primary uploading terms, wouldn't it be smarter to merge with current one and then upload? In that way you can create terms without using then in the application. |
Good idea, will look into that. |
Cool. I also often experience that code gets outcommented, removed or added from different branches, so they are sometimes there and then not. The result of that would be terms getting deleted and added all the time. |
You always have to do a scan for translations then the file will always be updated. |
But you can delete olds keys manually on POEditor? And if you wait to scan upon deployment, you could get translations in production that has not been translated. |
Try release 1.0.4 it have a merge option on scan command |
There is one slight problem. If the key exists, it overrides the translation. So if the translation has been changed at POEditor, it will be changed backed to default value in the json file. |
Its expected behavior, POEditor always have priority, if you choose to do an upload/download. |
Then the translated string from POEditor is overwritten by the string from the code. |
But why do you need the base_language strings translated in PoEditor? |
First, they are only correct if the developer speaks correct english. |
Ok, i see, then it makes sense. |
In general i don't see why new translations should ever overwrite the ones already in the translation files. |
Try version 1.0.5 it only add new keys when using the --merge option |
Hi @kasperhartwich have you looked at the new version and does it fix your merge issues? |
Feel free to reopen if there is anything else. |
When importing it perfectly scan the application, but it does not import the already existing translations in /resources/lang/en. Maybe it should?
The text was updated successfully, but these errors were encountered: