A simple git hook-compatible dotnet tool to sort entries in RESX (Resource) files alphabetically by key. It helps maintain consistency in localization files, reduces merge conflicts in version control, and makes it easier to scan for missing translations.
- Pre-commit git hook support: supports automatic sorting via a git hook using dotnet tool.
- Alphabetical Sorting: Sorts RESX entries by key (name) in a case-insensitive manner.
- Preserves Comments and Metadata: Retains existing comments (
<comment>) and value types. - Command-Line Interface: Easy to integrate into build scripts or CI/CD pipelines.
- Supports Multiple Files: Sort one or more RESX files in a single run.
- .NET 9.
- Basic familiarity with command-line tools.
- Optionally: familiarity with git hooks/bash.
dotnet tool install --global ResxSorter --version 1.0.0
-
Clone this repository:
git clone https://github.com/Wosiu6/dotnet-resX-sorter.git cd dotnet-resX-sorter/src -
Build and install the tool:
dotnet build dotnet pack dotnet tool install --global --add-source ./nupkg ResxSorter
- Copy both git and setup folder to your git repo root
- Run the setup:
cd setup .\SetupGithook.ps1
If installed properly, the tool should automatically sort all .resx files you are trying to commit.
Alternatively, you could use it directly from the command line by running dotnet sortresx path/to/example.resx path/to/example1.resx...
- Resx files are not sorting:
dotnet tool restore --interactiveshould sort you out.
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.
- CySharp: