Skip to content

Tool for moving .cshtml text literals to .resx resource file

License

Notifications You must be signed in to change notification settings

Ark667/Resxtractor

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Resxtractor

Simple .Net5 application for moving text literals to resource file.
Explore the docs »
Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact

About The Project

The project starts with the idea of helping to internationalize a Web application. All the hardcoded literals must be placed in a resource file, and all this work could be made easily by a tool.

In the context fo Visual Studio and .Net way of making this internatinalization process, this tool automatically extract text literals from cshtml files to a resource resx file. A Razor reference will be written in place, referencing the value on the resource file.

(back to top)

Built With

(back to top)

Getting Started

You can execute current release with Docker.

docker run --rm -v "$($PWD):/home" ghcr.io/ark667/resxtractor:master `
    -s ../home/[relative_path_to_cshtmls] `
    -t ../home/[relative_path_to_resx] `

You can also clone the repo and build it yourself.

  1. Clone the repo

    git clone https://github.com/Ark667/Resxtractor.git
    
  2. Build application

    dotnet build .\Resxtractor\Resxtractor.sln
    
  3. Execute help option

    .\Resxtractor\Resxtractor\bin\Debug\net5.0\Resxtractor.exe --help
    

(back to top)

Usage

Basic usage is pretty straightforward. Just call with required paths. By default the tool will create new files with modifications, use -r argument to make replacements.

.\Resxtractor.exe `
    -s ../home/[relative_path_to_cshtmls] `
    -t ../home/[relative_path_to_resx] `

Can also be executed from Docker container. First build the image.

docker build -f ".\Resxtractor\Resxtractor\Dockerfile" .

Then execute from container. The mapped volume will allow the command to access local files to make the extractions.

docker run --rm -v "$($PWD):/home" ghcr.io/ark667/resxtractor:master `
    -s ../home/[relative_path_to_cshtmls] `
    -t ../home/[relative_path_to_resx] `

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Feel free to use the code in this repository as it is under MIT license. See LICENSE.txt for more information.

ko-fi

(back to top)

Contact

Aingeru Medrano - @AingeruBlack

Project Link: https://github.com/Ark667/Resxtractor

(back to top)