PhpStorm - search for translatable strings through the project - phpstorm

Is it possible to easily search for all translatable strings in the Angular project in PhpStorm? PhpStorm knows what those strings are as they're marked with a different color, so it must be searchable in some way.
Maybe some devilish regex in Find in Files popup?

Related

GeSHI new language

I running a mediawiki and want to use syntax highlighting. I am using the extension https://www.mediawiki.org/wiki/Extension:SyntaxHighlight for that.
That works pretty fine.
Alas I want to highlight a language that is not part of this extension. So I wrote an python egg to extend pygments so it can parse my language (using entry points). This works fine.
Now I am struggling to get both to work together. How do I tell the GeShi Extension of MediaWiki to use my pygments extension? What do I have to do, so that using <syntaxhighlight lang="myLanguage"> will result in using my language lexer and style?
The solution was quite simple. One has to edit the file SyntaxHighlight_GeSHi.lexers.php and add the lexer.
It's important to use only lowercase for the lexer name, otherwise the extension will not find the lexer.

Sublime search, where filter expression - AND(?) instead of OR(,)

I'm trying to figure out how to search within files containing only a certain extension and within a certain directory. I've tried */app/*,*.jade, but that seems to search for anything within the app directory OR in any other directory given its extension is .jade. I just need a method to filter for files that satisfy both conditions. I feel like the obvious solution would simply be an AND character in place of the comma (which seems to act as an OR), but I'm not sure if the syntax incorporates such a feature. Anyone know if it does, or can offer an alternative solution for my use case? Thanks.
You are indeed correct that the Find in Files functionality allows you to provide a comma separated list of search terms and they are effectively an OR operation.
Note that you can also prefix a term with - to make it mean BUT NOT, which you can use to filter results out.
In order to find only files of a certain extension AND in a certain path, you need to create a search term that includes both of them at the same time:
*/app/*.jade

Managing strings and constants in a web app

We have a pretty large React-Redux based web app. In the app - and specifically in the UI - we have a lot of strings and constants (URL, name of app, button labels etc...). What's a recommended way of managing those strings and constants, considering the following requirements:
We have a lot of on premise installations and we want to be able to easily change things like system name / link url / button names.
We want to easily be able to go over the language in the UI and modify it.
We want to be able to localize the app in multiple languages.
The obvious method is to have the strings scattered all over and utilize find-and-replace, but we are wondering if there is a better way to centralize string management.
You could route your scripts though a configuration file so that you have all of these in one place to modify them. This is common in most CMS systems, i.e. Wordpress, Opencart.
Google the term i18n and you should be able to find a heap of information on internationalisation.
Here is a simple class that I saw which might make it easier to understand how this might work out for you in your project.

How to edit built in command behavior

I want to edit find_under_expand (ctrl+d) to consider hyphenated words, as single words. So when I try to replace all instance of var a, it shouldn't match substrings of "a" in words like a-b, which it currently does.
I'm assuming find_under_expand wraps your current selection in regex boundaries like this: \ba\b
I need it to wrap in something like this: \b(?<!-)a(?!-)\b
Is the find_under_expand command's source available to edit? Or do I have to rewrite the whole thing? I'm not sure where to begin.
Sublime's commands are implemented in one of several ways: as macros, as plugins, and internally as part of the compiled program (probably as C++). The default macros and plugins can be found in the Packages/Default directory in ST2 (where Packages is the directory opened when selecting Preferences -> Browse Packages...), or zipped in the Installed Packages/Default.sublime-package file in ST3, extractable using #skuroda's excellent PackageResourceViewer plugin, available via Package Control. Macros have .sublime-macro extensions, while plugins are written in Python and have .py extensions.
I searched all through the Defaults package in ST3 (things are generally the same as in ST2), and was unable to find a macro or .py file that included the find_under_expand command, or FindUnderExpand, which is the convention when naming command classes in plugins. Therefore, I strongly suspect that this command is internal to Sublime, probably written in C++ and linked into the executable or in a .dll|.dylib|.so library.
So, it doesn't look like there's an existing file that you could easily modify to adjust for your negative lookahead/lookbehind patterns (I assume that's what those are, my regex is a bit rusty...). Instead, you'll have to implement your own plugin from scratch that reads the "word_separators" value in your settings file, which the current implementation of find_under_expand doesn't seem to be doing, judging from your previous question and my own testing. Theoretically, this shouldn't be too terribly difficult - you can just open up a quick panel where the user enters the pattern/regex to be searched for, and you can just iterate through the current view looking for matches and highlighting/selecting them.
Good luck!

How to set up Sublime language detecting?

I work with different frameworks, so I have several HTMLs in sublime:
HTML
HTML(Django)
HTML(Jinja2)
By default, Sublime opens all html files with HTML(Django). When I work with django it's fine. But in other cases it appears to be a headache. Do you know how to set up default language for the project?
I don't know much about the various HTML files, but if you have some way to identify different files, you could try ApplySyntax. If I recall, you can define functions to specify what file to use. I'm not sure what information is passed to the file, but perhaps there is something there to look at project settings or the file path.
I do not think you can specify syntax on a per project basis. You may want to look at the Modelines package, specifically
Non-Standard Options
For some common cases, no directly settable option exists (for
example, a setting to specify a syntax). For such cases, Sublime
Modelines provides non-standard accessors as a stop-gap solution.
x_syntax Packages/Foo/Foo.tmLanguage
Sets the syntax to the specified .tmLanguage file.