-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
Implement web-types (JetBrains) for the i18n-t component #874
Labels
🍰 p2-nice-to-have
Priority 2: nothing is broken but it's worth addressing
Status: PR Welcome
Welcome to Pull Request
Status: Proposal
Request for comments
Comments
@santiagoarizti I think your suggestion is great because it can support for JetBrains to handle it without having to modify vue-i18n-next. PR will be welcome 😃 |
kazupon
added
the
🍰 p2-nice-to-have
Priority 2: nothing is broken but it's worth addressing
label
Nov 15, 2022
— with
Volta.net
This is a more complete definition for the i18n-t component. The others should be added. {
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
"framework": "vue",
"name": "vue-i18n",
"version": "9.1.9",
"contributions": {
"html": {
"types-syntax": "typescript",
"description-markup": "markdown",
"tags": [
{
"name": "I18nT",
"description": "built-in component from vue-i18n",
"doc-url": "https://vue-i18n.intlify.dev/",
"attributes": [
{
"name": "plural",
"description": "Determines if use count 0, 1 or many",
"default": "0",
"value": {
"kind": "expression",
"type": ["string", "number"]
}
},
{
"name": "keypath",
"description": "The ident of the lang to be used",
"default": "'santi'",
"value": {
"kind": "expression",
"type": "string"
}
},
{
"name": "tag",
"description": "The tag into which to render the result",
"default": "span",
"value": {
"kind": "expression",
"type": "string"
}
},
{
"name": "locale",
"description": "The locale to use",
"default": "en",
"value": {
"kind": "expression",
"type": "string"
}
},
{
"name": "scope",
"description": "The component scope",
"default": "parent",
"value": {
"kind": "expression",
"type": "string"
}
},
{
"name": "i18n",
"description": "The i18n instance",
"default": "null",
"value": {
"kind": "expression",
"type": "string"
}
}
],
"slots": [
{
"name": "<name>",
"pattern": {
"items": "argument",
"template": [
"#item:argument"
]
},
"argument": {
"name": "Argument",
"pattern": {
"regex": ".+"
},
"doc-hide-pattern": true
},
"description": "Slot to provide a named value",
"doc-url": "https://vue-i18n.intlify.dev/guide/advanced/component.html#slots-syntax-usage"
}
]
}
]
}
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
🍰 p2-nice-to-have
Priority 2: nothing is broken but it's worth addressing
Status: PR Welcome
Welcome to Pull Request
Status: Proposal
Request for comments
Clear and concise description of the problem
I use phpstorm as my IDE, and it helps detect missing html tags and/or vue components in vue SFCs.
Problem is, phpstorm (or webstorm) doesn't recognize the tag
<i18n-t keypath="...">...
.See discussion here that I started to find a solution to this problem:
#872
See jetbrains official documentation:
https://github.com/JetBrains/web-types
Suggested solution
In order to have autocomplete, we need to implement this simple feature in the
package.json
of the npm packageand in the
web-types.json
file this is a sample content that will take care of the<i18n-t>
tag:Obviously this schema is fine for my own project, I would clean the descriptions and perhaps add more features as described in the official documentation.
But this does the job fine and is a very straightforward solution.
Alternative
An alternative would be to allow to import the
<i18n-t>
componentfrom 'vue-i18n';
which in theory would allow the IDE to find the definition of the component as well. This would work for more IDEs, but would require more lines of code.See example
Additional context
This is the working solution in my local development environment
I recommend to add this to the npm package so that everyone can get good linting in phpstorm or any other jetbrains IDE
Validations
The text was updated successfully, but these errors were encountered: