Giter Site home page Giter Site logo

seveves / ngx-translate-zombies Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 1.0 10 KB

finds unused translation keys in your project

Home Page: https://marketplace.visualstudio.com/items?itemName=seveseves.ngx-translate-zombies

TypeScript 100.00%
angular ngx-translate vscode-extension

ngx-translate-zombies's Introduction

Hi there ๐Ÿ‘‹

ngx-translate-zombies's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sanjo91

ngx-translate-zombies's Issues

False positives on variables

Two use cases:

  1. When defining translation strings within enums
export enum GPSFieldType {
  LOCATION = 'LV.GPS_INFO.LOCATION',
  MANUAL_DEPTH = 'LV.GPS_INFO.MANUAL_DEPTH',
  ...
  ...
  ...
}

which we use to more easily access specific translations.
2. When defining translation strings within objects

        options: [
          {
            title: 'LV.SYSTEM_MAPPING.INTERNAL_GPS',
            value: NeedQPSQualityKey.InternalGPS,
          },
]

In both cases translations are marked as zombies

False positive for dynamically constructed keys

Hi there ๐Ÿ‘‹,

first of all: thanks for this project, really nice to find zombies so easily.

However I've ran into some false positives. I am sure this isn't an easy issue to solve, but wanted to report it nevertheless.

Example code snippets:

<p class="error">{{'LOGIN.ERROR.' + (loginCode | async) | translate}}</p>

(Where loginCode is a string from a selector.)

Another example:

	getFilterName(filter: WalksheetFilter) {
		const name = WalksheetFilterType[filter.type];
		return this.translate.instant(`WALKSHEET.ACTIONBAR.FILTER.${name}`);
	}

ngx-translate-zombies marks these keys (like LOGIN.ERROR.NOT_AUTHORIZED) as a zombie, but they are definitively used via the dynamic key construction.

Any ideas how to solve this?

getting a whole translation object can't be recognized

when getting a translation object with the TranslateService then you have access to its properties but this is not recognized by the extension and will be removed in the diff.

this.translateService.get('MANY.KEYS')
  .pipe(take(1))
  .subscribe(keys => {
     console.log(keys['MISSING']; // no zombie at all!
   });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.