Polyglot  Template 7.0

Polyglot Template  for Clarion 5-10... ABC/Legacy. This is a white box translator template which lets you adapt your program to a new market in a blink of an eye.

Let's say you wrote a program designed for a "Children's Literacy Center" and sold it successfully in America. Then you realise that there are a lot of such centres in the UK and Australia, and that they are ready to pay $$$$ for your program. So you're ready to go, but there's a problem: they call Center - Centre, Children - Kids, and one Child - a Kid. And even the centers there have strange names: "Centre for Kids' Literacy". Naturally, those 3 words are scattered all over your program. But because Polyglot uses word-to-word, non-case sensitive translation you can easily replace them all in only a few minutes. A really great feature is that the three couples can be defined in any case: Center=Centre; children=kids; CHILD =KID (even CHiLd=kiD will do!). Simply recompile and you are done. The template also allows you to define them dynamically, so your clients can also translate whatever they want.

We designed this template with such scenarios as the one above in mind, but you can also use it as a full- scale translator, at least among "ASCII" languages.

Please point your cursor on the image to see translated <> original animation (all words with ® are t®anslated).

Feel free to try the template. Unlike the full version, the free trial version will only work in a stand alone EXE and only for the Help Tip Messages.

All translations are marked with ® to make them easily recognizable. Just move cursor in and out of this image to see original and translated window.
Why one more Translator?
The main problem with the Clarion native Translator (as with other 3rd party translators) is that it looks for an exact match 
for the entire control text, and this can be time-consuming and inconvenient. 
Say, for instance, that you need to replace word "Close" with "Exit". Because Translator is case sensitive and works on the entire 
control text you must cover all of possibilities: 
Close=Exit; &Close=&Exit; close=exit; &close=&exit; CLOSE=EXIT; &CLOSE=&EXIT; close:=exit: ; Close:=Exit: ; CLOSE:=EXIT:  and so forth.
Even space(s) in front are problematic. You'd need to add: " Close"=" Exit", "  Close"="  Exit" (one space in front, two, three...)
Besides this, you need to translate all of the sentences where this particular word is used: "Close Window"; "Close Application"; 
"Close Program"; "Close Report"...
The number of such pairs can increase dramatically. (It is not uncommon to have about 10,000 unique words/sentences in an average size application).
The polyglot template solves this issue by initiating word-to-word, non-case sensitive translation. 
So instead of all those endless pairs in the example above, you only need to define one couple Close=Exit.
And it doesn't matter how you do it. Any of these will work: Close=Exit; close=exit; CLOSE=EXIT or
even something completely crazy like cLoSE=eXiT. And this single pair will replace Close with Exit at any text of any control
in its proper case. You can do the maths yourself, but we find that this approach cuts down the number of pairs by at least a factor of 10.
A further advantage is that the Polyglot has a friendly visual interface. So you don't need to go through huge groups, count pairs and so on.
Instead, you just come to the one place (even in multi-dll application) and immediately see that "Kids" will be replaced with "Children", "Kid" with "Child".
And there's yet another advantage: In earlier Clarions, Translator class left things out, for instance column header groups. 
Polyglot works in all Clarion versions from 5 to 10 and also in future versions (up to Clarion 99!)
And last, but not least, unlike the Clarion native Translator, the Polyglot template is available in Legacy flavour as well!
Run the installation wizard. It will guide you through a few simple steps. That is it.
IMPORTANT: If you are using Clarion 5-6, after selecting Clarion5, Clarion6 directory wizard
will offer to install it into C:\Clarion5(6)\Clarion9 or C:\C55\Clarion9 directory respectively. 
So don't forget to remove the last \Clarion9. But even if you do - no problem.
Just uninstall the template and re-run the installation.
To start using the template you need to manually register it.
To do this: Open Clarion (no application must be open). 
Go to menu Tools (Setup) -> (Edit) Template Registry -> Register. 
Select new template polyglot.tpl and then hit the Open button.
You can find it in Clarion7(8,9,10...)\accessory\template\win
for Clarion 7-10++ and in Clarion*\Template - for all others.
You can also view our animated reminder on how to do this - Registering Template
(built with our JAVA Animated Help Builder).

Using the Template

Template usage is very straightforward.
Just open Global -> Extensions and insert the Polyglot Global template in all applications.
Then define translation couples in either the main definition DLL application (if you have multi-dll app) or
in the executable app itself (if it is stand alone executable).
This is what the active global extraction looks like (left) in the main definition DLL App, if it is multi-Dll app, or in the main EXE App if it is stand alone EXE.
In all other Apps those prompts are disabled (right) so it's just a reminder of what translation pairs it uses.
(We've appended  ASCII chat 174 ® to each new word to let you spot them easier, and also to demonstrate that you can use any ASCII char).
Here's a tip: If you have a dozen or so pairs you can easily accommodate them in the template prompt above.
But if you have more, or if you have different sets, say a Spanish set and a French set, you may want to do it differently.
The template keeps all of the pairs in a global queue it creates, allowing you to put your pairs directly there.
The template creates one embed point in the global embeds of the App immediately after the pairs get plugged into the queue. 
But you can do this anywhere before opening the first App window, typically before opening the main Frame.
If you decide to allow your customers to do translations, you'll need to use the latter method. Basically, you just let them define
their translation pairs and store them in a data or INI file. Then, before opening the Frame, you retrieve them 
and put them into the template queue. Voila!
The Queue has this layout:
We've employed Atomic string (don't worry: there's no radiation involved!) ASTRING on purpose so you 
never need to worry about the pair sizes. Up to 64k can be accommodated.
Thus to add Customer=Client pair, for instance, you would do this:
PLGT:TranFrom = 'Customer'
PLGT:TranTo = 'Client'
A further tip: You should try to use substitute words that are roughly the same size as the original word. 
If you define if=whether you may have a problem, because "whether" will not fit
in many places where "if" used to be. Besides this, "if" can also be a part of another word.
For example, terrific would become terrwhetheric...
And the final tip. To handle plural forms you generally don't have to do anything. If you have Scheme=Table as a pair, for example, the
template will automatically translate Schemes=Tables. But if you use simply House=Property you will get Houses=Propertys
So to fix this "spelling mistake" you need to define 2 pairs: Houses=Properties; House=Property (in this order!)
You can find the Demo in 
Clarion*\Examples\Polyglot\ in Clarions 5-6 
Or Clarion7(8,9,10...)\Lessons\Polyglot in Clarion 7-10...
You may like to see how the template is meant to be used, but since using it is so simple 
it's hardly likely you'll need to!
As we are eager to improve this template, any comments and/or suggestions you may have are most welcome: feedback
We'd also particularly like to know what other jobs you have found for it!


Copyright (C) 2015 Vivid Help Systems Pty Ltd