NetTalk Central

Author Topic: How to translate the calendar  (Read 5502 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
How to translate the calendar
« on: May 19, 2009, 04:02:23 AM »
Hi,

How to translate the calendar?

Thanks
Alberto
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: How to translate the calendar
« Reply #1 on: May 19, 2009, 07:12:56 AM »
you'd have to edit the calendar.js files.

Cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: How to translate the calendar
« Reply #2 on: May 19, 2009, 01:56:03 PM »
OK, then I will have
calendar_eng.js
calendar_spa.js
calendar_por.js
etc
but how do I use it in _runtime_
Remember, we have one site, multi users each one with its own language.

Thanks
Alberto
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: How to translate the calendar
« Reply #3 on: May 19, 2009, 10:14:25 PM »
What I would do is this;

a) translate the calendar files into _eng, _por and so on.
b) follow the thread in Share Knowledge on "Creating custom All files"
c) set the user to the appropriate All file (as below.)

In the WebHandler is a method called
IncludeScripts. This method builds the "<script>" part of the header.
Look a the method in NetWeb.Clw for a sample.

Anyway, this method uses a property called
self.site.HtmlCommonScripts

By overriding this property, before the parent call, you can change what is returned based on the user's Session Value.

Tip: I've made a small change in PR39 so that "NetWebPages" use this method. In PR38 only browses and forms use this method. So use PR 39 for best results.

Tip2 : There's a method call, AddScript, which formats the script tag for you. eg
self.site.HtmlCommonScripts = self.AddScript('all_eng.js')

Incidentally there's an equivalent method for Styles (IncludeStyles) so the same approach can be used if you want to provide different styles to people.

Cheers
Bruce


Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: How to translate the calendar
« Reply #4 on: May 20, 2009, 03:20:00 AM »
a) ok,
What about calendar.htm, do I need to translate it too?
I've search for it and did not found it in any file.
And if I should need to translate it, where do I set which file to use?

b) ok, crystal clear.

c)
I've looked at the NetWeb.Clw , the method returns   "ans = self.site.HtmlCommonScripts"
I've found

  s_web._SitesQueue.Defaults.HtmlCommonScripts = |
    s_web.AddScript('prototype.js') &|
    s_web.AddScript('rico.js') &|
    s_web.AddScript('chrome.js') &|
    s_web.AddScript('netweb.js') &|
    s_web.AddScript('tabs.js') &|
    s_web.AddScript('tabsxp.js') &|
    s_web.AddScript('xptaskpanel.js') &|
    s_web.AddScript('calendar2.js') &|
    s_web.AddScript('calendar6.js') &|
    s_web.AddScript('sorttable.js') &|
    s_web.AddScript('tiny_mce.js') &|
  ''
 
It is ok to asume that p_web.Site.HtmlCommonScripts is set to this default because p_web derives from s_web.

And then, what is returned from the IncludeScripts method is:

  self.site.HtmlCommonScripts = |
    s_web.AddScript('prototype.js') &|
    s_web.AddScript('rico.js') &|
    s_web.AddScript('chrome.js') &|
    s_web.AddScript('netweb.js') &|
    s_web.AddScript('tabs.js') &|
    s_web.AddScript('tabsxp.js') &|
    s_web.AddScript('xptaskpanel.js') &|
    s_web.AddScript('calendar2.js') &|
    s_web.AddScript('calendar6.js') &|
    s_web.AddScript('sorttable.js') &|
    s_web.AddScript('tiny_mce.js') &|
  ''
 
  not 'all.js'
 
  Then I dont undestand the need of making the all*.js files
  and what to return from ImcludeScripts before the parenta call.
 
 
  Thanks again,
  Alberto
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: How to translate the calendar
« Reply #5 on: May 20, 2009, 09:24:59 AM »
In Web Server procedure, advanced tab, tick on "combine files".
This replaces all the files with one big all.css and all.js

Cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: How to translate the calendar
« Reply #6 on: May 20, 2009, 09:37:03 AM »
Ahhhhh ok and...

What about _calendar.htm_
, I need to translate it too.
I've search for it and did not found it in any file.
And if I should need to translate it, where do I set which file to use?

I've also found some methods to create month, year in which the month name is hardcode, has it anything to do with the calendar?

Thanks
Alberto
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: How to translate the calendar
« Reply #7 on: May 20, 2009, 10:46:55 PM »
Yes you probably need to translate calendar.htm as well.
As far as I recall it's called from _inside_ the calendar.js files.

Cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: How to translate the calendar
« Reply #8 on: May 21, 2009, 02:01:28 AM »
Yes, the calendar says:

Note: Script consists of two files: calendar?.js and calendar.html

But I cant found any reference to calendar.htm in any of the web\scripts files.
Can you?

Thanks
Alberto
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: How to translate the calendar
« Reply #9 on: May 21, 2009, 08:06:29 AM »
in calndar2.js (for example)
line 71

        var obj_calwindow = window.open(
                'calendarlookup.htm?datetime=' + this.dt_current.valueOf()+ '&id=' + this.id,
                'Calendar', 'width=200,height='+(this.time_comp ? 215 : 180)+
                ',status=no,resizable=no,top=200,left=200,dependent=yes,alwaysRaised=yes'
        );


Cheers
Bruce