Giter Site home page Giter Site logo

Comments (2)

FranciscoKnebel avatar FranciscoKnebel commented on June 6, 2024

Hey @michaelz, thanks for the kind words.
In regard to your question, yes, it indeed does not cover those use cases.

Translate pipe in another line would probably be possible to catch by just tweaking the regex a bit, but the translate service one is tougher and the most important, and on the project I used this we had no coverage to get these types of strings, unfortunately.
Perhaps checking also for lines that include "translateService" and extracting from there? (the translateService can be named anything, so would also add an option to change the service name it looks for).

If you have any suggestions, feel free to open a PR and I can review and update the package.

from ngx-translate-check.

michaelz avatar michaelz commented on June 6, 2024

I used the following regex to make it work :

/[0-Z_]{3,}(\.[0-Z_]{3,})*(\.(one|other))? (and then removing the matched.map...) but this would only work in my case because I have this specific key naming rule in my code, and I only had to check for unused translations, not missing ones...

This wouldn't really be a good candidate for changing this library's code.

For those interested, I just replaced this:

...const e=r.readFileSync(t,{encoding:"utf8"}).match(/({{)?( )(\'|\")((\w|\-)\.?)(\'|\")( )\|( )translate( )(}})?/g);let n=[];return e&&e.length>0&&(n=e.map((t=>t.match(/(\'|\")(.)?(\'|\")/)[2]))),n})(t).forEach((e=>{const n=Pn.get(e)...

with this

...const e=r.readFileSync(t,{encoding:"utf8"}).match(/[0-Z_]{3,}(\.[0-Z_]{3,})*(\.(one|other))?/g);let n=[];return e&&e.length>0&&(n=e.map((t=>t))),n})(t).forEach((e=>{const n=Pn.get(e);...

in the actual generated code (I know it's ugly...)

from ngx-translate-check.

Related Issues (2)

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.