Using Language option


Recommended Posts

Hi,

I have started adding languages to my document using the '@' symbol in front of words and phrases and wondered how the character set for other languages is supported. Where there are national character sets within Windows is it necessary to switch code pages? If our agent in the foreign country builds the suggested CSV file with my phrase in the first column and his translation in the second column (probably he will have his national character set active on his computer) will his translations display correctly? I am thinking of the modified characters for some of the European countries where there are various accents and tilde added to the character and then in the more extreme case the Russian character set and ultimately Chinese, Japanese or Arabic etc.

Martin

Link to comment
Share on other sites

Hi,

The thread says there is a patch that will be included in the next release. I have V5.84 build 1636 whereas the thread starter had V5.79 build 1574 so does my version include the patch or not?

If the patch is included in my build then do I need the new DWORD value at HKEY_LOCAL_MACHINE/Software/DAQFactory/Control and if so which code page number should I enter for at least European characters as this should cover our Balkans agent and Iberia so probably South America as they tend to use Spanish and Portuguese characters. I suppose Cyrillic characters will have to wait unless there is a way to write a new code page number from script.

You point to Unicode support in V6.00 and of course the graphics update. I wouldn't want to deprive you of the odd crust of bread now and then but is there any sign of V6.00 on the horizon?

The last post in January this year implied that there may be some hardware problems in displaying the correct character set, any conclusions on this?

TIA

Martin

Link to comment
Share on other sites

Your version should have that feature.

V6.00 will likely be released in small steps instead of a large release. The graphics changes are a higher priority than unicode, but unicode is still important to us as a large number of customers are international. I don't have an exact timeline but the pressure is on now for us to make some progress.

Link to comment
Share on other sites

Hi,

Whilst messing about with the Language function I have managed to make duplicate entries in the language combo box of the language settings pop up so that it displays when expanded 'German', 'Serbian', 'Serbian', 'Polish', 'Spanish','German' etc. Each entry seems to have the same contents but I would like to delete the duplicates.The system function System.GetLanguageList returns an array with the duplicate entries so when I use it to populate my own combo box I get duplicates. There is a delete button to delete an individual selected phrase but (for safety?) there is no obvious way to delete a whole language entry. Any suggestions?

Martin

Link to comment
Share on other sites

Hi,

With the Code Page patch on my version (5.84 build 1636) Is there a way to change code pages from script? I have added the DWORD CodePages into the Registry.

Is there a way to set the words or abbreviations used for day names and month names in the FormatDateTime function and the graph component.

Thanks,

Martin

Link to comment
Share on other sites

Hi,

Whilst editing my Captions, Text Components and Units to have the "@" in front of each I came across a peculiarity!

I attempted to edit a text component contents from "Set Ash and Moisture" to "Set Ash & Moisture" so that any translation that was longer would have more space. Although the change shows correctly in the Text component edit window the " & " (ampersand with a space either side) displays as a single space followed by a faint underscore and no trailing space.

Any suggestions?

Martin

Link to comment
Share on other sites

You can't really change the code page from script. Even if you changed the registry (which you could probably do externally using shellExecute() and some external app), you'd have to restart DAQFactory for it to take effect.

FormatDateTime() can format your date any way you want. %c will use whatever the current system format is, or use other % codes to do it however you want. Its just a string, so you could, technically, make that a language phrase too! The graph component, however, is fixed.

As for &, that is a windows code for shortcut and some controls draw it that way. Try just doing &&

Link to comment
Share on other sites

Thanks for that a double ampersand works fine.

Is there any way I can delete my duplicated entries in the language combo box of the language settings pop up.

If I were to have additional columns, beyond the first two required ones in the .CSV file to import the translations would this upset the import? In order for our agent to do the translation effectively he needs to take account of the space available for the word or phrase and its context so I was going to include this in the file I send to him. If there is likely to be a problem with the import I will strip the additional data after he has completed the translation.

Thanks,

Martin

Link to comment
Share on other sites

OK, I'll have to go back to the version I had before I started on the language option. Is it possible to add this to the 'Wish List' for a later release?

Is there any way to get the correlation between space on screen and font point size? In order to do a translation our agent needs to know how many characters he can use for a particular phrase or word. Where I have for example 250 pixels between the left and right positions on screen, I have gleaned by experimentation that the 25 point Microsoft sans serif font needs between 9 and 12 pixels per character so that space will hold a maximum of about 20 characters. 30 point Arial seems to need about 13 pixels per character whilst 16 point Arial seems to need about 8 pixels per character. Some computer languages have a function to give the pixels for height or width for a particular character. For example the TextWidth and TextHeight functions in Borland Pascal.

Martin

Link to comment
Share on other sites

There isn't any easy way. There is a function in Windows that gets you the height and width of text, but it is a very expensive operation as it has to basically render the font in memory and see how big it ended up. DAQFactory doesn't expose this function to its users. It should also be noted that fonts render differently on different machines, so just because your development machine says that something will take 100 pixels wide, doesn't mean it will be 100 pixels wide on other machines. This happens all the time in browsers too. It is especially a problem when you use non-standard fonts (i.e. other than Arial, Verdana, Times New Roman and a few others). The problem is that if the user doesn't have the font you designed with, the system will substitute another font.

My recommendation is give ample room in your design...

Link to comment
Share on other sites

Hi,

In several places I use the FormatDateTime function to display the current system time using:

Display = FormatDateTime("%a %d %b %Y  %H:%M:%S", SysTime())

How do I change the default weekdays and month names to the chosen language?

Thanks,

Martin

Link to comment
Share on other sites

Can you explain how to do it with a look up table as I want the selection in the document so that selecting a language will change the weekday and month names. I will populate a combobox from the language list and set the required language from that so that can be the indicator as to which table to use. I don't want to mess about with the windows settings

Thanks,

Martin

Link to comment
Share on other sites

First, create an array of strings for weekday and month names. Use the standard language stuff, so, for example:

global weekdayNames = {"@Sun","@Mon","@Tue", etc....}

global monthNames = {"@Jan", "@Feb", etc....}

Then you can look it up simply by using formatdatetime() to return the current month or day of week and using that value to lookup the name:

monthNames[formatDateTime("%m",systime())]

weekdayNames[formatDateTime("%w",systime())]

For speed, you might consider using math for day of week. Jan 1st 1970 was a thursday, so you'd have to make your lookup table start on thursday, then is:

weekdayNames[systime() / 86400 % 7]

That will be quite a bit faster than formatDateTime() since its just simple math, but speed may not be an issue in your app.

Link to comment
Share on other sites

  • 2 weeks later...

I made the arrays as you suggest except I made them string type as surely they should be.

WeekDayNames[formatDateTime("%w",systime())] gives the correct element out of the array but has dropped the leading '@' symbol so presumably I will have to duplicate this in my string array?

The Month translation seems to be indexed strangely so that monthNames[formatDateTime("%m",systime())] gives one month in advance of the current month ie Apr rather than Mar for today's date (17th March) without the leading '@'.

FormatDateTime("%m",Systime()) returns 03 in the Watch window so is this returning a string? FormatDateTime("%w",SysTime()) returns 4 as expected for Thursday.

Martin

Link to comment
Share on other sites

Yes, formatDateTime("%m",systime()) returns 01,02,03,...11,12,01 as the months go by, whereas the

formatDateTime("%w",systime()) returns 0,1,2,...5,6,0 as the days go by.

To get round this I have inserted an empty element "" before "@Jan" in my array. Thinking about it, it is obvious as the function is supposed to return the month number which is always indexed from one for January whereas the days of the week have no hard and fast indexing (which often causes problems). In this case Sunday is zero.

Martin

Link to comment
Share on other sites

Sorry, most of my responses are off the cuff so may require you to tweak a little. As you saw, month starts at one and arrays index from zero, so you either need to subtract one or add a dummy value into the array.

As for the @ dropping off, you do not need to add another. The translation has already occurred and doesn't need to be done again.

Link to comment
Share on other sites

Hi again,

My array of weekday names was initialized to {"@Sun","@Mon","@Tue",etc} and in the language list I added the translations for these 7 words. After selecting the language the contents of the array show in the watch window as {"Ned","Pon","Uto",etc} which is as they should accept that the leading '@' has been stripped. When I reselect English as the language, by setting to one that does not exist, various words that I have translations for change back to English but the content of the week day names does not so that in those places where I am displaying an element from the array this stays in the foreign language. Does this point to needing a double '@' before my word? or am I doing something else wrong. As the array has actually changed its contents I can't see how there is any way I can change back to the default language. I would have expected my array to always have the default week day names with the leading '@' character to trigger the change over if the language is NOT English when one of these words in the Array are used.

Martin

Link to comment
Share on other sites

Hi,

I have found a crude fix in that the action to apply whichever language is selected sets the WeekDayNames array to have the correct content without any leading '@' so I am not using the language option for these direct replacements from the look up table. It has the disadvantage that if another language is added via the Tools>Languages>Add route I would also have to add the appropriate Case statement and array of words so it is rather dirty in comparison to your smooth method for normal language transition but I suppose I'll have to live with it unless you can point to a better way.

I need to be able to switch back to English in case one of our Engineers goes out to the foreign country to do some work on the system and then he can reset it to the local language when he leaves.

Martin

Link to comment
Share on other sites

It does the translation when the assignment is made. So you can still keep the translation in the languages, but you need to redo the assignment as well when the switch is made, simply:

WeekDayNames = {"@Sun","@Mon","@Tue",etc}

Redoing it will retranslate it to whatever language was selected (or english if none)

Link to comment
Share on other sites

Another Query. On the DateTime Edit Box how does the Date Format have to be set up? prior to the change to using the language option I had:

"ddd d MMM ',' yyyy" to give me for instance "Thu 17 Mar , 2011"

Now when a particular language is invoked I would want the format the same but the abbreviated day of the week taken from my array of week day names and similarly the month from the array of month names.

I tried a number of combinations of the array names but this produced the interesting:

23 23Na 5e22 5Na 5e22 , 2011

So have you any suggestions for this O wise one?

TIA

Martin

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.