Move hardcoded strrings to resource files in .cshtml documents.
Answered
In an asp.net core applicatoin I need to use the "Move to resource" tool to localize strings. The operation is available as a refacgtor when I select a hardcoded string in c# code, but it is not available in razor cshtml files.
Is there any way to enable this operaiton in cshtml files? I need to extract a lot of resources from cshtml files. The whole "refactor" tool seems to be off in cshtml files.
Thanks!
Please sign in to leave a comment.
Hello,
Could you please provide some screenshots and video demonstrating the issue with moving to resources in cshtml? Is there any chance you could provide a sample solution in which the problem is reproduced? You can share the information via "Submit a request" form or using our upload service.
Thank you.
Sure. I uploaded a video. You will see first how the Refactor>>Move menu is available when I select a hardcoded text in a c# class.
And then you will see how the Refactor Move operation is not available in a chunk of text of a razor page.
Upload id: 2022_09_28_XwJEmdqhvYVBP8bXVyYjEg (file: no refactor 2022-09-28_17-08-16.mp4)
Thank you for having a look into it,
Hell Dani,
thank you for the provided info.
Currently, "Move to resource" refactoring is not supported for html part of cshtml files, here's a corresponding feature request - https://youtrack.jetbrains.com/issue/RSRP-336719/. You are welcome to comment or vote for it.