Skip to content
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

Extracting main functionality in an npm package #56

Open
goodsign opened this issue Apr 22, 2020 · 2 comments
Open

Extracting main functionality in an npm package #56

goodsign opened this issue Apr 22, 2020 · 2 comments

Comments

@goodsign
Copy link

goodsign commented Apr 22, 2020

Hello @esskar ,

First, I'd like to thank you for your amazing plugin which we are now using in our production app. I found the "official" way with ARBs and this ton of autogenerated files too clumsy, while the JSON + this plugin makes our life a breeze.

My only concern was that currently it's kind of encapsulated only as a VS Code plugin, so there is no way to use it in other editors + as part of any script too.

Are you open for discussion of extracting the main logic to an npm package "as-is" and making the VSCode plugin just call these functions?

Thank you very much!

@goodsign
Copy link
Author

goodsign commented Apr 22, 2020

I practically was able to build a test "CLI" version of the generator very easily by just replacing all the ua.prompt calls to explicit function parameters. And it worked out of the box (npm run compile, npm run try-it in my fork), I tested it on our localizations json files and it converted them successfully.

I of course know that this is a very hacky solution right now, but I was just playing with it to understand the complexity of the task and how hard it potentially might be to do so. Looks like the code is pretty easily decoupled.

@gnudles
Copy link

gnudles commented Feb 1, 2021

If it helps, I wrote an alternative dart code generator in dart. it takes the json files that were created with this vs code plugin and generate the dart code.
https://github.com/gnudles/dart_i18n_generator
add it to dev dependencies in pubspec.yaml and generate i18n.dart by running the command
flutter pub run i18n_json:i18n_json
I would be glad if others would try it and contribute to it, to make a pure dart cli interface

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants