Comments (22)
Try release 1.0.4 it have a merge option on scan command
from laravel-translation.
Ok, i see, then it makes sense.
Will look into a solution to support this.
from laravel-translation.
Thx for your comment.
The issue is there is no option at the moment to separate json translations from system translations in the poeditor interface.
I have some options to try out, but if you have a suggestion you are more than welcome to discuss it here.
from laravel-translation.
Maybe a seperate command to import the php files to the json files could be an idea.
It should be possible to import the files by using laravels Loader.
from laravel-translation.
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());
from laravel-translation.
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 /resources/lang/en/auth.php
from:
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
to:
'throttle' => __('too many login attempts. Please try again in :seconds seconds'),
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.
from laravel-translation.
Ohh.. Is that why it removes the translations i imported, when doing a new scan?
from laravel-translation.
Good question, do you mean in POEditor or in Laravel project?
A new scan creates a new base_language
file and that is was is getting uploaded.
from laravel-translation.
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.
from laravel-translation.
Good idea, will look into that.
from laravel-translation.
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.
from laravel-translation.
You always have to do a scan for translations then the file will always be updated.
If I do a merge, old keys will be keept and never cleaned up. It will also fill up in POEditor.
We only use translation scan on master branch before deploying.
from laravel-translation.
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.
from laravel-translation.
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.
from laravel-translation.
Its expected behavior, POEditor always have priority, if you choose to do an upload/download.
Otherwise im misunderstand ;)
from laravel-translation.
- Scan and upload to POEditor
- Change string at POEditor.
- Download strings from POEditor.
- Scan and merge.
Then the translated string from POEditor is overwritten by the string from the code.
from laravel-translation.
But why do you need the base_language strings translated in PoEditor?
They are by default correct from the code? or are you using this format group.text
instead of full strings like Your pasword is incorrect
?
from laravel-translation.
First, they are only correct if the developer speaks correct english.
Secondly, for this project; yes i am using keys and not sentences to pass to the POEditor, so here they are called f.ex 'auth.password.incorrect' like laravel default behaviour.
from laravel-translation.
In general i don't see why new translations should ever overwrite the ones already in the translation files.
from laravel-translation.
Try version 1.0.5 it only add new keys when using the --merge option
from laravel-translation.
Hi @kasperhartwich have you looked at the new version and does it fix your merge issues?
from laravel-translation.
Feel free to reopen if there is anything else.
from laravel-translation.
Related Issues (13)
- Follow symlinks; allow whitespace chars in the scan command
- `translation:download` command is trimming all translations HOT 2
- Escaped slashes HOT 5
- Installation on Laravel 9 conflict (symfony/finder v6.0.3) HOT 1
- Coding and capturing long / multi-line strings
- Comma doesn't work HOT 3
- translation:upload command overwrites translations with --scan option HOT 4
- vue-i18n translation function $t() not scanning HOT 3
- It will be very helpfull if user can manually add extra files(or directories) to scan. HOT 4
- Translations with an quotes HOT 1
- Q: trim() expects parameter 1 to be string, array given - Key/Value trim error? HOT 6
- Possibility to add terms rather than syncing them HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-translation.