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

Proposal: Integrate i18n-ally #1264

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

micahmo
Copy link
Member

@micahmo micahmo commented Apr 2, 2024

Pull Request Description

This PR is a proposal to incorporate (a fork of) the i18n-ally plugin for VS Code. The main motivation here is the plugin's ability to refactor straight from the code to the .arb file. For me, that is one of the biggest pain points when writing new code. You can see a neat demo below. It's smart enough to recognize if the string already exists and even search for similar ones. Otherwise, it will create a new entry and initiate the code gen. It doesn't sort or add metadata, but we can run still use arb_utils for that (as you can see in my demo). (Maybe in the future we could use something like Run on Save to do that part automatically too!)

Background: The original i18n-ally plugin actually seems to predate the built-in l10n-gen plugin and integrates better with the flutter_i18n project. However, this fork was created specifically to integrate well with gen-l10n, and seems to work very well! It is available on the VS Code extension store.

Note: This plugin is only for VS Code, so the settings.json wouldn't affect anyone using a different IDE, and I don't think it should even affect anyone running VS Code without this plugin.

Demo

You'll see in the demo that I have to add the null suppression operator. In a future update, I would like to add nullable-getter: false to l10n.yaml to avoid this behavior. Of course, per our style, we would prefer defining the localizations once and using l10n anyway. I may open a PR to their repo to support our style! Also keep in mind that the cool inline annotations only work with the full default style.

i18n-ally-demo.mp4

P.S. I also removed the empty dependency_overrides section from pubspec.yaml. While it never caused build issues, it did cause a persistent error for me in VS Code.

image

@hjiangsu
Copy link
Member

hjiangsu commented Apr 3, 2024

I think this sounds reasonable, seems like it would make localization a bit easier! Is this ready to be merged in?

@micahmo
Copy link
Member Author

micahmo commented Apr 3, 2024

Yes, this is good to go!

In addition, I did also open a PR in the i18n-ally repo. We'll see if it's accepted. 😊

ipcjs/i18n-ally#3

@hjiangsu
Copy link
Member

hjiangsu commented Apr 3, 2024

Sounds good!

@hjiangsu hjiangsu merged commit a040f2c into thunder-app:develop Apr 3, 2024
1 check passed
@micahmo micahmo deleted the proposal/i81n-ally branch April 3, 2024 14:28
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

Successfully merging this pull request may close these issues.

2 participants