Are you still developing old-skool? (pre-MUI series)

Yesterday I gave a presentation about Deep dive MUI and in my presentation I’ve asked some questions to the audience. One of those questions was: What if you only need 1 language?

First I’ll set the scene for this question so you’ll understand the purpose of the question.

MUI uses a lot of resources at certain locations, but in aspx code there are small differences in coding.

Most developers will write the code like below.

Asp with text Welcome

But, as you can see the code below, it’s almost exactly the same (with a MUI twist).

Asp with resources

In the second print screen I’m using a resources file named “RestaurantResource” and I’m asking for the value of the key “FormTitle”.

Now if I have “RestaurantResource.fr-FR.resx” and “RestaurantResource.nl-NL.resx” in that resource directory as well, than I will be given the Dutch or French text. Depending on the language selection of the user the value will be given in that language.

So this is all for MUI, but what if only 1 language is asked?

Isn’t it best to still write the second print screen instead of the first and to use resource files?

It offers some very nice benefits:

  1. Only 1 location to check the values, if one value must be changed a small effort is needed
  2. If the client asks if it is possible to have the same labels in multilingual… No problem, only add 2 resources files and all is done
  3. You don’t need a lot of time of refactoring
  4. Saves you a lot of time as well

In addition to all this, you can also use the SharePoint control for displaying text.

SharePoint:EncodedLiteral

This gives you the benefit if you client wants to add some HTML code to display the text, it’s possible without refactoring, if you display regular text than it’s no problem as well. But you are ready for any future changes in text value.

Resources

Of course this from my own point of view and making sure you are developing with the max coverage for future changes.

Tell me what your point of view is on this in the comments. Or if the message is too big, feel free to send me a mail 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *