Hi,

I think I may have been over thinking this issue. Now that I had a bit
of sleep and my brain is firing on all four hamsters again, I think
there may be an easier solution to this.

Since my case was a bit different where I was dealing with a lot of
unknowns you may be able to simplify things here. With my initial
suggestion you would probably store your terms in an array or
something, but instead use an object and use the key/values to swap
terms. Eg. replace the object value with it's key when doing your
string replace.

var terms={
 'T01':'Term 1',
 'T02':'Term 2',
 'T03':'Term 3',
 'T04':'Term 4'
};

So "Term 1" would be replaced with "T01" and this "should" not get
translated, or you can use an underscore or some other identifier for
your pattern matching in reverse (in your callback).

I can probably whip up a demo page when I get to work but I think you
get the idea. Or just post back again and I can try to further clarify
or something.

Hope that helps :)

Cheers!
Vision Jinx


On Jul 29, 7:14 am, DaveSawers <[email protected]> wrote:
> I'm going to try the html tag enclosing route today and see where that
> goes as I think it should be simpler and more flexible than your
> escaping suggestion.  However, I would like to hear more about your
> suggestion if you could post here or e-mail me.
>
> In the generated primary language, I plan to enclose bits that aren't
> to be translated in a span tag with a specific class.  For example,
> the phrase:
>
> The refinery at Marseille will be running 10% west Texas sour crude
> for the month of August.
>
> Translates into French as:
>
> La raffinerie de Marseille se déroulera de 10% brut West Texas aigre
> pour le mois d'août.
>
> So putting in my span tag...
>
> The refinery at Marseille will be running 10% <span
> class="notranslate">west Texas sour</span> crude for the month of
> August.
>
> Translates as:
>
> La raffinerie de Marseille se déroulera de 10% <span
> class="notranslate"> ouest Texas sour </ span> brut pour le mois
> d'août.
>
> And the notranslate section can easily be put back to the original and
> the span tag stripped out, to give:
>
> La raffinerie de Marseille se déroulera de 10% west Texas sour brut
> pour le mois d'août.
>
> Note however that the inclusion of the span tag affects the
> translation and the final result puts the word 'brut' in a different
> (and I think wrong) place to the sentence without tags.  I understand
> this is a known problem with Google translate, that is hopefully being
> worked on with some urgency.
>
> Another problem with the translation, as you also have noted, is the
> propensity of the translator to put in spaces where they should not
> be.  It also replaces the specific html code &nbsp; with a space which
> means that if you intend multiple spaces using several &nbsp;
> together, they get translated to multiple spaces which then render in
> the browser as a single space.  This should be simple enough to fix at
> the Google level.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-AJAX-Search-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to