question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a way to edit ARB files (terms export, files synchronization)

See original GitHub issue

Is your feature request related to a problem? Please describe.

With new l10n approach the only thing to worry about is to update .arb files in l10n directory. It’s not ideal to edit the files manually and keep them in sync between various languages.

Describe the solution you’d like

As a user I would love to be able to:

  • have a quick action to export selected string to template arb file image
  • automatically sync the terms between all present files (e.g. after adding to template, there should be new entries for all the other languages with empty values)
  • add new arb file for desired language (e.g. by providing language code in prompt) that would automatically have all the entries present and empty
  • notify me about missing translation entries when opening arb files (e.g. as analyzer info messages)

Describe alternatives you’ve considered

Similar feature is possible with Flutter Intl VS Code extension but it’s tightly coupled with their localization system (e.g. generating custom localization delegate, sync with remote server).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
DanTupcommented, Jul 26, 2021

Sorry for the long delay with this. I discussed this with someone on the Dart team and agreed the place to do something like this would be in the analysis server, by having it know about these arb files and be able to produce edits to add strings to them.

I’ve raised an issue at https://github.com/dart-lang/sdk/issues/46722 with some details from this issue (feel free to add anything I missed) and will close this one in favour of that. It would be quite difficult to do directly here in the extension as it doesn’t have a good AST of the code (plus any solution here would only work for VS Code and not IntelliJ/Android Studio or any of the other LSP clients). Hope this makes sense!

1reaction
orestesgaolincommented, Feb 4, 2021

Does that do what you need? If so, perhaps it could be made easier to run from VS Code (at least if there’s a convention about paths etc.)?

No, it’s something different. This assumes that there’s a class containing intl-based entries like:

  String get appBarTitle {
    return Intl.message(
      'Sign Up',
      name: 'appBarTitle',
      desc: 'App bar title shown on Sign Up page',
    );
  }

However, with new l10n approach there’s no longer need to generate these manually, as it’s done by the flutter_localizations in the background (these localization files are generated in .dart-tool directory after pub get, and the source files are based on the l10n.yaml config file and arb files in specified directory).

What I would like to have can be shown in this video:

https://user-images.githubusercontent.com/16854239/106932265-d4fa1500-6717-11eb-8fe8-b88511fa36b7.mp4

This action would result in new entry added in arb file, triggering flutter_localizations to regenerate localization classes, and string being replaced by this new key.

I started to play around on my own with sample VS Code extension to do it, but it would be awesome to have official support to even further simplify the localization process.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found