Skip to content

Wosiu6/dotnet-resX-sorter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Resx Sorter

Paypal Buy me a coffee Nuget License GitHub

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.

Features

  • 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.

Prerequisites

  • .NET 9.
  • Basic familiarity with command-line tools.
  • Optionally: familiarity with git hooks/bash.

Installation

From NuGet

  1. dotnet tool install --global ResxSorter --version 1.0.0

From Source

  1. Clone this repository:

    git clone https://github.com/Wosiu6/dotnet-resX-sorter.git
    cd dotnet-resX-sorter/src
  2. Build and install the tool:

    dotnet build
    dotnet pack
    dotnet tool install --global --add-source ./nupkg ResxSorter

Git Hook Setup

  1. Copy both git and setup folder to your git repo root
  2. Run the setup:
    cd setup
    .\SetupGithook.ps1

Usage

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...

How to use dotnet tools

Troubleshooting

  1. Resx files are not sorting: dotnet tool restore --interactive should sort you out.

License

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.

Acknowledgments

About

git hook compatible cli tool for sorting resx files

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published