My team and I took over a legacy project with only partially implemented i18n. Now we'd like to find all hardcoded strings in the project. Can you guys think of a regex, plugin (VS Code other other) or script/tool for this?
Interestingly, searching for this issue turns up mostly desktop programming languages.
You can use the VS Code extension i18n Ally: https://marketplace.visualstudio.com/items?itemName=Lokalise.i18n-ally
I'm also working on a text extraction project and this has made things a lot faster. If you highlight static/hardcoded text there is a shortcut action you can use that prompts you to create a corresponding key for the text and moves the text to your json file, speeds things up a lot. I created a keyboard shortcut for it like so:
{
"key": "shift+cmd+i",
"command": "i18n-ally.extract-text"
}
Back to your immediate question, the extension has a beta feature for detecting hardcoded strings that is pretty useful. One issue I have with it is I can't figure out yet if there's a way to stop it from detecting inline CSS strings; it would be nice to ignore all that.
Some of the features are experimental/in beta so I can't vouch for it being error proof, but so far it's been very useful for me. Hope that's helpful.
Related
I am new to JavaScript and wanted to set up my work environment. My problems might be basic or I look totally in the wrong direction so please advise me.
I am used to work with Sublime 3 and wanted to use it for writing JS code as well.
I spend half of a day on reserach for various autocomplete/support plugins for JavaScript but none of them seems to be working properly. Topics on subject are either outdated or misleading.
For example, none of them recognizes basic objects like:
document. or window.onload etc. (there is no autocompletion although it would be highlighted properly).
I tried:
JavaScript Enchancements and Completions - they don't work. I have read that there are some issues with running those two on Windows
Babel - doesn't have autcomplete
So in the end my question is: How do I set up Sublime and JavaScript or how can I get basic autocompletion in for JavaScript in Sublime 3?
Some suggestions
You can use JSHint
You can use Ternjs
You can use Emmet
You can use SublimeCodeIntel
You can use Zen Coding
Generate .sublime-completion file manually
Adding Snippets Custom/PackageControl/GitHub
Have you tried LSP? It works for both ST3 and ST4.
https://github.com/sublimelsp/LSP-typescript
My question is pretty straight forward.
I have multiple CSS and Javascript files in my project, and I'm 90% sure I have a lot of unused css elements that I haven't used. I know Dreamweaver has a lot of features that I've yet to use, and I know there are other IDE's that show you functions and variables that are unused.
Example:
in the Netbeans IDE, if I have a variable that I haven't used, at all, in any file, it underlines said variable, and tells me that It's unused.
Does Dreamweaver offer anything similar, or is there another program that I can use to do this?
Dreamweaver doesn't seem to have this functionality natively, but this thread on Adobe's forums mentions the firefox extension Dust-Me Selectors is mentioned there.
Is there a version of quickcheck that works for Javascript and that is well maintained? I have found several such as check.js and claire, but none of them seem to support shrinking of failing test cases, which has always struck me as the most useful part of the whole problem.
I'm creator of jsverify. I'll try constantly to make it better, bug reports and feature requests are welcomed.
There are also a list of other javascript generative testing libraries in a readme. So far I haven't found any other good alternative to the jsverify.
I recently released https://github.com/dubzzz/fast-check
I built it in order to answer several limitations I encountered in the existing quickcheck implementations in JavaScript.
It comes natively with a shrink feature which can shrink even combination of arbitraries (the frameworks I tried were failing on oneof like arbitraries).
It also can generate large objects and arrays.
By default it tends to try smaller values first in order to detect trivial edge cases while it covers all the possible inputs in next runs.
Lots of other features are on-going or already available :)
Cheers,
Nicolas
I wrote quick_check.js, which has a nice library of generators. Shrinking is not there yet, but is planned.
There seems to be a dearth of good quickcheck-like testing tools in javascript. However they are to be better supported in typed languages, and in fact you can write your tests in one of those languages if you wish.
To avoid dealing with runtime interop, I'd recommend going with a language which compiles to JS and runs on node.js (eg: Purescript with purescript-quickcheck), or a java-based language using the Nashorn engine provided in Java 8, for example ScalaCheck. You could even use ghcjs and the original flavor of the quickcheck library!
I am looking for way (preferably and online site) to a reverse Uglify of some javascript. The Website: http://jsbeautifier.org/ is great for minifed code, but it is does not do a great job for ugly stuff.
There is this awesome online tool, JSNice, that makes a great job of finding names to obfuscated variables.
We make even obfuscated JavaScript code readable.
We will rename variables and parameters to names that we learn from thousands of open source projects.
Furthermore, often we are also able to guess or infer type annotations.
Chrome dev tools ability to Pretty Print
All you need to do is to click the { } icon on the bottom toolbar to activate this feature. Of course, the names will still be obfuscated (depending on what program minfied the JavaScript in the first place), but you will at least be able to set break points and debug the code.
Source: Tip #2 in this archived article.
Depends on what options you used when you uglify your code. If you just remove the line breaks, then Chrome dev tools will be able to do a great work as sirinivas explained. But if you mangle the code, then there is no way you can get the exact previous code. (in uglifying var logngvariable = a + b; becomes var c=a+b;. there is no way a tool can figure out the previous name logngvariable )
On the otherhand if you want an un-uglified code you may not uglify it at the first place... :)
I have a PHP-script that outputs: ((5^2x^2)^2+3)/(sqrt(sqrt(81)))
I want it to be formatted properly like you would write it.
Where can I find a ASCII to MathML converter like this: http://www.equationsheet.com/asciitomathml.php That is OpenSource in PHP or JavaScript so that I can use it on my webpage to format the mathematical fraction? (Because this is done in PHP closed source, but I need something that I can implement on my own server.)
My scripts outputs the math as that, and I need it to be displayed properly
I really appriciate that you spend your time helping me! :)
I recommend you to use MathJax.
It is used by many forums and also by StackExchange Mathematics!
It supports all modern browsers (even Internet Explorer 6!)
Very simple, just upload MathJax to your server and include 2 CSS/JS files! Some weeks ago, I installed it on a MediaWiki installation and it was easy as installing XAMPP ;)
You might also look at my jqMath JavaScript library at http://mathscribe.com/author/jqmath.html - it's like MathJax, but simpler, smaller, and much faster. Unlike ASCIIMathML, jqMath will work in any browser back to IE6, and is also open source. If you know LaTeX and want its full power for very advanced mathematics, and don't mind if pages load slowly, then use MathJax. But for examples like yours, jqMath will be faster, and use a simpler syntax based directly on MathML and Unicode. In your example, you would need to input {(5^2x^2)^2+3}/√√81 to jqMath. You can try this out at the page I linked to above.