2 Replies Latest reply on Jan 9, 2013 2:56 PM by Eric Wittmann

    Errai UI + Internationalization

    Eric Wittmann Apprentice

      Apologies if this has been discussed here or elsewhere already (I searched the forum and JIRA without success, but you know how that goes).  Are there any features planned around internationalization and Errai UI?


      It can be tricky supporting something like that in a UI framework, particularly one like Errai (templates, GWT based).  I've never been particularly fond of GWT's solutions to this problem [https://developers.google.com/web-toolkit/doc/latest/DevGuideI18n].  I prefer the dynamic string i18n approach to the static one (who wants to create permutations for every language?).  But that doesn't really help me if I'm using a template framework like Errai's.


      My thought is that it would be ideal if the template could be augmented with the i18n keys where appropriate, which result in dynamic replacement at runtime based on a message bundle pulled down from the server.  The template would continue to have the default language strings in it, but those strings would be replaced at runtime with localized values.  The primary benefits of this approach:


      1) Doesn't add to the # of permutations during compile

      2) Templates continue to work as Live Preview in the local language


      I can imagine something like this in the template:


        <legend>Log in to your account</legend>
        <label for="username" i18n-key="login.username.label">Username</label>
        <input id="username" type="text" placeholder="Username">
        <label for="password" i18n-key="login.password.label">Password</label>
        <input id="password" type="password" placeholder="Password">
        <button>Log in</button>


      The only addition is the i18n-key attribute on the label elements.  Errai would need to pull down the message bundle appropriate for the current locale (or it could be included in the host file as suggested by GWT docs).  The Errai template engine would then need to replace the text of the labels with the values found at the appropriate i18n keys in the message bundle.


      Is there already a best practice for this?  Should Errai UI support something like this?