logo       


Re: localization: msg#00007

Subject: Re: localization
Mihnea Galeteanu wrote:
Hi,
I was wondering how would I go about developing an internationalized xform that used resource bundle to localize labels for example.

  Hi,

    I've solved the problem following way:

       <xforms:label rb:msgkey="xxxxx">Default Label</xforms:label>

    and then while setting new locale doing for

    list = document.getDocumentElement().getElementsByTagNameNS(
      NamespaceCtx.XFORMS_NS, XFormsConstants.HINT|ALERT|HELP|LABEL)

    something like this:

        for(int i=0; i<list.getLength(); i++) {
            Element element = (Element) list.item(i);

            String key = element.getAttributeNS(
               Constants.NS_DA_EXTENSIONS, "msgkey");

            // get localized label ...
            String value = getFieldValue(key, locale);

            if (value != null) {
                try {
                    NodeList nl = element.getChildNodes();
                    for(int j=0; j<nl.getLength(); j++) {
                        Node nn = nl.item(j);
                        if (nn.getNodeType() != Node.TEXT_NODE)
                            continue;
                        element.removeChild(nn);
                    }

element.appendChild(element.getOwnerDocument().createTextNode(value));

                } catch(DOMException e) {
                    log.error(e);
                }
            }
        }

   works for me ;-)

--
  Peter Mikula
  Digital Artefacts Inc.
  http://www.digital-artefacts.fi
                                    Any technology distinguishable from
                                       magic is insufficiently advanced




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl


Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe