.NET Resource String Separation

Status
Not open for further replies.
Greetings one and all,

This is more a fishing expedition than a plea for help or anything like that. I (and our entire team) is sick of our current system when it comes to user-facing string approval. This system has been some variation of the following:

1) We (development) put in some string that we think is decent at conveying the intended message (the text in a message box saying "Error encountered when attempting X")
2) Dev lead takes strings to the business group and hash out suggested strings with assistance of tech writing group
3) Dev/tech writing takes suggested strings to The Powers That Be using spreadsheet/sharepoint site with screenshots to give context
4) Wait...
5) The Powers That Be approve final versions of each string
6) Dev uses spreadsheet/sharepoint site to track each and every string and dev hands off to test department once implemented
7) QA finds issues in #6 (repeat)

We are a .NET shop and our strings are always stored in RESX files, but what we'd really like to do is give the power to change the actual strings used by our application to senior management or tech writing so that when they decide on what the final strings are, they can just change them and we don't have to worry about it. I'm envisioning some sort of RESX import/export tool.

Does anbody else struggle with this? Are we doing this completely wrong? Any suggested alternatives?

Thanks,
Sven
 

david_a

Ars Scholae Palatinae
819
Subscriptor++
We have built various RESX tools, mainly for translation vendors to deal with. A fairly simple but useful one is to show all resource files in a spreadsheet-like fashion - one column for the keys, one column for every translation. Adding editing capability to this isn't too hard.

We also have the concept of "Engineering English" versus "User English" - two totally separate resource files. Engineering English is only seen by developers, User English is the formal text. There are various bureaucratic reasons why this makes a lot of sense for us; maybe it would help you as well.
 
david_a":1v9jyvee said:
We also have the concept of "Engineering English" versus "User English" - two totally separate resource files. Engineering English is only seen by developers, User English is the formal text. There are various bureaucratic reasons why this makes a lot of sense for us; maybe it would help you as well.

Your engineering vs user english concept is intriguing, how does that work for your projects? Do you conditionally load from one resource file or another?
 

david_a

Ars Scholae Palatinae
819
Subscriptor++
I'm not sure what you mean by conditionally load... It works just like any other language; we have en-US (User English), de-DE, etc, and a special en-XX for Engineering English (you can make up whatever you want for the region name). In development the language is always set to en-XX, but the installer won't let a normal user install the app in that language.
 

warrens

Ars Legatus Legionis
11,415
What we do is have aseries of RESX files, which contain completed/approved translations. Any resource that isn't approved is stored in the RESX file as "%%%%%%". When that string is found, we look up the translation in a database instead. That database is front-ended by an ASPX page that lets the translators log in and write the correct translations. Then they get approved by someone else. Then, every so often we move approved translations from the database back to the RESX files, as it's obviously a lot faster than doing a database lookup every time you need a string.

One advantage of this approach (in contrast with using an Excel sheet) is that we can keep track of the amount of time the translators spend, and the number of words they enter. That way if there's any disagreement over billing, we can produce an audit trail that says, "hey, your translator was logged in from IP address x, from 1:14pm to 2:44pm and did 80 translations totalling 752 words."

Another advantage is that developers don't need to get involved in order to test the application with new translations. It happens in real-time.


In order to integrate this cleanly with an ASP.NET application, I cooked up a custom expression builder that is used instead of the standard <%$ Resource:x,y %> lookup method. That way, our custom resource lookup logic (which sits alongside the resource files in a separate assembly) is used instead. It looks pretty much exactly the same: <%$ Text:x,y %>.
 
We have an Excel spreadsheet that stores the resources and a vaguely user-friendly parameter list, so the product people can type in the column field "DateRangeCheck" and in its associated value field "Please enter a date between {startDate} and {endDate}."
This gets slurped out and transformed into RESX+designer files that expose either properties (if there's no parameters) or methods with named parameters (the above would be string "DateRangeCheck(string startDate, string endDate)").
Kind of convoluted but works better than I expected.
 

TheJet

Ars Praefectus
4,598
Subscriptor++
We just setup a small 'resource maintenance' app that the business users use to maintain the resource strings, then suck the strings out of the database as part of the build process to store in the application. During development, the developers can choose to use the database as the resource store or use local resource files [which we pull on occasion and check in]. The database based resources tend to cause some performance overhead, so we found that for most uses, the 'occasionally updated' resx files worked better. We didn't think of adding a strongly typed designer file with routines, that sounds like an interesting concept if it could be reasonably organized...

EDIT: I should mention that we key all our resources by URN, so the various screens have fixed URNs for each message that serves as our key into the resource store and provides a reasonable level of organization. So as new URNs are added, the developer is responsible for updating the main resource database to add the URN with the default, unapproved text.
 

ShuggyCoUk

Ars Legatus Legionis
10,387
Subscriptor++
You don't actually do database calls for resources in a desktop app, right?

I see no reason not to so long as the behaviour on there being no database is either 'exit - the rest of the app won't work anyway' or degrade gracefully (perhaps to the last cached state from the database).

This is massive overkill unless you need *really* serious flexibility plus the ability to push out changes without the 'push' (which likely means you want to rewrite as an internal web app anyway but this provides a transition).

I'm thinking cases where you have legal T&C's which need well defined alteration points, coupled with verifiability of what were read to the customer.

Also doing this via a local database (so you can share it between apps, roll out changes to it independent of the app itself etc) sounds fine too.
 

warrens

Ars Legatus Legionis
11,415
TheJet":smj7qjik said:
david_a":smj7qjik said:
I'm guessing some of you are talking about web versus desktop apps. You don't actually do database calls for resources in a desktop app, right?

In development, sometimes yes, in production, no in both cases.

Same -- this is a development & test tool. The ability to get resources from a database remains in our production code, but it's never called because 100% of the completed translations are in the RESX files, and there is no production build for a given language without 100% complete translations.
 
Status
Not open for further replies.