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.
But, as you can see the code below, it’s almost exactly the same (with a MUI twist).
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:
- Only 1 location to check the values, if one value must be changed a small effort is needed
- 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
- You don’t need a lot of time of refactoring
- Saves you a lot of time as well
In addition to all this, you can also use the SharePoint control for displaying text.
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.
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 🙂