Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MultiLanguage Captions (and other stuff)
Message
From
18/07/2012 08:23:36
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01548737
Message ID:
01548768
Views:
114
This message has been marked as a message which has helped to the initial question of the thread.
>>You can create a regular caption and call your function in Label's init, e.g.
>>
>>this.caption = TranslateWord(this.caption)
>
>You are GENIUS !!! Thanks!!!

Only... I wouldn't put that in the .init(), because it happens only once. Want to change the language, close and reload... not too comfortable. Since the language change is something that happens across the whole app, it may be worthwhile to have a .decorate() method in each of your base classes that may display text (labels, checkboxes, combos, textboxes etc), and call that on all controls. It may not only translate (translation may apply only to those with a .caption), but also change .fontCharSet property, LTR/RTL, .dateformat, .DateMark etc.

When translating, you'll have a big problem if you're starting with english first, simply because the same word may translate several ways into other languages, or the same phrase may have a different order of words (and you want to merge that). Two simple examples:

- you have a button with .caption="Purchase" and a column header with the same. However, in the first case, it's a verb (commandbuttons generally represent action), and in the second it's a noun (what's in this column?). The verb and the noun are, in most languages, different words. You will need two or more entries in your dictionary table, and a way to know which record to use in each context. Perhaps have "purchase, v" translate into "Purchase" (english), "kupi" (serbian), "vasárolj" (hungarian), "покупи" (russian), and "purchase, n" translate into "Purchase" (english), "pazar" (serbian), "vasárolt" (hungarian), "покупка" (russian, if I got this one right). And mind you, this is for a commandbutton, where it means "do buy" - in a case of "what do you want to do: purchase/sell", it is not in imperative mode anymore, it's more of an infinitive, you need a "to purchase" record which translates into "Purchase","da kupim", "vasárolni", "покупитъ".

- you have a messagebox saying "could not find the"+ cFname+" file". I know at least two languages where the file name would not be in that place in the sentence (not to mention that "file" is again a verb and a noun and sometimes an adjective). The best solution I've found so far is to have a merged parameter, something like "could not find the % file", which then translates as "nem találhatom a %1 fajlt" (hungarian), "nisam našao fajl %1" (serbian), and you call the function with translate("could not find the % file", cFname).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform