i18n is it implemented yet?

Hi,
is i18n officially implemented yet? If no, then what is the schedule for implementation?

Thanks
Antoni

Hi,

You could use the I18N4Vaadin add-on. It’s working ok if you want to be able to change the language on the fly but a better integration in the core is something that we expect too. The main reason behind this is that we still have to manage each component individually (keep a reference to it, etc).

Internally, we have a dictionary system where we use the English “label” as the key. That way we can build our UI without bothering about the i18n at all and a callback is processing all UI components with the current locale.

Something similar in Vaadin would be great, with the listener contract that I18N4Vaadin provides.

For our PoC, we used the add-on that resulted in quite a lot of boiler plate code but it works.

S.

Hi,
we have also our own i18n implementation, but it’s based on older Vaadin version. We are looking for official version that we can upgade our software.

We have made some preliminary design proposals for an i18n framework, but it’s currently not scheduled even for Vaadin 7. So, you can assume that we won’t have i18n support in the core framework in the foreseeable future (the future beyond the initial release of Vaadin 7 can not be foreseen).

There are currently
three add-ons
that provide support for i18n.

I18n support can be implemented in many different ways and we wouldn’t want to tie developers down too much, nor give a solution that is just one of the alternatives. An i18n solution in the core framework should be something that can’t be done with add-ons, such as something deeply engraved in AbstractComponent and Application, possibly tied with the Vaadin data model and events.

Currently, if you don’t use the add-ons, my recommendation is to: 1)
use Java resource bundles
and build any custom locale data storage implementation behind the standard interfaces, 2) use the ThreadLocal pattern to access application-global locale resources, 3) have a mechanism to rebuild the UI if the user changes the locale.

Related Knowledge Base articles:
#79: How do I internationalize my application?
,
#84: How do I change the language of the user interface?
(Pro Account required).

Hi,

You could also try JainI18N add-on. It’s works cool, if you are looking for add-on that directly talk to core with minimal configuration required for component.
We used this add-on in an internal project and result look very promising.

Thank you
Tushar

Hi, we are using i18n with resource bundle, its work perfect:

example:

(relevant information in buildForm() method

package br.com.vaadin.VaadinTest;

// avoid imports

/**

  • Main UI class
    */
    @SuppressWarnings(“serial”)
    @UIScoped
    public class VaadinMainUI extends UI implements Serializable{

    @WebServlet(urlPatterns = {“/app/“,”/VAADIN/”}, initParams = {
    @WebInitParam(name = “UI”, value = “br.com.vaadin.VaadinTest.VaadinMainUI”),
    @WebInitParam(name = “UIProvider”, value = “org.vaadin.virkki.cdiutils.application.CdiUIProvider”)})
    public static class VaadinMainUIServlet extends VaadinServlet {}

    @Inject
    @QProductService
    ProductService productService;

    private Table table;

    private GridLayout form;

    List productList = new ArrayList();

    ResourceBundle res = ResourceBundle.getBundle(“br.com.erp.i18n.messages”);

    @Override
    protected void init(VaadinRequest request) {
    initLayout();

    }

    private void initLayout(){
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSpacing(true);
    mainLayout.setMargin(true);
    mainLayout.addComponent(new Label(“Teste Vaadin”));

     mainLayout.addComponent(buildTable());
     mainLayout.addComponent(buildForm());		
     
     setContent(mainLayout);
    

    }

    private Component buildTable(){
    table = new Table(null);
    table.setWidth(“500px”);
    table.setSelectable(true);
    table.setImmediate(true);
    return table;
    }

    private Component buildForm(){
    form = new GridLayout(2,3);

     TextField productName = new TextField(res.getString("label_product"));
     TextField productCode = new TextField(res.getString("label.productCode"));
     TextField productType = new TextField(res.getString("label.productType"));
     
     form.addComponent(productName);
     form.addComponent(productCode);
     form.addComponent(productType);
     
     return form;
    

    }
    }[b]

[/b][b]

[/b]