That's definitely the way I would have done the translate.xqy module if maps had been available in the server at the time,
________________________________ From: [email protected] [[email protected]] on behalf of Ryan Dew [[email protected]] Sent: Wednesday, February 20, 2013 2:10 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] gettext for XML and MarkLogic? Mine is more of a bundle concept. It looks like in the implementation Mike mentioned that versions of text in the various languages are all stored in the same XML document. In my code there are separate 'bundles' for each language that look like the following: <i18n locale="en_US" id="general"> <map:map xmlns:map="http://marklogic.com/xdmp/map" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <map:entry key="greeting"> <map:value xsi:type="xs:string">hello</map:value> </map:entry> <map:entry key="farewell"> <map:value xsi:type="xs:string">goodbye</map:value> </map:entry> </map:map> </i18n> Even now looking at that, not sure why I didn't use the xml:lang attribute instead locale. There is always something that can be tweaked... -Ryan Dew On Wed, Feb 20, 2013 at 2:52 PM, Jakob Fix <[email protected]<mailto:[email protected]>> wrote: Thanks Michael and Ryan, I think this is what I'm looking for. Ryan, any chance to see a schema of the map:map object, is it inspired by the translate.xqy Michael mentioned? Or based on a "bundle" concept that is generally known (except by me ;-))? Looking forward to forking it! cheers, Jakob. On Tue, Feb 19, 2013 at 8:13 PM, Ryan Dew <[email protected]<mailto:[email protected]>> wrote: I'm sure it can be improved, but if you want to see an example of a library that makes use of map:map objects and server fields, like Mike mentioned, you can go here: https://github.com/ryanjdew/XQuery-i18n/blob/master/i18n.xqy -Ryan Dew On Tue, Feb 19, 2013 at 10:58 AM, Michael Blakeley <[email protected]<mailto:[email protected]>> wrote: Have you looked at /MarkLogic/appservices/utils/translate.xqy yet? It's undocumented and may not do everything you want, but it might offer some ideas. For a large lookup-table I would consider using map:map XML serialization. That way you can build the map quickly from stored XML, and lookups via map:get will be very fast. For even more speed you could cache the map in a server-field, with versioning to handle updates. -- Mike On 19 Feb 2013, at 07:16 , Jakob Fix <[email protected]<mailto:[email protected]>> wrote: > Hi, > > this may be slightly off-topic for the list .... say, you want to maintain an > application that provides several user interface languages (say, English, > French and German), are there any best practices on managing labels and > static text? > > I'm thinking of having a simple look-up XML file that contains the labels > indexed by language. But then, the question is how to deal with plural forms, > interspersing dynamic bits (like "We have found " + 11 + " hits.") and all > the other fun bits. I know that this is a general headache, and that there > are solutions like gettext (and others?). Is there an implementation for XML, > by any chance? > > Any experience with that in the context of MarkLogic? Also, would a look-up > XML be efficient when used via xquery and xslt? > > I'd be grateful for any pointers. > > cheers, > Jakob. > _______________________________________________ > General mailing list > [email protected]<mailto:[email protected]> > http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected]<mailto:[email protected]> http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected]<mailto:[email protected]> http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected]<mailto:[email protected]> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
