Easily copy all localizable texts to resource files with LocMan - Localization Manager
What is LocMan - Localization Manager?
LocMan is a visual studio extension that aim to save time and effort for web developers who works on localization/globalization for web applications. What it does actually very simple; it search for all localizable texts in a project and copy them to resource files automatically.
Release hitory :
v0.1.0 beta1 - 01.01.2020
Release notes :
- Search for all localizable texts in the projects one by one
- Copy all localizable texts to resource files
- Set target cultures
- Built-in ModelBinding and Identity Errors
- Advanced search expressions (XPath and Regular)
- Multiple search queries
- Multiple search folders
- Multitasking support to seedup search and file creating
Install
Install from Visual Studio Market Place or directly from visual studio by searching for LocMan in the Mange Extensions window. After install it will take place under Extensions -> LocMan.
Search Expressions
LocMan has many built-in search expressions to help search for localizable texts. There is search expressions for Views and search expressions for backend. The views search expressions are XPath search queries, they depend on HtmlAgility Pack to search in Html nodes, and they are designed to search for "localize" tags in the views. See LocalizeTagHelper for more details.
However, new search queries can be added, so if you are using the default localization methods, not using LocalizeTagHelper or even if you are using custom localization tags, you are able to add your own search queries.
Mainely there are two types of search expressions in LocMan:
- XPath search expressions : depends on XPath search powered by HtmlAgility Pack to search in html nodes, and is recommended for searching in Views.
- Regular search expressions : depends on Regulat Expression search, and it is useful for backend search. See Regex Quick Reference for mroe details.
Anyhow, you are free to use it as you wish, and I will be glad if you can find and share better search expressions :)
How to use :
- Open Asp.Net Core solution
- From visual studio menu goto Extensions > LocMan - Localization Manager
- Select project from the dropdown. If no project is listed clck Refresh button to reload the projects list
- Goto Cultures tab and set target cultures
- Goto Search Folders tab and select search locations
- Goto Search Expressions tab and double click on each search expression in the list to enter edit mode, then update target resource by selecting the target resource file (.resx) or target resource type (.cs) for locaized texts., then click Update to save the edits.
- Goto Framework Messages and set Target Resource for Model Binding and Identity Errors if needed, then click Copy to copy the default framework messages to the resource files. All target resources can be the same or separate files.
- Goto Search, click Search button to start the search, then click Copy button to copy all texts to the specified resource files. A new resource file will be generated for each culture.
Settings :
All settings are saved automatically to json file named "locman.json" in the relevant project root. This makes it easy to share the localization settings across the team if necessary.
The json file can be edited manually as well, you may need to reload the project after manually editing.