Formatted static text: Spaces get lost

Hello,

a very nice feature of your addin is the creation of Literal controls from text that was directly entered into the page.

But if that text is formatted it is splitted into several Literal controls and the spaces in the text get lost.

Example:

Consider that your page contains the following text:

Das ist ein Test, ob Das Multilanguage-Addin auch <span class="style1"> formatierte</span> Texte die direkt in der Seite stehen bearbeitet.

After replacing that text with Literal controls you get the following:

<asp:Literal ID="ML_0004" runat="server" meta:resourcekey="ML_0004" Text="Das ist ein Test, ob Das Multilanguage-Addin auch"></asp:Literal> <span class="style1"> <asp:Literal ID="ML_0009" runat="server" meta:resourcekey="ML_0009" Text="formatierte"></asp:Literal></span> <asp:Literal ID="ML_0014" runat="server" meta:resourcekey="ML_0014" Text="Texte die direkt in der Seite stehen bearbeitet."></asp:Literal>

Note that for example the Literal control with the text "formatierte" does not contain the leading space!

Ciao,
Ralf

Germany

Hi Ralf,

I have several comments about this, but I havn't implemented the ultimate solution yet.

(1)
Are you seeing the effect in the Visual Studio design window, or in a browser. I could easily reproduce the error in the visual studio, but when I viewed the page in a browser, it inserted spaces and looked fine. If you experience the same behaviour, then it is not such a critical problem.

(2)
I have just made a change to the Add-In (version 4.60.0025) related to the Asp:Literal tag, but it doesn't actually fix this problem. I have changed the way the Asp:Literal tag is inserted, so that the original text is placed between the start and end tags, e.g.
<asp:Literal ID="ML_0006" runat="server" meta:resourcekey="ML_0006">formatierte</asp:Literal>
instead of
<asp:Literal ID="ML_0013" runat="server" meta:resourcekey="ML_0013" Text="formatierte"></asp:Literal>

This has the big advantage, that the text can include basic formatting tags, such as <b>.

(3)
There are fundamentally two ways to handle this situation:

  • Insert the spaces somewhere, either in the text, or between the tags (might have to be nbsp)
  • Move the formatting tag - in this case span - into the literal tag.


To make the second option clear, it would be like this:

<asp:Literal ID="ML_0019" runat="server" meta:resourcekey="ML_0019">Das ist ein Test, ob Das Multilanguage-Addin auch <span class="style1"> formatierte</span> Texte die direkt in der Seite stehen bearbeitet. </asp:Literal>

In either case, the biggest question is, how does it affect the work of the translator.

The second method presents the translator with a text containing some tags. In general, the translator won't understand what they are, which could be a real problem.

On the other hand, the second method presents the translator with a complete sentence. If he or she can see past the formatting tags, then the text is Das ist ein Test, ob Das Multilanguage-Addin auch formatierte Texte die direkt in der Seite stehen bearbeitet. This is something that can be translated.

The first method presents the translator with three separate texts:

  • Das ist ein Test, ob Das Multilanguage-Addin auch
  • formatierte
  • Texte die direkt in der Seite stehen bearbeitet.


Taken separately, texts like this may be untranslatable. If you take a sentence, break it into bits, translate the bits and then put them back together, there is no guarantee that the result is a coherent sentence.

As you can guess, in my opinion the second method is much better.

(4)
For simple formatting tags, such as <b>, the Add-In already leaves them in the text. This does not apply to the span tag, and I don't think it should.

Ideally, I would like a feature where you select all three texts in the grid and then select a command to place all three into one Asp:Literal tag. (Of course this would be an advanced feature, which only a few users would need or understand.)

(5)
Aside from all that, the method with spaces should also work.

I would prefer to insert the spaces into the ASP page, rather than into the text, for the simple reason that leading or trailing spaces will probably get lost in translation. (There is really no way that you can tell a translator that trailing spaces are important. It's just not their job!)

(6)
Until the Multi-Language Add-In provides the best possible solution, you can always modify the code by hand.

Phil


Hi Phil,

You are absolutely right, if the strings get splitted they are near to impossible to be translated by an external person.

I have installed the latest version that inserts the text between the Literal-tags one day after posting here.

Now, after testing the new way how your addin handles directly inserted text i must say that it is much better than before! The translator has to be told how to handle basic formatting like bold or italic but that is no big deal, i think.

Thanks for that (important) change!

Ciao,
Ralf