Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

86 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

resx-lint banner

NuGet Downloads CI MIT License

resx-lint is more than a localization checker β€” it is a complete .resx quality and productivity tool for .NET apps.

It validates your localization keys against both XAML and C#, catching missing, duplicate, orphaned, and untranslated entries before they reach production. That means fewer runtime surprises, cleaner resource files, and a much more reliable localization workflow.

What makes resx-lint stand out is its AI-powered translation workflow. When keys are missing or placeholders need to be filled, the built-in web UI can automatically translate them using AI providers (OpenAI, Anthropic, Azure, Google, DeepSeek, or custom endpoints), helping you localize entire resource sets in seconds instead of manually editing each string one by one.

Key Benefits

  • Validates .resx files against real application usage in XAML and C#
  • Detects missing, duplicate, orphaned, and untranslated keys
  • Suggests likely matches for typos and naming mistakes
  • Offers automatic translation with AI for missing or incomplete entries
  • Provides a fast, visual web UI editor for reviewing and applying changes
  • Integrates cleanly with CLI, CI, and MSBuild
  • Helps teams keep localization consistent across multiple languages and projects
  • Built for speed and confidence

Whether you are maintaining a single app or a large multilingual product, resx-lint helps you keep translation files clean, accurate, and up to date. You can audit, fix, preview, and translate from one place β€” with AI doing the heavy lifting when you need to move fast.


Features

πŸ” CLI Linter

  • Static analysis β€” scans {maui:Translate Key} in XAML and AppResources.Key in C#
  • Auto-fixes β€” removes duplicate keys, adds missing Designer.cs properties, backfills orphaned language entries
  • MSBuild-native errors β€” emits file(line): error TRANS001: ... for inline squiggles in VS/Rider
  • Similar key suggestions β€” suggests closest matches for typos
  • --what-if mode β€” preview every change without touching files
  • CI-friendly β€” --fail-on-warnings escalates warnings to errors

πŸ–₯️ Web UI Dashboard

  • Translation Matrix Editor β€” edit all language cells side-by-side in a virtual-scrolled grid
  • πŸ‡§πŸ‡· Language flags β€” locale-to-flag conversion (Regional Indicator Symbols)
  • Configurable base language β€” pick your source language (e.g. pt-BR) via searchable picker
  • Live missing count β€” header badges update in real time as you type
  • AI batch translate β€” translate missing/placeholder keys via OpenAI, Anthropic, Azure, Google, DeepSeek, or custom endpoints
  • Auto-fix preview & apply β€” see what changes before writing to disk
  • Project manager β€” save multiple projects, scan for .resx files, quick audit
  • Self-update β€” one-click dotnet tool update inside the UI
  • Sound effects β€” optional audio feedback on save, translate, and errors
  • Dark/Light theme β€” persistent toggle
  • πŸ”’ Keyboard shortcuts β€” Ctrl+1/2/3 views, Ctrl+Enter audit, Ctrl+S save, Ctrl+F search, Esc close modals
  • Export/Import Excel β€” spreadsheet round-trip for translation managers
  • Virtual scrolling β€” handles 10,000+ keys without freezing

Screenshots

TODO: Replace these placeholders with actual screenshots.

Projects Dashboard Translation Matrix
Projects dashboard with language flags Editor grid with language columns and flags
Lint Results AI Translation Config
Lint results with summary cards and language flags AI batch translate configuration modal

Installation

Global (local dev)

dotnet tool install --global ResxLint

Per-repo (recommended for teams and CI)

dotnet new tool-manifest
dotnet tool install ResxLint

New devs and CI agents just run:

dotnet tool restore

Usage

Interactive Mode

resx-lint

Shows a 3-second prompt:

  • Press W β†’ opens the Web UI at http://localhost:7950
  • Wait 3s β†’ auto-detects a .resx in the current directory and runs the CLI lint

CLI Lint

resx-lint --project-dir <dir> --resx-file <path> [options]
Option Description
--project-dir <dir> Root of the project (where .xaml and .cs files live)
--resx-file <path> Path to the base .resx file
--what-if Preview all changes without writing any files
--fail-on-warnings Treat TRANS006 and TRANS007 as fatal errors
--quiet Suppress βœ… OK and β„Ή INFO messages
--help Show help and exit

Web UI

resx-lint --serve

Or press W in interactive mode. Opens at http://localhost:7950.

Option Description
--port <port> Custom port (default: 7950)
--no-open Don't open browser automatically

Update Check

resx-lint --check-update

Or click the version badge in the Web UI header.


MSBuild Integration

Add this target to your .csproj to run validation on every build:

<Target Name="ValidateTranslationKeys" BeforeTargets="BeforeBuild">

  <!-- Friendly error if resx-lint is not installed -->
  <Exec Command="resx-lint --help"
        ConsoleToMSBuild="true"
        IgnoreExitCode="true"
        StandardOutputImportance="low"
        StandardErrorImportance="low">
    <Output TaskParameter="ExitCode" PropertyName="_ResxLintExitCode" />
  </Exec>
  <Error
    Condition="'$(_ResxLintExitCode)' == '9009' OR '$(_ResxLintExitCode)' == '127'"
    Text="resx-lint is not installed. Run: dotnet tool install --global ResxLint   |   Docs: https://github.com/CW-Software-Apps/resx-lint" />

  <!-- Run validation -->
  <Exec
    Command="resx-lint --project-dir &quot;$(MSBuildProjectDirectory)&quot; --resx-file &quot;$(MSBuildProjectDirectory)/Resources/AppResources.resx&quot;"
    ConsoleToMSBuild="true"
    IgnoreExitCode="false" />

</Target>

Linux / CI / Docker: Always use forward slashes in the --resx-file path. $(MSBuildProjectDirectory)/Resources/AppResources.resx works on both Windows and Linux.

If the tool is not installed, the build stops with a clear message instead of the cryptic exited with code 9009.

For strict mode, add --fail-on-warnings to the Exec command.


CI/CD Integration

GitHub Actions

- name: Validate translations
  run: resx-lint --project-dir . --resx-file Resources/AppResources.resx --fail-on-warnings

Docker / Coolify

RUN dotnet tool install --global ResxLint
ENV PATH="${PATH}:/root/.dotnet/tools"

COPY [".", "/src/app"]
RUN resx-lint --project-dir /src/app --resx-file /src/YourLibrary/Resources/AppResources.resx

RUN dotnet publish MyApp.csproj -f net10.0-android -c Release

Exit code 3 on fatal errors stops the Docker build, preventing broken deployments.


Diagnostic Codes

Code Severity Description Action
TRANS001 ❌ Fatal Key used in {maui:Translate Key} (XAML) not found in base .resx Fix manually
TRANS002 πŸ”§ Auto-fix Duplicate key found in a .resx file Extra occurrences removed
TRANS003 πŸ”§ Auto-fix Key in base .resx has no corresponding property in Designer.cs Property added automatically
TRANS004 ❌ Fatal Key accessed as AppResources.Key (C#) not found in base .resx Fix manually
TRANS005 πŸ”§ Auto-fix Key exists in a language file but not in the base .resx Added to base with [TRANSLATE] placeholder
TRANS006 ⚠️ Warning Key in base .resx has no translation in one or more language files Add translation or escalate with --fail-on-warnings
TRANS007 ⚠️ Warning Base .resx value is empty or a placeholder like [TRANSLATE] Translation pending

Fatal errors (TRANS001, TRANS004) stop the build immediately. Auto-fixes (TRANS002, TRANS003, TRANS005) modify files and return exit code 1 so MSBuild restarts the build to re-validate.


Exit Codes

Code Meaning
0 All OK β€” no issues found
1 Auto-fixes were applied β€” restart the build to re-validate
2 Invalid parameters
3 Fatal errors found (TRANS001 or TRANS004)

Output Sample

═══ 4/6 Validating XAML usage ({maui:Translate}) ═══

Views/HomePage.xaml(42) : error TRANS001 : Translation key 'WelcomeTitel' not found in AppResources.resx. Similar keys: 'WelcomeTitle'.

──────────────────────────────────────────────────────────────
 SUMMARY β€” resx-lint
──────────────────────────────────────────────────────────────
  .resx base          : Resources\AppResources.resx
  Keys in base        : 312
  Languages           : 2  (AppResources.en-US.resx, AppResources.es-ES.resx)
  Auto-fixes applied  : 0
  Warnings            : 0
  Fatal errors        : 1
──────────────────────────────────────────────────────────────

  βœ– Build cancelled: 1 fatal error(s). Fix the missing keys and rebuild.

Requirements

  • .NET 10 SDK or later

License

MIT Β© CW Software

About

Complete .resx localization quality tool for .NET - validates keys against XAML and C#, auto-fixes duplicates, AI-powered translation, web UI editor, MSBuild integration.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages