NetTalk Central

Author Topic: JQUERY calendar translation  (Read 2253 times)

lkeyser

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
    • Email
JQUERY calendar translation
« on: January 16, 2012, 07:00:05 AM »
Hi all
My worst nightmare came true. I have to develop a website in a different language, in my case “Afrikaans”.

I’m Using “Hotdates” example as a starting point and need to translate all the JQUERY calendars to “Afrikaans”.

I know from some reading I’ve done, that I need to add the loc:options as seen below to my code.
loc:options = 'dayNames: ["Maandag", "Dinsdag", "Woensdagi", "Donderdag", "Vrydag", "Saterdag", "Sondag"],

I need some baby step guidance where to add it the code please

Clarion 6.3
NETTALK 5


Many thanks
Louis

peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Re: JQUERY calendar translation
« Reply #1 on: January 16, 2012, 07:32:42 AM »
Hi Louis,

In the webhandler procedure - ProcessLink - After parent.

Here's my code - although it's a danish translation I think you get the picture.

Code: [Select]
p_web.site.DateOptions = 'firstDay: 1' & |
                          ',showWeek: true' & |
                          ',monthNames: [''Januar'', ''Februar'', ''Marts'', ''April'', ''Maj'', ''Juni'', ''Juli'', ''August'', ''September'', ''Oktober'', ''November'', ''December'']'&|
                          ',monthNamesShort: [''Jan'', ''Feb'', ''Mar'', ''Apr'', ''Maj'', ''Jun'', ''Jul'', ''Aug'', ''Sep'', ''Okt'', ''Nov'', ''Dec'']'&|
                          ',dayNames: [''Søndag'', ''Mandag'', ''Tirsdag'', ''Onsdag'', ''Torsdag'', ''Fredag'', ''Lørdag'']'&|
                          ',dayNamesMin: [''Sø'', ''Ma'', ''Ti'', ''On'', ''To'', ''Fr'', ''Lø'']'&|
                          ',dayNamesShort: [''Søn'', ''Man'', ''Tir'', ''Ons'', ''Tor'', ''Fre'', ''Lør'']'&|
                          ',closeText: ''Luk'''&|
                          ',currentText: ''I dag'''&|
                          ',nextText: ''Næste'''&|
                          ',prevText: ''Forrige''' & |
                          ',weekHeader: ''Uge'''

Peter

lkeyser

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
    • Email
Re: JQUERY calendar translation
« Reply #2 on: January 16, 2012, 02:48:18 PM »
Thanks Peter

I copied your code and it Worked !!!!! ;D

BUT

If you look at the Hotdates (12) example the “Larger” calendar date formats does not seem to inherit the same settings.
The small popup calendars works great! Any suggestions ?

Thanks
Louis


[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11191
    • View Profile
Re: JQUERY calendar translation
« Reply #3 on: January 16, 2012, 10:46:38 PM »
Hi Louis,

All "text" flows through the .Translate method in the Webhandler procedure.
Ideally you plug your favorite translation engine in there. So, to be completely trivial you can have something like

case lower(p_string)
  of 'February'
    Return 'Feburarie'
end

usually though, of course, one uses a data table, containing the "english" and "alternate" versions, and at this point you do a lookup on the english word, or phrase, and provide the suitable replacement. If the translation set can be fit into Ram (In memory table for example) then so much the better.

Incidentally this whole approach allows the site to be bilingual, at runtime. If you are making the site Afrikaans only, then the list of stuff to translate in the .Translate method is quite small.

Cheers
Bruce