1 Jul 2009 4:28 AM #1
[3.0]Automatic translation of ExtJs Components v1.6 NEW
[3.0]Automatic translation of ExtJs Components v1.6 NEW
INFO : 13.07.2009. From now source is hosted on http://code.google.com/p/extjsdyntran/
There is also client only version.It must be deployed to server also, but does not require serverside support (PHP or Java). Translations will be made directly from Google Translation Service. This is limited version with less features but it is zero configuraiton. Use it for testing and previewing this add-on.
Screencast can be found also on project download page.
I have created additional override to Ext.Component to implement translation functions to all GUI Ext components through Google Translation API.
These translation functions will call server side through ajax calls to translate field labels, titles, messages and other standard text properties of Ext GUI components.
Server side is written as Java Servlet and PHP using Google Translation API (Java and PHP version). So you can use which one you prefere.
I have noticed one problem with PHP. When server runs on intranet and use proxy to exit to Internet, PHP does not work?!?! I am not PHP developer so I am not using original PHP but Quercus PHP Java library so maybe the problem is in this library?!
Next version will contain server side cached translation to minimize calls to Google Translation Service. Automatic translation will be cached (saved to text file ) so admin can additionaly translate words that are not translated or quality of translation is not good enough.
Never the less this will help developers to add some degre of automatic translation of their projects.
There is only one line of code to call to start automatic translation.
See more in Ext.translate.js and attatched project.
Project is not finished yet but working example with sources you can find in the attachment.
After new version is finnished I will post new sources here.
Any ideas and suggestions are wery wellcome.
In the attatchement one will find ziped Eclipse project that can be rebuilt and deployed on the Tomcat or any other java web server.
When you start the Tomcat and install the war file go to
Server side is written in Java but also the PHP version is available.
Caching is added (Java only) so already translated text is no longer sent to GT API.
For PHP version I'm using Resin Quercus java library (PHP engine 100% written in Java).
There is no need for PHP instalation.
For more info go to http://www.caucho.com/ and http://quercus.caucho.com/
Requirements : java jdk 1.5 ; Tomcat 5/6 ; Eclipse ; ExtJs 3.0
1. Unzip project in Eclipse workspace folder and import it.
2. Download resinn from http://www.caucho.com/download/resin-4.0.0.zip and copy all jar files from lib folder to project subfolder WebContent\WEB-INF\lib
3. Fix paths to libraries. (included in project subfolder WebContent\WEB-INF\lib).
4. Create new Server project; create server instance in Eclipse; add this project to Server instance
5. Create new empty Dynamic Web Project and copy EXTJS3 library inside WebContent folder. Deploy it to server instance also.
6. Start Tomcat in Eclipse and right click to index.html -> Run As -> Run on Server. File is in WebContent of this project.
IMPORTANT NOTE : Resin class com.caucho.vfs.HttpStream has a bug so you need to remove it from resin.jar (open with winzip or winrar).
When project is rebuilt, new replacement class will be used.
Source is included inside project. For more details see header in included HttpStream.java file.
Added server side caching
Added autotranslate on component create
Added ExtJs Web Desktop demo with Google Translation
(for Web Desktop Demo , go to Start and Window 6 where you can change language)
Source code optimization and smaller fixes.
Ext.MessageBox auto translation added.
Added client side caching object Ext.translate.Cache (not implemented yet).
Fixed bug in Web Desktop demo with Google Translation.
Fixed minor bugs and implemented client side caching.
New version with rewritten code and improved speed, now on Google code.
Version 1.4 available for download.
Video demoes added under download section on project page.
Version 1.5 BETA available. For more info visit link on top of this post.
Version 1.6 available. For more info visit link on top of this post.
Last edited by tomim; 30 Sep 2009 at 9:01 AM. Reason: new version update
1 Jul 2009 5:30 AM #2
1 Jul 2009 7:00 AM #3
My idea is if browser send new request to the server for new GUI language...then server side program will search for words in cache and if not found, new translation request will be sent to the Google Translation Service.
New translation will be serialized back to cached txt file and to the browser .
Later on, developer can check translations in cached files (I will name it like ENGLISH.properties etc...).
1 Jul 2009 7:15 AM #4
5 Jul 2009 6:17 AM #5
You are correct about near zero-config. It will be impossible to have 100% translation
but translation of original properties inside ExtJs componets should work nicely.
I have added caching (java only), Web Desktop Demo with Google Translation and some new updates in Ext.translate.js. Sources in first post of this thread are replaced with new version.
8 Jul 2009 9:21 AM #6
I have added new improved version.
Next step is to implement global client side cache. (new Ext.translate.Cache object is included)
Many object can have the same texts for the titles, field names etc. It is not needed to repeatedly call remote translation of already translated resources.
13 Jul 2009 6:04 AM #7
!!! NEW VERSION !!! Ext.translate 1.3
It has a lot of enhancements. Code is rewritten for usage of client side cache
for translated texts. There is many code optimizations to improve speed and
minimize remote calls. AJAX Calls are made on component init so all fields is translated
before component is rendered.(synchronous AJAX calls
using addon library ext-basex.js)
Code is now located on Google Code page... http://code.google.com/p/extjsdyntran/
15 Jul 2009 5:12 PM #8
16 Jul 2009 5:15 AM #9
maybe you can attach some sample screenshots or sample translations to see what is translated and how is the quality of this.
how is the problem solved that technical things are a little bit different translatet than normal speach?
maybe you can also make connection to tools like babelzilla?
( see glossary of babelzilla http://www.babelzilla.org/index.php?...ary&Itemid=219 and an firefox extension using this https://addons.mozilla.org/de/firefox/addon/5810 )
21 Jul 2009 3:27 AM #10
I am sure you are aware that there is no literaly and gramaticaly 100% correct automatic translation engine.
As I mentioned on project page, idea is to help developers to have some kind of solution for automatic loading of translations and applying them to Ext.Component elements. It is AJAXED, no need for loading locale.js files and refreshing whole page.
The whole concept is that application is developed on development environment. In process of development, you give support to some other languages simply by using this add on, selecting different language and translations will be done with help of some translation service (in this case Google Translation Service). Translated words are saved in text files on server side. In production environment is enough to copy translated text files (i need to put some documentatin how to do it ) and server side support I wrote will load those translated files on startup.When user selects one of supported languages, translations will be loaded dynamicaly from server side cache. It is faster than translating again from remote service. Also you can be sure that translations will be correct as they are loaded from already corrected translation files. You can also give support to any other language not supported by Google Translation Service by creating your own language text file.
For Kenian language you will create KENIAN.properties file and wrote some translations like
english word = kenian word
And add KENIAN in Ext.translate.languages.
If that kind of plugins exists for all other browsers then my addon will not be neededd at all. On other hand, if you are running application in some company intranet (banks for example) which have firewalls blocking such services or using proxies for filtering urls and data, then that kind of addons for page translations are not good enough.