* This post will be written both in Turkish and English : **************************************************************************************************
Merhabalar Tam olarak sorununuzu şimdi anladım. Bu noktada size gwt'nin kendi i18 mekanizmasını önerebilirim. (http://code.google.com/docreader/#p=google-web-toolkit- doc-1-5&s=google-web-toolkit- doc-1-5&t=DevGuideStaticStringInternationalization) Basitçe örnek vermek gerekirse: MyConstants_tr.properties dosyasi --------------------------------- dateFormat=d/m/Y --------------------------------- MyConstants_us.properties dosyasi --------------------------------- dateFormat=m/d/Y --------------------------------- Aynı paket içine arayüzümüzü oluşturalım: --------------------------------- public interface MyConstants extends Constants { String dateFormat(); } --------------------------------- DateField'ı oluştururkende şu şekilde parametre verelim: MyConstants myConstants = (MyConstants) GWT.create(MyConstants.class); DateField df = new ... df.setFormat(myConstants.dateFormat()); Umarım sorununuzu çözer. Verdiğim örneği fikir vermek amaçlı düşünün belki bir yanlışlık yapmışımdır verdiğim linkte daha ayrıntılı görebilirsiniz İyi çalışmalar ******************************************************************************************************** Greetings. I got it now. At this point I can only suggest GWT's i18 mechanism. (http://code.google.com/docreader/#p=google-web-toolkit- doc-1-5&s=google-web-toolkit- doc-1-5&t=DevGuideStaticStringInternationalization) To make simple demonstration: MyConstants_tr.properties file: --------------------------------- dateFormat=d/m/Y --------------------------------- MyConstants_us.properties file: --------------------------------- dateFormat=m/d/Y --------------------------------- Create the inteerface under the same package with constant files --------------------------------- public interface MyConstants extends Constants { String dateFormat(); } --------------------------------- When setting the format of a date field use the constant like this: MyConstants myConstants = (MyConstants) GWT.create(MyConstants.class); DateField df = new ... df.setFormat(myConstants.dateFormat()); I hope this will solve your problem. My example above is just for giving an idea and it may include some errors for a detailed info about the use, please refer to the link above Bye On Nov 24, 1:18 am, Alp Timurhan Çevik <[EMAIL PROTECTED]> wrote: > Merhaba, > > Başka kişilerin de işine yarayabilir diye düşünüyorum, bu sebeple hem > ingilizce hem türkçe yazacağım. > > Hi, > > Thank you for your reply. My problem is actually not about how to set > the format of datefield, it is how to set the format according to > i18n. While you can set the format using setFormat("d/m/Y"), you are > setting it for only "d/M/Y" and here starts the problem. > > I am currently developing and international application, which > includes users from different localizations, and have clients who > think that "10.11.2008" as November 10th and also clients who think > that it is October 11th. So, it is not possible to have a static > format for the whole application but rather a changing one, according > to users locale, a functionality that java has, and also gwt has. I > have not yet found a solution with gwt-ext to this issue, as I have to > statically specify the date format, but depending on the format, this > will confuse either the ("d/m/y") guys or the ("m/d/y") guys. > > Thus, the actual problem seems like i18n support. > > ---------------------------------------------- > > Merhaba, > > Başkaları da faydalanabilir düşüncesi ile hem ingilizce hem türkçe > yazmak istedim. Cevabınız için teşekkür ederim, netleştirilmesi > gereken bazı noktalar var sanırım. Asıl problemim datefieldin > formatını set etmek değil de, bu formatı internationalization > kuralları içerisinde set etmek. Eğer setFormat("d/M/Y") gibi bir şey > kullanılırsa, bu tam olarak formatı "d/M/Y" ye set eder ki problem > burada başlıyor. > > Üzerinde çalıştığım uygulama, uluslararası bir uygulama ve > kullanıcılar içeriisnde "10.11.2008" in 10 kasım olduğunu düşünenler > ve 11 ekim olduğunu düşünenler mevcut. Yani kullanıcıya göre, ("d/m/ > y") veya ("m/d/y") türünü göstermek gerekiyor. Burada custom bir > mekanizma implement etmek gereksiz gibi duruyor, zira java ve gwt > içerisinde, user localeine göre bu formatlardan birisini otomatik > seçecek mekanizmalar var, bu mekanizmalarıda browser settingleri ile > ilişkilendirmek gayet kolay. Eğer ("d/m/y") gibi statik bir format > kullanılırsa, bu amerika gibi ülkelerdeki kullanıcıları şaşırtacak, > ("m/d/y") ise Türkiye gibi ülkelerdeki kullanıcıları şaşırtacak. > > Netice olarak, asıl problem internationalization desteği gibi duruyor. > On 23 Kasım, 12:02, barraQda <[EMAIL PROTECTED]> wrote: > > > Merhaba Alp Bey, > > > Sorununuzu anladım fakat, kod olarak neyi nasıl kullandığınızı > > yazınızdan çıkaramadığım için konuyla alakalı bildiğim her şeyi > > yazmaya çalışıcağım, > > > Eğer kullandığınız widget direk DatePicker ise bu widget değer olarak > > zaten Date döndürür, gwt-ext'in DateUtil sınıfını kullanarak bu date'i > > istediğiniz gibi render edebilirsiniz: > > > DateUtil.format(date, "d/m/Y"); > > > Eğer DateField kullanıyorsanız, DateField'ın formatını > > ayarlamalısınız: > > > DateField df =new > > df.setFormat("d/m/Y"); > > > Yok DatePicker Editable Gridin içerisinden çağrılıyor ise Grid'in > > ilgili kolonunu tanımlarken parametre olarak renderer > > tanımlamalısınız. Şu an kendi kodum yanımda olmadığı için, yanıltmamak > > adına örnek yazmıyorum ama zaten gwt-ext forumlarında aratırsanız > > rahatça bulabilirsiniz. > > > Umarım sorunuzu doğru anlamışımdır. Başka sorunuz var ise, biliyor > > isem memnuniyetle yanıtlarım > > > İyi çalışmalar. > > > barraQda > > > Alp Timurhan Çevik yazdı: > > > > Hello, > > > > I have a problem regarding dateformat in datepicker. > > > > Fromhttp://groups.google.fr/group/gwt-ext/browse_thread/thread/a6fa8aa9cb..., > > > the dateformat used for datepicker is not the one used in gwt. > > > > The problem is, the format depends very much on the locale being used. > > > In most of the eu countries, the date is written as d/m/y where as us > > > uses it as m/d/y, thus developing an application with i18n in mind, > > > both formats are invalid for a user which is in a different locale. > > > Finding out the user's locale format and setting the string > > > accordingly could be a solution, but a very inefficient one. > > > > The best scenario, like java's built in or gwt's, the format should be > > > defined according to the users locale (although the gwt one is also > > > missing some formats, so it is not complete, one digit day is rendered > > > like 11/1/08 and if you would like to have 11/01/08 then it is tough > > > to do that. The need for this arises especially in grids, the one > > > digit days are not aligned with others, making it tough to read and > > > decreases usability.) > > > > Am I missing something ? Is there any mechanism (which I could not > > > figure out) to use ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "GWT-Ext Developer Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/gwt-ext?hl=en -~----------~----~----~----~------~----~------~--~---
