Skip to content

Introduce localize2 function - #194750

Merged
TylerLeonhardt merged 3 commits into
mainfrom
tyler/domestic-emu
Oct 4, 2023
Merged

TylerLeonhardt merged 3 commits into
mainfrom
tyler/domestic-emu

Conversation

@TylerLeonhardt

@TylerLeonhardt TylerLeonhardt commented Oct 3, 2023 •

Copy link
Copy Markdown
Member

This is syntax sugar around:

{ value localize('id', "Hello"), original: 'Hello' }

That will now be returned when you do:

localize2('id', "Hello");

I tested this with a full build to ensure rewriting works as expected.

@alexdima Alexandru Dima (alexdima) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I would suggest to try it out with a full build before merging.

This is syntax sugar around:
```
{ value localize('id', "Hello"), original: 'Hello' }
```

That will now be returned when you do:
```
localize2('id', "Hello");
```
@connor4312

Connor Peet (connor4312) commented Oct 4, 2023 •

Copy link
Copy Markdown
Member

Maybe bikeshedding, but is "localize2" the right name for this? To me 2 implies a temporary name in a transitionary period until everyone is using the new one -- i.e. the non-2 version is deprecated. But ILocalizedString is only for use in certain areas like commands (or is it?)

@TylerLeonhardt

Copy link
Copy Markdown
Member Author

Connor mentioned localizeCommand and localizeLabel as alternatives. localizeCommand doesn't really work because ILocalizeString is used in View names as well.

And localizeLabel ehh I don't like it enough to change it... plus localize2 is not a lot of additional characters.

Also, I think we can make bigger changes to the API when we align core with extension's vscode.l10n.t().

@TylerLeonhardt
TylerLeonhardt enabled auto-merge (squash) October 4, 2023 19:44
@TylerLeonhardt
TylerLeonhardt merged commit a27dc77 into main Oct 4, 2023
@TylerLeonhardt
TylerLeonhardt deleted the tyler/domestic-emu branch October 4, 2023 19:57
Alex0007 pushed a commit to Alex0007/vscode that referenced this pull request Oct 26, 2023
* Introduce `localize2` function

This is syntax sugar around:
```
{ value localize('id', "Hello"), original: 'Hello' }
```

That will now be returned when you do:
```
localize2('id', "Hello");
```

* fix merge conflic

* new source map due to updated deps
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants