For making an existing site to multilingual, I follow globalization technique, I have created 3 resource files for different content like label & header text file, grid header text file etc... Now I have two keys in different resource files i.e Email and Message, at a third place I want to show both these keyword together i.e Email message. Do I need to create third key or I can concatenate already existing keys. Currently I am using below two codes
For showing directly on page:
HttpContext.GetGlobalResourceObject("ResourceLabelButton", "Email")
For showing as text of any control like Textbox, label:
Text ="<%$ Resources:ResourceContent, Email %>"
I can concatenate two resource string on .cs page but it will increase timeline, so please suggest so I can only change on .aspx pages.
Thanks in advance
ASP.NET tag attribute values that use <%$ Something: Something Else %> are of a special syntax called ASP.NET Expressions. Using them as attribute values are pretty much all-or-nothing; there's no way to add any code into the ASPX file to manipulate what those expressions evaluate to. You'll have to do this in the code-behind.
You should create a separate resource entry for "Email Message" instead of concatenating "Email" and "Message". To understand why, look at Spanish:
Simple concatenation gives you Correo electrónico Mensaje. This is wrong. The correct translation is:
Notice that in the translation, the order of "Email" and "Message" has been reversed, and a new word (de, which means "of") has been inserted between them.
On the other hand, look at the translations for "New Message" and "Last Message":
As you can see, there are complex rules that govern when to reverse the order of words and when to insert de. These rules, of course, are different in other languages.
So in general, you should never concatenate localized words or phrases to form a longer phrase.
Always provide a separate resource entry for every phrase.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With