NetTalk Central

Author Topic: Runtime Language Translation Issues.  (Read 7944 times)

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Runtime Language Translation Issues.
« on: November 16, 2012, 01:52:06 PM »
I am adding an English/French bilingual feature to my NetTalk server application. The user can select a user interface in English or French. I have used the clarion translator class to translate the strings in the web handler translate method embed as shown in the NetTalk Training Book.  Also in the advanced tab of the NetTalk extension I have set the Store Data As:  Western Europe. (Since Clarion does not support the double byte characters set, I do not why the default for this field is uft-8.) For the most part, the web pages are being translated into French with this method, but there are issues.

Alert messages and accented characters.
I have modified web3 example to show the issues with pop-up Alert messages.
If the text passed to loc:alert variable is translated via p_web.translate method, the message accented characters in the text are messed up. If you pass the raw translated string to the loc:alert variable via the translator.translate method the French accented characters are displayed fine. You can see this in the example, login with DEMO without entering a password and you will see a messed up French translation of the log in error message. Login with a login id of GOOD and you will see the correct translation of the error message.  OK, I can live the above issue, just do not use the p_web.translator method when translating text for loc:alert. Here is the real problem. Most text entered in the templates are translated by the p_web.translate method, which can be sent to the loc:alert variable.  The text message for the pop-up to confirm deleting a record is not translated by any method. However if I translate the text using the translator.translate method, the accented character are funny diamonds. In the example program, I used p_web.translate method to translate the delete record message for mailboxes records and the  translator.translate method for the alias records.  Also the cancel button text of this pop-up is not being translated. To show regular screen translation, I added the French translations of the browse navigation buttons to the translation table. 

Dates
Any suggestions on runtime translation of dates? I do not think, I can use the clarion Locale command as this will translate the format of dates for every thread and thus all web users of the server application and I only wish to translate for specific users. Hopefully the only option is not to use an all numeric date.  Also how do I translate the months for the jquery Datepicker lookup.

Thanks
Rob


[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Runtime Language Translation Issues.
« Reply #1 on: November 16, 2012, 11:17:44 PM »
Hi Rob,

lots of points here, I'll try and cover all of them - if I miss any please remind me.

>> Since Clarion does not support the double byte characters set, I do not why the default for this field is uft-8.

utf-8 is not double-byte (that's utf-16). utf-8 is a variable length encoding that extends ascii. So it's very compatible with Ascii.

For normal latin chars (ie A-Z etc) utf-8 and Ascii are the same. Most of the "western" languages (French, German, Spain) all fall into the Ascii set, so utf-8 works fine. If you're not in the west, then utf-8 is the "best" _default_, because any other default would pretty much be guarenteed to be wrong.

Some of the "Save as" options are eqivalent (Spanish, Portuguese, French, Western Europe and Ascii) and all of these map to utf-8 without alteration.

>> Alert messages and accented characters.

I fixed the .Popup method which was over-agressivly encoding. (6.51)

>> Any suggestions on runtime translation of dates?

yes, where you've hard coded a date picture on a browse or form, rather use p_web.site.datepicture. (This is the default for fields without a specfic picture set.)

Then you can set this, in the webHandler, ProcessLink, before parent call, based on some session value.

>> how do I translate the months for the jquery Datepicker lookup.

there is a property you can set in the WebHandler for this as well.
p_web.site.Dateoptions
the options themselves are based on the jQueryUI options for the date picker. An example is provided by Jeffrey in this thread;
http://www.nettalkcentral.com/index.php?option=com_smf&Itemid=36&topic=2286.0

Cheers
Bruce





Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Runtime Language Translation Issues.
« Reply #2 on: November 19, 2012, 12:01:16 AM »
Thank-you for your reply, Bruce.  I have a few additional questions.

>> I fixed the .Popup method which was over-agressivly encoding. (6.51)

Thanks, but also pass the text on buttons of the pop-up through the translator.

>> yes, where you've hard coded a date picture on a browse or form, rather use p_web.site.datepicture. (This is the default for fields without a specfic picture set.) Then you can set this, in the webHandler, ProcessLink, before parent call, based on some session value.

I am unclear on how this will work. Yes, I can change the date picture with p_web.site.datepicture in ProcessLink. But this does not change the language of the date. (e.g. picture of @D3 will show APR 1, 2012 not AVR 1, 2012, which is the French equivalent).

>>For normal latin chars (ie A-Z etc) utf-8 and Ascii are the same. Most of the "western" languages (French, German, Spain) all fall into the Ascii set, so utf-8 works fine. If you're not in the west, then utf-8 is the "best" _default_, because any other default would pretty much be guaranteed to be wrong.

Well utf-8 is not working for me. In my Web3 example change the "Store Data As:" field back to utf-8 and notice the translations of the navigation buttons on the browse. The accented characters are now Chinese characters.  For my purposes "Western Europe" works fine.

Rob

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Runtime Language Translation Issues.
« Reply #3 on: November 19, 2012, 05:23:02 AM »
>> Thanks, but also pass the text on buttons of the pop-up through the translator.

I'm not following you mate. Can you tell me more?

>> But this does not change the language of the date. (e.g. picture of @D3 will show APR 1, 2012 not AVR 1, 2012, which is the French equivalent).

ahh - no normally at this stage I'd point you at the clarion LOCALE command, which lets you "translate" stuff inside the Clarion runtime library. But given that those changes apply to the whole Exe, not just the thread, it's only of value if you have a separate server for each language.

So I guess you have a couple options here;
a) we could re-implement the DateFormat runtime function (which wouldn't be hard given that there are only like 6 pictures)
b) Or we could run the date through a method, like translate, which was a bit clever
c) or stick to "number only" formats like D1, D2 and D4.

Cheers
Bruce

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Runtime Language Translation Issues.
« Reply #4 on: November 19, 2012, 06:18:07 AM »
Bruce,
>> Thanks, but also pass the text on buttons of the pop-up through the translator.
I'm not following you mate. Can you tell me more?

On the delete confirmation, there is two buttons 'OK' and 'Cancel'. The text of these buttons are not being run through the translator.  In French, 'Cancel' should be translated to 'Annular'.

Thanks
Rob.

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Runtime Language Translation Issues.
« Reply #5 on: November 19, 2012, 11:56:40 AM »
Bruce,
I just applied NT6.51. Although the pop-up Alert messages will now display accented characters after p_web.Translation, accented characters are not appearing correctly in delete confirmation pop-up window and neither is "Cancel" button being translated.

On my web3 example program, press the delete button on the mailbox list.
Rob

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Runtime Language Translation Issues.
« Reply #6 on: November 19, 2012, 11:38:46 PM »
Hi Rob,

>> On the delete confirmation, there is two buttons 'OK' and 'Cancel'. The text of these buttons are not being run through the translator.  In French, 'Cancel' should be translated to 'Annular'.

those buttons are provided by the browser - they're not supplied by the app. So they'll appear in what ever language the browser is set to. sort of like the buttons on a Clarion STOP window. You call Stop('whatever') but the Ignore and Abort buttons are part of the RTL.

>> accented characters are not appearing correctly in delete confirmation pop-up

the CONFIRM method in JavaScript is not decoding the html entities correctly - I'm looking into that, but I need to be very careful before changing this.

cheers
Bruce

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Runtime Language Translation Issues.
« Reply #7 on: November 21, 2012, 09:14:36 PM »
Hi Bruce,
Your suggestion of using p_web.site.datepicture for date picture has problem. If this variable is  used for a picture of a date (or Long) field for a column in a browse, the browse will show the proper date format for the column. However, if the user chooses to sort on the date column the locator is not locating on a formatted date and the date pop-up does not display. The only way, I was able to locate on a date was to enter a hard coded  date format in the date picture field. (.e.g ‘@D3’)  In the attached example, the user can log in English or French and the date on the mailbox browse will show different formatted date field based on the language chosen, however pressing the “Start Date” column header will display a number locator not a date locator.

The attached program also has example of the NT6.51 regression errors that I reported in another post. Enter “Bad” for the user at login and the alert error message does not display because loc:alert has an apostrophe. In the MailboxFormControl, I added a button to show a pop-up window. When the user logs in and selects English  language,  the popup appears when selected, if the user logs in and selects the French language the popup window does not appear when selected because the popup title is translated to a French term that contains an apostrophe.

Thanks,
Rob


[attachment deleted by admin]

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Runtime Language Translation Issues.
« Reply #8 on: November 26, 2012, 06:42:41 AM »
Hi Bruce.
Pushing this post. Problems with examples, which has not been downloaded yet.
Thanks,
Rob.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Runtime Language Translation Issues.
« Reply #9 on: November 26, 2012, 09:41:49 PM »
thanks Rob - this is on my list, but I haven't got to it yet. I'm sure you can understand that this has been a very busy month for us, and this week is no exception.

Cheers
Bruce

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Runtime Language Translation Issues.
« Reply #10 on: December 10, 2012, 09:26:29 AM »
Hi Bruce,
I understand that your attention on NT7 right now, however I like to know if the language translation problems could be addressed in the next week. Otherwise, I can write work around code for a partial fix, that I will have to be changed, if there is a fix in the next update. If you can fix the browse locator to do a date lookup on a column that is formatted with p_web.site.datepicture, that would be a huge help.

Thanks,
Rob
« Last Edit: December 10, 2012, 01:08:46 PM by Rob Kolanko »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Runtime Language Translation Issues.
« Reply #11 on: December 10, 2012, 10:56:59 PM »
Hi Rob,

Obviously yes, getting the NT7 build out is top of the list. I'm trying to get that out tomorrow, but of course it depends a bit on how testing goes.

the translation stuff will be high on the list for the next nt6 build, and while I can't guarantee a week, that is hopefully in the same sort of time frame.

cheers
Bruce


Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Runtime Language Translation Issues.
« Reply #12 on: December 27, 2012, 11:50:38 AM »
Hi Bruce,
Pushing this issue again. I have been unable to fix apostrophe in title of pop-up issue or the variable date format in browses with date locators on my own. Let me feel better by at least downloading the example program for my November 22 post. These issues would not necessarily occur only with language translation.
Thanks
Rob Kolanko

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Runtime Language Translation Issues in NT7.0
« Reply #13 on: January 07, 2013, 12:00:59 PM »
I recompiled my NT6.51 example of the issues to NT7.02. It appears that the attempted alert message translation fix of NT6.51 was not included in NT7 which is good because it caused more problems than it fixed.  The following problems still exist. Compile the attached Web3 clarion 8 application using NT7.02.

Alert Messages do not show accented characters.
Start the example, change the language to French and attempt to log in with an invalid password. The accented characters of the popup alert message are incorrect.

Using a variable date picture for browse field will result in no date picture in the locator field for this column.
In the example, I changed the date field’s picture to p_web.site.datepicture for the date field column of the MailboxBrowseControl procedure. Start the example, select English language and log in (with user and password of “demo”) . Browse the mailboxes and you see that the date field picture of the mailbox browse is MMM DD, YYYY. However if you click on the date column header the locater field is a number not a date. If you log in and select French language and the date picture will change to DD/MM/YYYY, but the locator field is a still a number and not a date.
I have found if the template picture field for browse column date field does not contain a literal date picture (e.g. ‘@D3’), then the locator field picture for the date column is number. This is my number one issue, hopefully it is not to hard to fix.

Accented characters in the record delete message are incorrect.
Start the example, select French language and log in (with user and password of “demo”). Browse the mailboxes, select a record press the delete button,  the accented characters of the popup alert message are incorrect.

Browses or Forms in a pop-up will not appear if the title of the pop up contains an apostrophe.
Start the example, select English language and log in (with user and password of “demo”). Browse the mailboxes, select a record press the change button,  on the form press the “Display Popup” button and a pop-up form will appear. Log out, select French language and log in. Browse the mailboxes, select a record press the change button,  on the form press the “Display Popup” button a pop-up form and a pop-up message will not appear. This is because the title of the popup message translates in French to phrase with an apostrophe.


[attachment deleted by admin]

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Runtime Language Translation Issues.
« Reply #14 on: January 17, 2013, 08:19:15 AM »
Bump