Resx strings can be technical debt

I’m working on a project that requires translation using .Net’s Resx capabilities. This project is 2 years old and counting and our duplication and disorganization of our Resx strings are very apparent. This is a form of Technical Debt and we realized that it is time to pay some of it off before we’re in too deep. I just spent the morning replacing all of our required validation message from 28 different flavors of “X must be selected”, “Y cannot be empty”, “You need to set an email address.", ”Z must be chosen”. These message are shown directly under the input field in the form, so context already gives is meaning.

All of these strings have been translated to several languages already. Each time a new language is added we have to pay someone to translate. This is real money that has to be spent. It also complicates the validation code and HTML bindings.

The solution for us was to identify these strings, put them in an Excel spreadsheet, then have a developer (me) use the immensely helpful Resx Manager extension to remove these one by one, update code to replace them with one string in our CommonStrings.resx. requiredFieldMessage = “This is a required field.”.

We lose some specificity, but gain a lot.

Lesson Learned

Remember to think about the debt you are incurring on all aspects of your project and have a plan to pay it off when it occurs. We could have had some naming standards earlier for our Resx keys, avoided this waste of translating and duplication, and simplified code and process.

Now I’m off to simplify all of our loading messages.

This article is part of the GWB Archives. Original Author: Aligned

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.