[jbosstools-issues] [JBoss JIRA] Commented: (JBIDE-2969) i18n support in xmodel

Sean Flanigan (JIRA) jira-events at lists.jboss.org
Sun Oct 26 23:29:31 EDT 2008


    [ https://jira.jboss.org/jira/browse/JBIDE-2969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12435512#action_12435512 ] 

Sean Flanigan commented on JBIDE-2969:
--------------------------------------

Given the upcoming freeze, I thought I'd better mention this, since it means more code changes, at least to achieve full i18n support.

I've been having a go at defining an XPath (by guessing which text should be translated) and this is what I've got so far:
  //@displayName | //XModelAttribute/@name |  //XModelAttribute/@default | //Constraint/value/@name

However, the latter two parts could be a problem.  These strings are apparently used to populate lists of some sort (maybe drop downs) like these:
(a)
<XModelAttribute default="2.4" name="Servlet Version" xmlname="servlet_version">
    <Constraint loader="List">
      <value name="2.3"/>
      <value name="2.4"/>
      <value name="2.5"/>
    </Constraint>
    <Editor name="List"/>
</XModelAttribute>
(b)
<XModelAttribute default="yes" name="Show Grid" xmlname="show_grid">
	<Constraint loader="List">
		<value name="yes"/>
		<value name="no"/>
	</Constraint>
	<Editor name="CheckBox"/>
</XModelAttribute>

Case (a) is probably fine; I doubt we want to translate version numbers or font sizes.

In case (b), we could just look up a localised replacement for "yes" and "no" as per Denis's suggestion, but the problem is that the values are not just displayed to the user, they are accepted as input (eg when we query the UI elements state: Are you "yes" or "no"?)  In situations like this, it is best if the UI element holds both the English and localised values, one for answering the question "What is your selected value?" to code which expects English, and one for displaying to users who expect their own language.

To do this would require a code change (in addition to Denis's key lookup suggestion) in any affected cases.  In this particular case, I think we would need to change the class org.jboss.tools.common.meta.constraint.impl.XAttributeConstraintAList to keep a list of localised values as well as the English values.  The corresponding UI class(s) would also change, eg replacing the English values with localised values and storing the English values as extra attributes.  (If this were Swing, I'd use something along the lines of DefaultMutableTreeNode.setUserObject().)

Alternatively, you /could/ implement something specialised like <Constraint type=Boolean> which displayed localised strings for Yes and No, but (a) that would require changing a lot of .meta files, and (b) it would only solve the case for boolean values.  I haven't looked very hard yet, but I suspect there will be other cases which aren't boolean.


> i18n support in xmodel
> ----------------------
>
>                 Key: JBIDE-2969
>                 URL: https://jira.jboss.org/jira/browse/JBIDE-2969
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: common
>            Reporter: Sean Flanigan
>            Assignee: Viacheslav Kabanovich
>             Fix For: 3.0.0.cr1, 3.0.0.GA
>
>
> Snjezana Peco wrote in <http://lists.jboss.org/pipermail/jbosstools-dev/2008-August/001811.html>:
> > I believe that xmodel will make a problem during the 
> > internationalization process because it contains hard-coded constants. I 
> > am not sure if there is any way to internationalize those constants (the 
> > org.jboss.tools.common.model/meta/studio_eclipse_option.meta file 
> > contains the Visual/Source, Source, Preview constants, for instance. I 
> > can't find a way to localize them).
> That's http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbosstools/trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta?view=markup
> I suggested merging a template with translated strings during the build process, but then Denis Golivin wrote:
> > IMO That can be fixed. Now names from .meta files are used during 
> > rendering trees, names from .meta files come straight to tree node 
> > label. They cannot be just translated because somewhere in the code name 
> > can be used to obtain object from model. That names are rather keys or 
> > IDs, that should be rendered right with i18n support.
> >
> > I CCed Viacheslav Kabanovich, he is the right guy to find the way to fix 
> > i18n problem in XModel.
> That file still appears to contain embedded English strings, so I don't think this problem has been solved yet.  I don't fully understand the details of the issue, but since I'm raising i18n jiras, I thought I'd better bring it up again.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jbosstools-issues mailing list