Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

els-intl-addon

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

els-intl-addon - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

24

index.js

@@ -6,8 +6,17 @@ const flat = require("flat");

function isLocalizationHelperTranslataionName(focusPath) {
return (
function isLocalizationHelperTranslataionName(focusPath, type) {
let p = focusPath.parent;
if (!p) {
return false;
}
if (type === "script" && focusPath.node.type === "StringLiteral") {
let isMemberExp = p.type === 'CallExpression' && p.callee && p.callee.type === "MemberExpression";
let hasValidCallee = isMemberExp && p.callee.property && p.callee.property.type === 'Identifier' && p.callee.property.name === "t";
return hasValidCallee && p.arguments.indexOf(focusPath.node) === 0;
}
return type === "template" && (
focusPath.node.type === "StringLiteral" &&
(focusPath.parent.type === "MustacheStatement" ||
focusPath.parent.type === "SubExpression") &&
focusPath.parent.path.original === "t"
(p.type === "MustacheStatement" ||
p.type === "SubExpression") &&
p.path.original === "t"
);

@@ -90,6 +99,3 @@ }

) {
if (type !== "template") {
return results;
}
if (isLocalizationHelperTranslataionName(focusPath)) {
if (isLocalizationHelperTranslataionName(focusPath, type)) {
const items = getTranslations(_);

@@ -96,0 +102,0 @@ const val = focusPath.node.value.indexOf("ELSCompletionDummy");

{
"name": "els-intl-addon",
"version": "1.0.0",
"version": "1.0.1",
"description": "Ember Language Server intl extension",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -6,3 +6,4 @@ # els-intl-addon

Install this addon as `dev-dependency` inside your ember project.
Install this addon as `dev-dependency` inside your ember project
or download it and specify addon path in UELS settings.

@@ -22,2 +23,12 @@ ### NPM

## Usage
Try autocomplete for `{{t 'tanslation..'}}` inside templates.
Try autocomplete for `{{t 'tanslation..'}}` inside templates.
Try autocompleta for `this.intl.t("translation..')` inside scripts.
* You can write translation result and it will be replaced to path.
```js
'some.translation.path': 'Translation result'
```
```hbs
{{t 'Translati..'}} -> {{t 'some.translation.path'}}
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc