i want to change the calendar from English (sun,mon,tue…) to French(dim,lun,mar…).
please how can i do it!!!
try this before your calendar code:
isc.Date.shortDayNames = ["dim", "lun", "mar",.....];
Check out the Date.shortDayNames docs for more info.
Hi,
I have the same requirement.
Iso : How can I apply your modification on java side ? (I think that isc.Date.shortDayNames is only usable on javascript directly, doesn’t it ?)
Regards
Currently some date functionality is not yet accessible directly from within smartGWT java. See this post:
http://forums.smartclient.com/showthread.php?t=3250
There are 2 ways to work around this:
- Add some XML tags to your GWT application descriptor to load some JS (like that in the previous post) that directly interacts with Smartclient
- Use what’s called JSNI (JavaScript Native Interface) to interleave some JavaScript.
Hope that helps!
Hi,
i’m try the following code to set french name in calendar column :
public class PlaningTab extends Tab {
public void onModuleLoad() {
Calendar calendar = new Calendar();
calendar.setData(PlaningData.getRecords());
calendar.setWorkdayStart("6:00am");
calendar.setWorkdayEnd("10:00pm");
calendar.setFirstDayOfWeek(1);
// calendar.setProperty(“showWorkday”, true);
this.setPane(calendar);
calendar.draw();
setWorkDayLoading();
}
public native void setWorkDayLoading()/*-{
isc.Date.shortDayNames = ["Lun", "Mar","Mer","Jeu","Ven","Sam","Dim"];
}-*/;
}
but the compilation failed with :
[ERROR] Unable to load module entry point class com.isod.bienmanger.client.Main (see associated exception for details)
com.google.gwt.core.client.JavaScriptException: (TypeError): ‘isc’ est indéfini.
number: -2146823279
description: ‘isc’ est indéfini.
at com.isod.bienmanger.client.tab.PlaningTab.setWorkDayLoading(Native Method)
at com.isod.bienmanger.client.tab.PlaningTab.onModuleLoad(PlaningTab.java:19)
at com.isod.bienmanger.client.Main.onModuleLoad(Main.java:218)
It seem that the isc is not defined but what is the reason ?
Is it because, PlaningTab extend Tab class ?
Thank, i’m a noob
in JSNI and ajax
Change to
public native void setWorkDayLoading()/*-{
$wnd.isc.Date.shortDayNames = ["Lun", "Mar","Mer","Jeu","Ven","Sam","Dim"];
}-*/;
GWT loads the iframe with a name $wnd.
Sanjiv
Oh, thank for the quick reply,
it sound better but Date objet seem to not be initialize.
following code :
public class PlaningTab extends Tab {
public void onModuleLoad() {
Calendar calendar = new Calendar();
calendar.setData(PlaningData.getRecords());
calendar.setWorkdayStart("6:00am");
calendar.setWorkdayEnd("10:00pm");
calendar.setFirstDayOfWeek(1);
// calendar.setProperty(“showWorkday”, true);
setWorkDayLoading();
this.setPane(calendar);
calendar.draw();
}
public native void setWorkDayLoading()/*-{
$wnd.isc.Date.shortDayNames = ["Lun", "Mar","Mer","Jeu","Ven","Sam","Dim"];
}-*/;
}
Throw the following exception :
com.google.gwt.core.client.JavaScriptException: (TypeError): ‘$wnd.isc.Date’ a la valeur Null ou n’est pas un objet.
number: -2146823281
description: ‘$wnd.isc.Date’ a la valeur Null ou n’est pas un objet.
at com.isod.bienmanger.client.tab.PlaningTab.setWorkDayLoading(Native Method)
at com.isod.bienmanger.client.tab.PlaningTab.onModuleLoad(PlaningTab.java:21)
at com.isod.bienmanger.client.Main.onModuleLoad(Main.java:218)
Another Js code is necessary to initialize Calendar object ?
Thank a lot.
Shouldn’t be isc.Date, just Date. $wnd.Data.shortDayNames…
I just tried this and it works fine.
public void onModuleLoad() {
Calendar calendar = new Calendar();
setWorkDayLoading();
calendar.draw();
}
public native void setWorkDayLoading()/*-{
$wnd.Date.shortDayNames = ["Lun", "Mar","Mer","Jeu","Ven","Sam","Dim"];
}-*/;
Sanjiv
Great,
it works, thanks for the quick replies !!
it work, but just about the code of sjivan, the table is not in order
["Lun", "Mar","Mer","Jeu","Ven","Sam","Dim"]
order is just
["Dim","Lun", "Mar","Mer","Jeu","Ven","Sam"]
Thanks
You no longer need to do this if you’re running against SVN / or the latest build. i18 support has been added and you can add
<extend-property name=“locale” values=“fr_FR”/> in your module file and then pass ?locale=fr_FR in your url, or specify it in the meta tag of your host html file. See the GWT i18n docs for more info.