lokalise / i18n-ally

🌍 All in one i18n extension for VS Code
https://marketplace.visualstudio.com/items?itemName=lokalise.i18n-ally
MIT License
4.01k stars 324 forks source link

Inline Annotations Alias !!!! #1186

Open itmanyong opened 4 months ago

itmanyong commented 4 months ago

Is your feature related to a specific framework or general for this extension false

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

Describe the solution you'd like Provides a configuration item to configure multiple aliases to support inline annotation, such as inlineAlias

Additional context In many cases, to prevent duplicative names and semantic customization, inline comments will not take effect if $t and t are already used beforei18n-ally is connected, for example

// lang message
{ "app.title":"应用名称" }
// define file
app.config.globalProperties.tx = i18n.global.t
// other file template
tx('app.title')  => tx('app.title')  ✖

After configuration

// vscode i18n-ally settings 
{
...
"i18n-ally.inlineAlias":["tx"]
...
}
// so
tx('app.title') => tx(应用名称)  ✅
nadihsu commented 1 month ago

Maybe you can try configuring i18n-ally.regex.usageMatch to support your alias

"i18n-ally.regex.usageMatch": ["tx\\('([\\w.-]+)'\\)"]