Does it work with .cshtml? #35
-
|
Somehow I probably missed the obvious. But just tried to extract some According to this it seems to be limited to parse Any pointer what it would take to support But for what i can "sense", |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
indeed, the extractor is currently limited to read plain cs files, as it uses Roslyn to build a syntax tree and identify string resources. Would need to see what it takes to read cshtml, but seems it would require to include the RazorTemplateEngine first to extract the code, which than could be parsed: It may sound counterproductive, but a short term solution may rather be the use of the legacy GNU GetText tool (https://www.gnu.org/software/gettext/manual/gettext.html#xgettext-Invocation) which just uses plain regex - however that doesn't support i.e. C# string interpolation ($"{}") I'll take a look but doubt to have a solution soon. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks a lot for the fast explanation.
That's where I started looking around. But you're right, it probably will be good enough to start with.
Not expecting that, but thank you so much for looking into that. Will setup a Windows VM to experiment around with that as well. |
Beta Was this translation helpful? Give feedback.
-
|
as recently discovered by someone through this PR #36, seems Roslyn is able to just load Razor and cshtml files for analysis we well! There is work in progress to get this change merged, so should be available shortly. Sorry for never really been testing this before but just following (obviously outdated) information/documentation... |
Beta Was this translation helpful? Give feedback.
indeed, the extractor is currently limited to read plain cs files, as it uses Roslyn to build a syntax tree and identify string resources. Would need to see what it takes to read cshtml, but seems it would require to include the RazorTemplateEngine first to extract the code, which than could be parsed:
https://stackoverflow.com/questions/28392086/getting-a-semanticmodel-of-a-cshtml-file
It may sound counterproductive, but a short term solution may rather be the use of the legacy GNU GetText tool (https://www.gnu.org/software/gettext/manual/gettext.html#xgettext-Invocation) which just uses plain regex - however that doesn't support i.e. C# string interpolation ($"{}")
I'll take a look but …