Quote Originally Posted by zouzhijun View Post
Architect is functional for big app development now, but I found that Ext's localization support is not so good
Instantiate the views from "owning" controller and use some sort of localizer like the one I posted here a few weeks ago.

For example, from a event on some controller (button click) you normally instantiate the view the show it:

PHP Code:
onButtonClick: function(button) {
    
Ext.widget("somewindow").show();
    
// Call Localizer...

But imagine that you have to instantiate the same window from different places over the whole application. Worst, you need to set some values (current employee, secutiry constraints, etc.) at view ir controller level before view is shown. You copy over and over the same code.

So the best practice (at least for me) is to instantiate the view from the controller:

PHP Code:
onButtonClick: function(button) {
    
this.getController("SomeController").show(someParams...);

Controller:
PHP Code:
show: function(someParams...) {
    var 
me thiswin Ext.widget("somewindow");
    
// Set up win/controller accorting to operational params and/or context
    
me.getSomeControl().setVisible(...);
    ...
    
// Localize the window
    
Localizer.localize(win);
    
// Show
    
win.show();

I just figure out this way of doing things and, not much a surprise, someone in stackoverflow suggested this way back in november!

Regards.