Open cachapa opened 1 year ago
I am not sure how is the experience that you have when using the tool provided by Flutter, you have to run a command and then it generates the files when it detects a change?
If you are using VSCode, you can use an extension called File Watcher
, which will run a command whenever a file that matches the pattern changes. Here is an example configuration of the .vscode/settings.json
to automatically generate the files when any arb file changes:
{
"filewatcher.commands": [
{
"match": ".+\\.arb",
"cmd": "land --path ${workspaceRoot}",
"event": "onFileChange"
}
]
}
Tools like fswatch
, entr
, and watchman
seem to be able to achieve the same, but I haven't used them yet, not sure how to configure. And I think you would need to remember to run them whenever you start working, which is not the case with File Watcher
extension.
Hopefully this information is able to help you. Let me know if you have any questions.
Unfortunately I use Jetbrains Idea, but I'll check if a similar plugin exists for it.
I am not sure how is the experience that you have when using the tool provided by Flutter, you have to run a command and then it generates the files when it detects a change?
That's the nice part, there's no need to run commands, it detects changes to the .arb files and auto-generates.
Moreover, it also runs on pub get/upgrade. There may be other triggers that I'm not aware of, but the end result is that you never have to run anything manually - in fact I wouldn't even know what to run.
I'm very curious to find out how they did it, since running custom actions on specific triggers would be very useful for other things as well.
It is probably handled by GenerateLocalizationsTarget which is integrated into various flutter commands. I will take closer look at this target system and see if it is extensible.
It looks like the flutter build system is not extensible to allow this. There is an open discussion on the flutter repository concerning the issue https://github.com/flutter/flutter/issues/25377.
From Dec 2018, not a great sign.
In any case thank you for investigating this, even if it looks like all we can do is wait.
Sorry if this is already possible but I missed it in the docs.
One of the best parts of the Flutter localization is that it autogenerates whenever the .arb files change.
I think this is configured in the
generate: true
flag inpubspec.yaml
, which this project's README explicitly recommends removing.Is there a way to activate it somehow? If Flutter can do it, so too should this project.
Excellent package by the way!