I'm having a strange behavior in my .aspx page. I'm internationalizing some pages, but as I want to keep only entities or value object in my resource I want to have a key-value like:
(pt-br)
CITY - Cidade
STATE - Estado
...
But when I list the entities, I want to put the " : " at end. Like:
<asp:Label ID="LabelCity" runat="server" Text="<%$ Resources:Localizacao, CITY %>:"></asp:Label>
But, if I put the " : " after the resource in text property, the page only shows " : ".
My simple solution is put after all definition of label, but I think this too wrong:
<asp:Label ID="LabelCity" runat="server" Text="<%$ Resources:Localizacao, CITY %>"></asp:Label>:
Suggestions?
Had the exact same problem and after some searching transformed this
<asp:Label ID="label" runat="server" Text="<%$ Resources: Resources, color %>" />:
to this:
<asp:Label ID="label" runat="server">
<%= Resources.Resources.color + ":"%>
</asp:Label>
You named this correctly: the concatenation. The problem is, Concatenation is one of the most serious (as in high severity) i18n defect. Instead of doing what you do, I would advise you to put whole strings (or in the worst case scenario strings with placeholders) into resource files, even you have to duplicate resources (these duplicated resources might be translated in different way depending on a context).
Let me give you an example: back when I was in L10n Team, we had a console with multiple pages, each page had a title which was "Something Policy", i.e. "Firewall Policy", "Antivirus and Antispyware Policy". Somebody thought it is a good idea to save some precious bits and simply concatenated the title together:
String title = Resources.getString("Firewall") + "<b>" + Resources.getString("Policy") + "</b>";
The only problem we had is correct Polish translation sounds like "Polityka zapory ogniowej", that is "Policy" comes first. In reality, we had it translated as "Zapora ogniowa Polityka" which is nowhere near the correct translation (notice that translation of "Firewall" should be genitive... Translator had no clue what he is translating, thus the translation. And it couldn't be fixed as we were unable to re-order the sentence.
The fix required externalizing the whole string, so actually all the good intentions of original developer went to pave the hell.
If you still reading this, please keep in mind, that all colons in French language must be preceded by space (that's just their rule). Re-using the same translations in order to build multiple sentences might disallow that...
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