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

Add full JSDoc context and types to translation global #196

Merged
merged 2 commits into from
Sep 17, 2023

Conversation

Duddino
Copy link
Member

@Duddino Duddino commented Sep 15, 2023

Abstract

Adds jsdoc typings so the ALERTS and translation objects correctly have the string typing.

Testing

  • Create a variable let test = translation.test
  • Check that your lsp gives the string type to the test variable

@JSKitty JSKitty assigned JSKitty and Duddino and unassigned JSKitty Sep 15, 2023
@JSKitty JSKitty added the Documentation Improvements or additions to documentation label Sep 15, 2023
@JSKitty
Copy link
Member

JSKitty commented Sep 15, 2023

Works well, although I think one way of vastly improving this, would be to somehow import all of the template/translation.js keys in some way that allows auto-completion of translation strings, since currently, using translations is extremely error-prone, there is no way to use them without back-and-forth checking translation.js.

i.e:
translation.change

Would auto-suggest/complete via IDE:
translation.changelogTitle

Otherwise though, this is a slight improvement and I'd be fine merging, but the above would be a huge productivity booster and error defense.

@JSKitty
Copy link
Member

JSKitty commented Sep 15, 2023

Done, that was easy, all translation keys (inherently strings) are in the scope now, I think this is a far superior improvement, shall I commit on top of this PR @Duddino?

image

@Duddino
Copy link
Member Author

Duddino commented Sep 15, 2023

shall I commit on top of this PR @Duddino?
That's fine, you could also create a new PR, up to you

@JSKitty JSKitty changed the title Minor translation jsdoc addition Add full JSDoc context and types to translation global Sep 15, 2023
@JSKitty JSKitty self-assigned this Sep 15, 2023
Copy link
Member

@JSKitty JSKitty left a comment

Choose a reason for hiding this comment

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

tACK 023ecad

@JSKitty JSKitty merged commit 62dbdb8 into master Sep 17, 2023
3 checks passed
@JSKitty JSKitty deleted the translation-jsdoc branch September 17, 2023 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Improvements or additions to documentation
Projects
Development

Successfully merging this pull request may close these issues.

2 participants